Question

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.

Was it helpful?

Solution 2

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

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top