This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Tsvetan Stoychev <tsvetan.stoychev@jarlssen.de> | |
* @website http://www.jarlssen.de | |
*/ | |
class MyCompany_MyModule_Helper_Data extends Mage_Core_Helper_Abstract | |
{ | |
/** @var Varien_Db_Adapter_Interface $readConnection */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT `oi`.`item_id`, `o`.`customer_id` FROM `sales_flat_order_item` AS `oi` | |
RIGHT JOIN `sales_flat_order` AS `o` ON oi.order_id = o.entity_id and o.customer_id != 8 WHERE (oi.item_id IN(2, 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* In case we got validation error we have to specify an error | |
* message, that will be shown in the quote | |
* (usually shown in the cart heading section or product heading section | |
* | |
* @return string | |
*/ | |
public function getQuoteMessage() | |
{ | |
return "Not allowed product quantity in the cart"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* In case we got validation error we have to specify and error | |
* message, that will be show in the quote item line | |
* | |
* @return string | |
*/ | |
public function getQuoteItemMessage() | |
{ | |
return "The quantity must be multiple times of 10"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implementation of the validation logic | |
* | |
* @param Mage_Sales_Model_Quote_Item $item | |
* @return bool | |
*/ | |
public function validate($item) | |
{ | |
$qty = $item->getQty(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<global> | |
<jarlssen_custom_cart_validation> | |
<rules> | |
<different_manufacturer_not_allowed> | |
<product_type>simple</product_type> | |
<model>example_validation/validator_validateAllowedManufacturers</model> | |
<origin>example_validation</origin> | |
<code>1</code> | |
</different_manufacturer_not_allowed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config> | |
<modules> | |
<MyCompany_ExampleValidation> | |
<active>true</active> | |
<codePool>local</codePool> | |
<depends> | |
<Jarlssen_CustomCartValidation /> | |
</depends> | |
</MyCompany_ExampleValidation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td> | |
<input value="William Shakespeare" name="option[value][116][0]" class="replace-content pseudo-input input-text required-option"> | |
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td> | |
<div id="option[value][116][0]" class="replace-content pseudo-input input-text required-option">Option 2</div> | |
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$chooserHelper = Mage::helper('jarlssen_chooser_widget/chooser'); | |
$customChooserConfig = array( | |
'input_name' => 'entity_link', | |
'input_label' => $this->__('Custom entity'), | |
'button_text' => $this->__('Select entity…'), | |
'required' => true | |
); | |
$chooserBlock = 'custom_module/chooser'; |