Skip to content

Instantly share code, notes, and snippets.

@rossmc
Last active August 29, 2015 14:05
Show Gist options
  • Save rossmc/64804213b82f46ad3ef3 to your computer and use it in GitHub Desktop.
Save rossmc/64804213b82f46ad3ef3 to your computer and use it in GitHub Desktop.
Magento PHTML
<!-- http://magento-code-snippets.tumblr.com/ -->
<!-- Getting Images -->
<img src="<?php echo $this->getSkinUrl('images/helo.png');?>" alt="helo"/> <!-- From Skin Folder -->
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). 'subfolder/image.png'; ?>" /> <!-- From Media Folder -->
<!-- note: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) returns a path of www.yourwebsite.com/media -->
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK). 'media/subfolder/image.png'; ?>" /> <!-- From Media Folder -->
<!-- note: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) returns a path of www.yourwebsite.com -->
<!-- Getting Templates -->
<?php echo $this->getLayout()->createBlock(‘core/template’)->setTemplate(‘templateFolder/yourtemplate.phtml’)->toHtml(); ?>
<!-- Getting CMS Static Blocks -->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links')->toHtml();?>
<!-- Load Product -->
<?php $product = Mage::getModel('catalog/product')->load($this->getProduct()->getId()); ?>
<!-- Check if Product is Configurable -->
<?php
if($product->isConfigurable()){
// your logic
}
?>
<!--Load product attribute options array -->
<?php $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment