Skip to content

Instantly share code, notes, and snippets.

@koryteg
Created November 14, 2013 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koryteg/7475199 to your computer and use it in GitHub Desktop.
Save koryteg/7475199 to your computer and use it in GitHub Desktop.
common Magento things
<?php // adding the product and helper objects in magento
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
// getting a product from the what was registered on the page
$_product = Mage::registry('product');
//getting an attribute:
$_product->getResource()->getAttribute("attribute identifier")->getFrontend()->getValue($_product);
// Creating Static blocks
echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_id')->toHtml();
// Get Product where Product is not loaded:
$_product = Mage::getModel('catalog/product')->load("YOUR OBJECT ATTRIBUT. IE => $_item->getProductId()");
// Degugger!!!
Zend_Debug::dump($_product);
?>
<?php
// if a static block is enabled:
if(Mage::getModel('cms/block')->load('Static_block_identifier')->getIsActive()): ?>
<div class="home-Static_block_identifier row">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('Static_block_identifier')->toHtml() ?>
</div>
<?php else :?>
command line reindex:
php shell/indexer.php --reindexall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment