One of the less commented features in Magento are the Custom Variables.
Much of the stores I see developed by others, don’t use this feature, but it’s the easiest way to store information from a custom extension or even custom data about our store. Let’s say for instance you need to put in the frontend the customer schedule.
The hard way for this would be adding some custom field in a custom extension that you can edit through the admin panel in the configuration section. Then, you shoul pull that var from config to the corresponding template.
The easy way would be to create a custom variable…
… and then pull its value from a CMS page or block with:
Or from anywhere in the code with any of these:
// Variable de tipo texto plano echo Mage::getModel('core/variable') ->loadByCode('variable-code') ->getValue('text'); // Variable con contenido html echo Mage::getModel('core/variable') ->loadByCode('variable-code') ->getValue('html');
Custom Varibles in Magento may have, as usual, global, store or store view scope so they are really usefull for storing quick data without an extension.