I've created a custom controller to add multiple items from a grid view to the cart all at one time.

Works just fine - the problem is the success and error messages are not being displayed on the view cart page.

Here is the controller:


    class BigBlockStudios_UpdateCart_ManageController extends Mage_Core_Controller_Front_Action {

        // add multiple products to the cart
        public function multipleProdAddAction() {

            $redirect = isset($_POST['redirect']) ? $_POST['redirect'] : 'checkout/cart';

            $success = '';

            $errors = '';

            $cart = Mage::helper('checkout/cart')->getCart();

            $items = $_POST['data'];

            foreach($items as $key => $item){

                $sku = $item['sku'];

                $qty = $item['qty'];

                $id = Mage::getModel('catalog/product')->getIdBySku($sku);

                if(!$id || $qty <= 0) {



                    try {

                        $params = array('qty' => $qty);

                        $id = Mage::getModel('catalog/product')->getIdBySku($sku);

                        $product = Mage::getModel('catalog/product')->load($id);

                        $cart->addProduct($product, $params);

                        $success .= $product->getName(). " is successfully added into cart <br />";

                    }catch(Exception $e) {

                        $errors .= $e->getMessage() . '<br />';





            if(strlen($success) > 1) {

            if(strlen($errors) > 1){


        } // multipleProdAddAction()

    } // controller


The view cart page is displaying messages, if I add an item from a default product page, I get the success message.

What is the correct way of doing this?

1 Answer 1


Right now you have set the message in core/session. Have to set message in checkout/session to get it in checkout page.


Magento has set the message in checkout session while adding a product to cart.

Refer this files

  • ok- perfect - thanks... so hmmm. you can see that I have a variable on where to redirect the page to. Say I redirected it somewhere else [account/whatever]. is there a global/session? will something like that display errors "anywhere"? Commented Sep 26, 2015 at 17:49

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.