How to Retrieve Magento Core Variables in CMS Blocks or Pages?

Changing templates isn’t an option in my situation and even so if I make a full HTML page with just two integrated “product blocks: (product name, product image, product price, buy me)”, it seems easier to just call the two products you need and insert them directly.

So I’m curious to know if I can retrieve Magento {{variables}} such as product names, images, prices,… . I’m perfectly happy to use Magento Custom Variables to create functions to retrieve these, but I have no idea as to where to start. Any ideas would be appreciated.

One thought on “How to Retrieve Magento Core Variables in CMS Blocks or Pages?”

  1. As far as I know, it’s not possible, nor is it sensible, to do this all from the CMS page.

    You’re best bet would be to create a widget. Widgets are reusable template tags that are very similar to the blocks used in the Magento layout system.

    Once your widget is made, you can then call the widget in the CMS page with a product option, {{widget type="mywidgets/productname" product_id="1"}}, and modify the widget’s output based on the product id entered.

    The tutorial I’ve linked to is very good, and should be a great starting point.

Leave a Reply

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