Where is the setCouponCode function is defined in Magento

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply

I know that setCouponCode is catch inside __call in Varien_Object but I can't figure out where it is defined.

I need it because I want to show the coupon code even if the discount equal zero. I believed it's done inside this function.

So if anybody know where the function is defined or where I can modify the code to get the coupon code displayed all the time, please let me know.

Most text editors have a 'search in files/folders' option. Open the source folder and search for function __setCouponCode.

Ok I figured it out. the SetCouponCode is setting the value for coupon_code in the magic function.

Related to this, did anybody notice that the quote is not being deleted properly? I say it is related to this because the coupon code variable keeps the value [if any] after you delete a product from cart.

Try: 1. Set some Shopping Price Cart Rule to a product and make it display a banner on the header section for example. 2. Add product to checkout/cart in order to trigger the rule and show the banner on the Cart. 3. Delete the product from cart and you will see the banner still showing on the header section.

Note. If you have another product in cart this will not work because when you delete the one that triggered the rule&banner the Coupon Code will get replaced with the one that belongs to this other product in cart. SO this bug only works if only the product that triggers the rule&banner is in cart.

If anybody has a fix on this or can replicate these conditions: I'd love to have a conversation about magento's deficiency to make a proper product delete from cart - which implies a proper quote refresh.

Reference: - app/code/core/Mage/Sales/Model/Quote.php -> public function removeItem($itemId)

And yes, magento core issue.

`Reply Or Comment!
Please LogIn to Reply!