1

I am working on Magento 1.9.1.0 site which has been heavily customized for client's needs.

By "heavily customized" I mean not just templates override but also many modules added for "Model" and "controller" rewrites too.

Now I am having issue of displaying messages(from Magento core/session) when a product is added to wishlist. What I have done here is when a customer adds product(from list page) to wishlist, he is redirected back to product-list page redirectReferrer().

Now problem is the message <Product name> is added to your wishlist is not shown on product list page but it shows when customer manually goes to his wishlist page after adding product.

Even if I call message block by echo $this->getMessagesBlock()->getGroupedHtml(); or echo $this->getMessagesBlock()->getMessages(); messages doesn't show up in list page.

2

Wishlist session messages are not meant to show on category pages. If you look at class Mage_Catalog_CategoryController and method viewAction() then you will see towards the bottom:

$this->_initLayoutMessages('catalog/session');
$this->_initLayoutMessages('checkout/session');

If wishlist session messages were meant to show here you would also see:

$this->_initLayoutMessages('wishlist/session');

which is what you see in classes such as Mage_Wishlist_IndexController. If you want wishlist session messages to show on category pages you need to add the above call to the relevant action by some means i.e. observer, rewrite. Without this the messages will just stay in the session until a call to init the wishlist session messages executed.

Last thing is you should check that you actually have the messages block on the page in question. The global_messages block shows just core/session messages while the messages block shows all others.

  • Thanks for reply Jonathan, but in the new versions(probably from 1.9 onwards) of Magento I don't find a product list action (listAction) in product controller that I can override and add session message, so can you let me know how to show wishlist session message in only product-list page and not any other category view pages ? Please reply urgently if possible – Vicky Dev Nov 18 '15 at 6:57
  • You need to be looking for viewAction(). I can assure you this action does appear in every version of Magento. Not sure what distinction you are making between a 'product list' and 'category' page, they are the same thing. – Jonathan Hussey Nov 18 '15 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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