Skip to content

Instantly share code, notes, and snippets.

name description is_active website_ids customer_group_ids coupon_code sku uses_per_coupon uses_per_customer from_date to_date discount_amount simple_action
Test Name Test Description 1 0 all test-code_all_groups wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 0 0,1,2 test-code_specific_groups wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 all 0 test-code_all_websites wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 all 0 test-code_all_websites_multiple_skus wbk002c,shw003 1000 10 4-12-2015 1.33 by_fixed
@ceckoslab
ceckoslab / order ids helper
Created July 28, 2014 15:32
Example snippet of helper class, that checks if the order items are owned by the current customer
<?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 */
@ceckoslab
ceckoslab / example sql query
Created July 28, 2014 15:25
Check if order items are owned by the current customer
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))
/**
* 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";
/**
* 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";
}
/**
* Implementation of the validation logic
*
* @param Mage_Sales_Model_Quote_Item $item
* @return bool
*/
public function validate($item)
{
$qty = $item->getQty();
<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>
@ceckoslab
ceckoslab / Jarlssen_CustomCartValidation - dependency.xml
Created May 13, 2014 18:03
Jarlssen_CustomCartValidation - dependency
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_ExampleValidation>
<active>true</active>
<codePool>local</codePool>
<depends>
<Jarlssen_CustomCartValidation />
</depends>
</MyCompany_ExampleValidation>
@ceckoslab
ceckoslab / Real-option-example
Last active August 29, 2015 14:01
Jarlssen_FasterAttributeOptionEdit - Real option
<td>
<input value="William Shakespeare" name="option[value][116][0]" class="replace-content pseudo-input input-text required-option">
</td>
@ceckoslab
ceckoslab / Placeholder-markup-example
Created May 7, 2014 08:44
Jarlssen_FasterAttributeOptionEdit - Placeholder markup
<td>
<div id="option[value][116][0]" class="replace-content pseudo-input input-text required-option">Option 2</div>
</td>