Custom Variables

For multiple stores...
  • create a custom variable
  • then click on the variable to edit.
  • select a store from the drop down (Choose Store View)
  • set (Use Default Variable Values) to NO
  • change your variables
  • access them like below...
Use it like this (note the setStoreId() to get the value for the correct store view):
$value = Mage::getModel('core/variable')
    ->setStoreId(Mage::app()->getStore()->getId())
    ->loadByCode('variable_code')
    ->getValue('text');
Or to get the html value:
$value = Mage::getModel('core/variable')
    ->setStoreId(Mage::app()->getStore()->getId())
    ->loadByCode('variable_code')
    ->getValue('html');
If no html value is defined, getValue() returns the text value if you request the html value.
thanks to stackoverflow and

Popular Posts