magento - why is $address->hasCouponCode() always returning null? -


like in title...for reason, magento website not apply coupon codes...always returns invalid "coupon code not valid" message. strangely enough, happens when price of cart larger 120 currency.

example: if have 1 product in cart price of 65, coupon code works ok...if have same product in cart qty 2 (which means total price becomes 130) above mentioned invalid error message

i've traced down code "mage_sales_model_quote" class, has function named: _validatecouponcode(), inside following: $address->hascouponcode() returns false ... should try?...i reindexed, refreshed cache..etc... nothing changed...and can't seem find in address model hascouponcode function see happens in there... many in advance

well, without exact rules it's hard give full answer.

first, mage_sales_model_quote::_validatecouponcode() call has single job of removing coupon code quote if coupon code not on quote address. because during collecttotal call discount total model copy coupon code address if valid , applied. so, fact $address->hascouponcode() returning null in case indicator rule validator refused apply supplied coupon code.

second, there 2 methods should trace out find out why coupon not being applied. it's 1 or other depending on coupon, i'll point out both. mage_salesrule_model_validator::process() , mage_salesrule_model_validator::processshippingamount() 2 places check coupon code , possibly apply , copy code address.

as side note, mage_salesrule_model_validator::_maintainaddresscouponcode() method responsible copying coupon code validator (who got code quote) address. if method never called coupon code removed quote.

tl;dr

step debug mage_salesrule_model_validator::process() , mage_salesrule_model_validator::processshippingamount() debug why coupon code not valid.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -