Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: How can I display backend config settings in frontend CMS pages (or static blocks)?

Tags:

magento

I have a variety of prices in the backend for the shipping rates. These can and do change and I would like to reflect these changes in a frontend page that can be client edited, i.e. a CMS page or static block.

Is there any {{ }} bracket way to pull config variables out of the backend?

like image 648
ʍǝɥʇɐɯ Avatar asked Dec 12 '11 11:12

ʍǝɥʇɐɯ


People also ask

What is CMS static block in Magento 2?

Static blocks are those pieces of content you can display practically on every page of your Magento 2 store. You can show CMS block on category page to notify your customers about the top products, add a static block to the CMS page or even another CMS block to diversify their content.

How do you call a static block on CMS page in Magento 2?

Navigate to Content > Pages, choose the CMS page you want to display the CMS block on and in the Action section choose Edit. 2. Unfold the Content section and press the Widget button to insert the widget. Set the CMS Static Block as the Widget Type to continue.


2 Answers

Use

{{config path="some/config/path"}}

Where path is the same value you might use in a Mage::getStoreConfig() call.


NB: This won't calculate the actual shipping since that needs to be performed on individual orders.

like image 169
clockworkgeek Avatar answered Nov 05 '22 05:11

clockworkgeek


Go to Admin->System->Permission->Variables and there add your config path first to access it in static block. Because after SUPEE 6788, there are restrictions to use all config paths. Once you added there than you can use

{{config path="some/config/path"}}

like image 5
Nauman Khan Avatar answered Nov 05 '22 05:11

Nauman Khan