Snippets with the tag: id

Get product type from product ID

Description

Get product type from product ID

Code

$product = Mage::getModel('catalog/product')->load($product_id);
$productType = $product->getTypeId();

Get products data in cart

Description

Display products data in cart

Code

$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

foreach($items as $item) {
        echo 'ID: '.$item->getProductId().'<br />';
        echo 'Name: '.$item->getName().'<br />';
        echo 'Sku: '.$item->getSku().'<br />';
        echo 'Quantity: '.$item->getQty().'<br />';
        echo 'Price: '.$item->getPrice().'<br />';
        echo "<br />";
}

Show CMS block in html

Description

Show CMS block in html

Code

<?= $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); ?>