getSku()-Problem

Problem: After enabling the "Use Flat Catalog Product" option in the Magento admin area (System->Configuration->CATALOG->Catalog), retrieving the SKU using getSku() within a product instance (e.g. $_product->getSku()) no longer works; the return value is NULL.

The solution is to reload the product, which makes the getSku() method work again. For example, change

$_product->getSku()

to

Mage::getModel('catalog/product')->load($_product->getId())->getSku()

Tested with Magento CE 1.7.0.2.

... back to the blog