Add a CMS Block on Magento’s Cart Page

Posted on December 7, 2014 in Development, Web

One of my client’s is running a special promotion in their Magento store and they want to add banner on the shopping cart page with the details of the promotion and to remind the customers to take advantage of it. Specifically, they want to put the banner just above the shopping cart contents table as highlighted in this picture:

Banner on Magento's Shopping Cart Page

There’s a number of ways this can be achieved, including copying the cart.phtml file from the base theme into your own theme and customizing it, but by far the easiest way—and most convenient from the point of view of long-term maintenance—is to utilize your theme’s local.xml layout file.

First, create a CMS static block in Magento’s back end with the promotion image. Then, add this into the local.xml file in /app/design/frontend/your_package/your_theme/layout/:

Here the ‘your_cms_block_id’ bit is the identifier of the promotion banner CMS block you created in the first step.

You’re all set—admire your shining new banner on the cart page.

Enjoyed this post? Share it with others.
Email this to someoneShare on FacebookShare on Google+Tweet about this on Twitter

Leave a reply

Your email address will not be published. Required fields are marked *