Lessons in Magento Today

Printing the SKU in the cart Simple or Configurable

To print the sku in the shopping cart, even for Configurable (it will print the underlying simple product sku).

Place this code somewhere in:
app/design/frontend/default/default/template/checkout/cart/item/default.phtml

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

This will now print the sku... onto more work.

Reference:
http://www.magentocommerce.com/boards/viewthread/56728/#t214381

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <javascript>, <php>, <sql>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options