1

I'm running Magento 1.8 Community edition. I have a product with one custom choice.

So I add the choices and give them SKU NO INSTALLATION with SKU:TILLV000 INSTALLATION with SKU: TILLV001 SUPER INSTALLATION with SKU: TILLV002

Now IF you choose any of the custom choices with SKU: TILLV001 OR TILLV002. Rhen I would like to enable free shopping.

I added that as a shopping cart rule

If ALL of these conditions are TRUE : If an item is FOUND in the cart with ANY of these conditions true: SKU is TILLV001, TILLV002

It doesnt apply? What have I done wrong?

1 Answer 1

3

Magento does not take into account custom options when calculate shopping cart rules unless you have an extension for this.

We do the following trick: rewrite class Mage_SalesRule_Model_Rule_Condition_Product and add 2 new custom attributes 'Custom Options SKU' and 'Custom Options Values'

Then get options to validate as $options = $product->getTypeInstance(true)->getOrderOptions($product);

and SKU as $object->getSku() where $object is the quote item.

2
  • The file path is app\code\core\Mage\SalesRule\Model\Rule\Condition\Product.php for the original magento file, and I think you need to create a new local module to rewrite it.
    – Amasty
    Commented Jul 29, 2014 at 15:29
  • Not sure I follow after you add the attribute to _addSpecialAttributes() - If I add a new attribute to the select element using: $attributes['quote_item_myattribute'], do I simply need to set this to $product in the validate() method? Ie: $product->setQuoteItemMyattribute($object->getMyattribute())?
    – pspahn
    Commented Jan 15, 2015 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.