Created
November 14, 2013 22:12
-
-
Save koryteg/7475199 to your computer and use it in GitHub Desktop.
common Magento things
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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