How to load products by attribute (sku) or id in Magento

This is a quick tutorial for developer on how to load products by SKU, ID, attribute of products in Magento. The tutorial can be applied for loading single product or multiple products.

Load product by Product ID

Normally, we load product by ID. Let’s say that product ID is 88, you can use the following code in

app/code/core/Mage/Catalog/Model/Product.php :

Load product by SKU

In case you want to load product/product by its attribute, for example SKU, you can use the following code in


Alternatively, you can also use this code to load product by SKU

You can change attribute as you want by replacing SKU variable in the example.

Load multiple products

Load multiple product by Product ID

Similarly, you can load multiple product by Product attribute, like SKU


Leave a Reply

Your email address will not be published. Required fields are marked *