0

We have a number of items which use a discounted custom price for logged-in customers (part of an older promotion). We're looking at running a new promotion that will automatically discount prices for everyone. However we don't want the two promotions to be additive, we want the customer to get one discount or the other (the item's custom price, or the shopping cart rule)--whichever is greater.

How would I determine that a cart contains items with custom prices and also qualifies for a shopping cart rule?

1

I've partly solved this, although it's still incomplete and has been sidelined (I'll try to return to it and update this answer).

The rules are applied within the process() function of Mage_SalesRule_Model_Validator. This function is called for every quote item in the cart, and applies the collection of sales rules to the item.

process() has access to the Mage_Sales_Model_Quote_Item_Abstract (the item in the cart), which in turn has a ->getProduct() method to retrieve the original product from the catalog; and also to the sales rules (via ->_getRules()).

Custom prices (e.g. $quoteitem->getCustomPrice()) values can be retrieved and compared to the discount offered by the salesrule.

Where it falls short for me is that the sales rule I'm working with is a cart subtotal rule--which isn't yet calculated or available.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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