Automatically load custom product attribute with collection (every time)

You can do this with the following XML in your config.xml: <frontend> <product> <collection> <attributes> <ATTRIBUTECODE/> </attributes> </collection> </product> </frontend> But ATTENTION: This can become a performance issue, because it loads the attribute every time the product collection is loaded! If you added too many attributes, the performance can get worse!  

Add breadcrump in custom block

This is how to add a Breadcrumb entry in an own block: $breadcrumbs = $this->getLayout()->getBlock(‘breadcrumbs’); $breadcrumbs->addCrumb(‘home’, array(‘label’=>Mage::helper(‘cms’)->__(‘Home’), ‘title’=>Mage::helper(‘cms’)->__(‘Go to Home Page’), ‘link’=>Mage::getBaseUrl())); $breadcrumbs->addCrumb(‘cms_page’, array(‘label’=>$page->getTitle(), ‘title’=>$page->getTitle()));

Magento – Get all stores

Here is how to get all stores of your Magento instance a an Array: <?php $aAllStores = Mage::app()->getStores(); foreach ($aAllStores as $iStoreId => $oVal){ $sStoreCode = Mage::app()->getStore($iStoreId)->getCode(); $sStoreName = Mage::app()->getStore($iStoreId)->getName(); $iStoreId = Mage::app()->getStore($iStoreId)->getId(); echo $sStoreCode; echo $sStoreName; echo $iStoreId; } ?> To include the admin store you can call getStores like that: $aAllStores = Mage::app()->getStores(true) […]

Useful database queries

Move products to an another category UPDATE db220385_2.catalog_category_product SET category_id = 18 WHERE category_id = 19; Get all attribute option values The following example shows, how to get all available values for the attribute filter_stores SELECT ea.attribute_code, eao.option_id, eaov.store_id, eaov.value_id, eaov.value FROM eav_attribute AS ea INNER JOIN eav_attribute_option AS eao ON ea.attribute_id = eao.attribute_id INNER […]