0

we created coupon code and we wanted it should not applicable only for particular category.

so we used this condition as in image. its working fine.

enter image description here

but we are getting error message as below.

Coupon code "123456" is not valid. [not real coupon code ]

we want to change this error message as coupon code not applicable for this category.

We are using Magento Hackathon promocode error message module

we checked in extension code & in app/locale/en_us/csv files , there is no error message matching present to match above error message.

we found above message in these 2 files app/locale/en_us/ Mage_checkout.csv , Mage_xmlconnect.csv .we changed here also but its not working for us.

Please tell me where i need to chnage those error message.

public function validate($couponCode, $quote)
    {
        $this->_quote = $quote;

        try {
            /** @var Mage_SalesRule_Model_Coupon $coupon */
            $coupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
        }
        catch (Exception $e) {
            Mage::logException($e);

            return;
        }

        // no coupon
        if (!$coupon->getId()) {
            Mage::throwException($this->_formatMessage('Coupon code does not exist.'));
        }

        /** @var $rule Mage_SalesRule_Model_Rule */
        $rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());

        $this->_validateGeneral($rule, $coupon);
        if (Mage::getStoreConfigFlag('checkout/promocodemessages/include_conditions')) {
            $this->_validateConditions($rule);
        }
    }

1 Answer 1

2

Show custom error messages on cart page Hi in this article i will try to tell you all about how to show custom error messages or popups on cartpage

in the below folder app/code/core/Mage/Checkout/controllers/CartController.php

near about line 537 you will find code something like this

 else {
                    $this->_getSession()->addError(
                        $this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlEscape($couponCode))
                    );
                } 

which contains a error message for wrong coupon code apply

which i have change to


else {
                    $this->_getSession()->addError(

                        $this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlEscape($couponCode))
                    );
                    $myValue = 'Hello World';
                   Mage::getSingleton('customer/session')->setMyvalue($myValue);

                }

in this i have make use of magento sessions , i have set a session as setMyvalue for the wrong code apply and than check the value of this in cart file

cart file path under
yourtheme/template/checkout/cart.phtml
i have retrieve the session value something like

 getMyvalue(); ?> 

do something:: you can do anything here like show your html ,js popups.....

do somethindo something:: you can do anything here like show your html ,js popups.....
   

thats it ......

1
  • 1
    Welcome to mse, we need stars like you..... You saved my day..... Thanks a lot... I like your profile name :-) Commented Jul 14, 2016 at 9:09

Your Answer

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

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