How can i reference category name and image from a static block in magento through the magento backend? I’m running 1.7.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I am not aware of a way in which you can easily reference these values from within a static block.
Instead, I would suggest you create and use a widget (one of the most underused features of Magento in my opinion) which will provide a much cleaner and more extendible way of achieving this – though it does require more work upfront 🙂
Please see code below for a full (simplified) example of a Magento Widget which does exactly what you have asked from the static block:
app/etc/modules/YourCompany_Categorywidget.xml
app/code/community/MyCompany/Categorywidget/etc/config.xml
app/code/community/MyCompany/Categorywidget/etc/widget.xml
app/code/community/MyCompany/Categorywidget/Helper/Data.php
app/code/community/MyCompany/Categorywidget/Block/Catalog/Category/Widget/Info.php
app/code/community/MyCompany/Categorywidget/Block/Catalog/Category/Info.php
app/design/frontend/base/default/template/categorywidget/info.phtml