$product = Mage::getModel('catalog/product')->load(123); // Load a product by its ID $sku = $product->getSku(); // Retrieve the SKU of the product echo "The SKU of the product is: " . $sku;
$item = new Varien_Object(array('sku' => 'ABC123', 'qty' => 2)); // Create a new object with a SKU and quantity $sku = $item->getSku(); // Retrieve the SKU from the object echo "The SKU of the item is: " . $sku;This example creates a new object using the Varien_Object class and sets the SKU and quantity as properties. The getSku method is then used to retrieve the SKU from the object. Both of these examples use the Varien_Object class, which is a part of the Magento Core library.