1

I'm running Magento 1.9.2.2. and I've added a shopping cart price rule:

If the customer buys more than one t-shirt, he should get a discount of 10$ per t-shirt. The t-shirt is a configurable product (the linked simple products are f.e. green t-shirt in S, red t-shirt XL,...). Now the customer can either get 2 red t-shirts in S (1 item, quantity 2) or 1 red shirt in S and 1 black t-shirt in XL (2 items, each quantity 1). He should get the discount of 10$ per t-shirt in both cases.

I didn't find a way to check if the customer has 2 or more of those skus in his shopping cart, but I found a way to cheat: As I don't use the weight attribute at all, I gave all those t-shirt products a weight of 1 and checked that in the conditions tab of the price rule:

 If ALL of these conditions are TRUE:

      Total Weight equals or greater than 2

This way I can find out if the customer has more than 2 t-shirts in his shopping cart. Now in the Actions tab of the price rule I apply the rule to the t-shirts:

 If ANY of these conditions are TRUE:

      SKU is one of t-shirt-green-S,t-shirt-green-M,t-shirt-green-L,...

Lo and behold, the customer gets a fixed amount discount of 10 per t-shirt, if he has more than 2 in his shopping cart, which is working fine...

...but when I open the shopping cart page the rule is not applied immediately. I have to press either the 'update cart' button or change the quantity of an item and press 'update' - then the discount is shown and applied.

If I create a simple price rule (f.e. 10 $ discount for any item) and go to the shopping cart page, the discount is shown immediately, no need to update the cart.

I know that I probably defeated myself somehow, but I have no idea how :) - so how do I get rid of that 'update cart' problem? Many thanks in advance!

1 Answer 1

0

You could put

Mage::getModel('checkout/cart')->updateItems()->save();

into protected function _getCartProductIds() from

public/app/code/core/Mage/Checkout/Block/Cart/Crosssell.php

for example.


Don't forget to copy the file into:

public/app/code/local/Mage/Checkout/Block/Cart/Crosssell.php

before you make the changes.

Your Answer

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

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