Magento - How to Display the Product SKU

Magento is a pretty flexible platform. That flexibility comes with a price though; You have to be knowledgeable of the functions that are available to you to utilize. Finding or knowing them is a challenge though. Here is one of those such functions that you may need to display the product Sku on a category page.

<?php echo($_product->getSku()); ?>

3 comments for Magento - How to Display the Product SKU

lazytrbar's picture

In the shopping cart. I want...

In the shopping cart. I want to retrieve the SKU of a configurable product. The code you show here returns the SKU of the base configurable product. I want the SKU of the product after the options have been specified by the user. How do I get that?

Sean's picture

if...


if (is_object($this->getChildProduct())):
echo $this->getChildProduct()->getSku();
else:
echo $_item->getSku();
endif;

AK's picture

Try this <?php $_product =...

Try this


<?php
$_product = new Mage_Catalog_Model_Product();
$_product->load($this->getProduct()->getId());
$_productSku=$_product->getSku();
echo $_productSku;
?>

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.