Display SKU On the Product Listing Page and the Product Description Page In Magento



In Magento if we are working with the custom HTML integration then we want to display the products SKU on the product listing page as well as on the Product description page as by default it is not displayed in Magento frontend. It is very easy to display the product SKU on the frontend.

Diaplay SKU On The Product Listing Page.

Step 1. Navigate to the /app/design/frontend/default/your_custom_template/template/catalog/product/list.phtml or Navigate to the /app/design/frontend/base/default/template/catalog/product/list.phtml open the file in the editor of your choice.

Step 2. Add the code below in the appropriate position where you want to display the SKU

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

<?php echo $this->htmlEscape($_product->getSku()) ?>

<?php echo $sku = Mage::getModel('catalog/product')->load($_product->getId())->getSku();?>

Diaplay SKU On The Product Description Page

Step 1. Navigate to the /app/design/frontend/default/your_custom_template/template/catalog/product/view.phtml or Navigate to the /app/design/frontend/base/default/template/catalog/product/view.phtml open the file in the editor of your choice.

Step 2. Add the code below in the appropriate position where you want to display the SKU

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

<?php echo $this->htmlEscape($_product->getSku()) ?>

<?php echo $sku = Mage::getModel('catalog/product')->load($_product->getId())->getSku();?>

Now refresh the browser cache and you have done.