Return to Snippet

Revision: 30259
at October 14, 2010 21:58 by dmistriotis


Updated Code
// 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);

Revision: 30258
at August 11, 2010 00:01 by dmistriotis


Initial Code
// 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');

Initial URL
http://fishpig.co.uk/2010/04/21/load-a-category-or-product-by-an-attribute-sku-name-etc/

Initial Description

                                

Initial Title
Load Category or Product By Attribute (SKU, Name etc) In Magento | Magento Tutorials

Initial Tags
magento

Initial Language
PHP