/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Load by name $_category = Mage::getModel('catalog/category')->loadByAttribute('name', 'Acoustic Guitars'); $_product = Mage::getModel('catalog/product')->loadByAttribute('name', 'Cordoba Classic 6-String Guitar'); // Load by SKU $_product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'cordoba-classic-6-String-guitar'); //Load by ID (just load): $_product = Mage::getModel('catalog/product')->load($productID);
URL: http://fishpig.co.uk/2010/04/21/load-a-category-or-product-by-an-attribute-sku-name-etc/