Magento – Message on “Add to Cart”

addtocart

Magento uses the default process when product is “Add to Cart” from product detail page: product is added to cart and redirect to the cart page or user can stay on product page. We need user to be directed to the same page. And, also, display a message Above the "Add to Cart" button : "Product Added to Cart".

Please tell how to display this message.

Thanks in advance !

Best Answer

You can change message from code in cartController. Extend cartController into your local. In cartController find below code:

if (!$cart->getQuote()->getHasError()) {
            $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
            $this->_getSession()->addSuccess($message);
}

and change message. And if you want to redirect to same product page then system >> configuration >> sales >> checkout Expand "shopping cart" tab and set "NO" to "After Adding a Product Redirect to Shopping Cart".

Related Topic