Magento’s default theme doesn’t display the SKU on the product page (at least as of v1.1.6). As per this discussion thread, it’s fairly easy to add by editing the template:
In whichever theme you’re using, in the file template/catalog/product/view.phtml, add the line:
<?php echo $this->htmlEscape($_product->getSku()) ?> |
Here’s a few lines of my view.phtml to give you some context:
40 41 42 43 44 45 46 47 48 49 50 51 | <div class="product-essential"> <form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form"> <div class="product-img-box"> <?php echo $this->getChildHtml('media') ?> </div> <div class="product-shop"> <h3 class="product-name"><?php echo $this->htmlEscape($_product->getName()) ?></h3> <?php echo $this->htmlEscape($_product->getSku()) ?> <?php if ($this->canEmailToFriend()): ?> |
We are also reminded in the Magento thread that we should not use the default theme in place, as it’s subject to changes from release to release. Instead, you should create a copy of the default theme (if that’s what you want to start with), and work with that. See also: http://www.magentocommerce.com/design_guide/articles/working-with-magento-themes#head-how-to-create-a-theme
The SKU exists as an attribute. By editing Catalog > Attributes you can simply set the SKU attribute to be displayed on the product page (and on the simple and advanced search if desired).
No coding needed!
Excellent! How did I miss that?!
Hey,
I think there is a need for both of them though. You might want to have the SKU displayed on the top of the page and in e.g. in a details tab.
David
Do you know how to add the SKU to the order email? I would really appreciate that and I appreciate this!!!
Nice One! What about displaying grouped product SKU’s – stuck on this at the minute… Any Ideas?
[...] Display SKU on product page – WestWideWeb.com [...]
If we need to add SKU to the order email then we need access the class directly like Mage::getModel()
Great, dud!
Very Thanks for this.
Thanks alot you helped me figure this thing out!
Hi,
I sound very nubbish, but if i follow the instructions i get stuck at a certain point.
I don\’t have a view.phtml in my product map. What do i have to do? Do i have to make a view.phtml? Or do i have to put it in another folder. Could someone please help me out. My customer is bugging me with the fact that she wants the SKU to be visible aswell in the index of the product as in the view (details) of the product.
Thanks in advance,
Greetings Robert-Jan
On the configurable product detail page of a store if you choose an option it can change the price dynamically. How can I get my echoed SKU to show correctly based on options chosen?
Let’s say i have only one select dropdown field for ‘Select Quantity’ and the options for that are 6 pack and 12 pack. If 6 pack is chosen I want to dynamically echo it’s SKU of BR549-6 and if 12 pack is chose I want the page to dynamically change the echoed SKU to BR549-12.
I want it to work just like the dynamically updated price.
Hi,
I have tried your solution and seems to work, i cannot find the setting on that admin section, possibly because of the template i use or the version, 1.5.1.
What i wanted to find out if it would be possbile to exclude some sku from showing. I have some Grouped product codes that i do not want to show, but to show only the simple product codes. any help would be great!