Load product by id or sku

+2 votes
164 views
asked Jun 13, 2016 in Magento by Silver James
Hi There,

How can we Load product by id or sku in Magento with the code?

Thanks in advance.

SJ

1 Answer

0 votes
answered Jun 15, 2016 by Densil Mayn
<?php
$_product_1 = Mage::getModel('catalog/product')->load(33); // won't include a valid stock item
$_product_2 = Mage::getModel('catalog/product')->loadByAttribute('sku','pet-base-scale-small-10'); // will include a valid stock item
?>

Related questions

0 votes
1 answer 229 views
asked Jun 13, 2016 in Magento by Don
0 votes
1 answer 272 views
0 votes
1 answer 323 views
+1 vote
1 answer 363 views
0 votes
0 answers 278 views
0 votes
2 answers 306 views
...