Magento: how do I access custom variables in PHP?

前端 未结 6 893
清歌不尽
清歌不尽 2020-12-23 19:18

I am aware of \'Custom Variables\' and how they can be used with {{ }} brackets in email templates as well as in static blocks.

However, I want to use them in templa

6条回答
  •  时光说笑
    2020-12-23 19:46

    // To get the TEXT value of the custom variable:

    Mage::getModel('core/variable')->setStoreId(Mage::app()->getStore()->getId())->loadByCode('custom_variable_code')->getValue('text');
    

    // To get the HTML value of the custom variable:

    Mage::getModel('core/variable')->setStoreId(Mage::app()->getStore()->getId())->loadByCode('custom_variable_code')->getValue('html');
    

    // The store id is set as Custom Variables can be edited for multiple stores

提交回复
热议问题