This file contains hidden or 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 | |
$categories = Mage::getModel('catalog/category')->getCollection() | |
->addAttributeToSelect('id') | |
->addAttributeToSelect('name') | |
->addAttributeToSelect('url_key') | |
->addAttributeToSelect('url') | |
->addAttributeToSelect('is_active'); | |
foreach ($categories as $category) | |
{ |
This file contains hidden or 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
function getURLParameter(sParam){ | |
var sPageURL = window.location.search.substring(1); | |
var sURLVariables = sPageURL.split('&'); | |
for (var i = 0; i < sURLVariables.length; i++) { | |
var sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] == sParam){ | |
return sParameterName[1]; | |
} | |
} | |
} |
This file contains hidden or 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 | |
//include Magento app | |
require_once 'app/Mage.php'; | |
//initialize Magento | |
Mage::app(); | |
//call Magento model or functions (this example get unsubscription link for customer) | |
$email = "[email protected]"; | |
$unSubLink = Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getUnsubscriptionLink(); |
This file contains hidden or 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 | |
//Possible color value | |
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code | |
$allOptions = $attribute->getSource()->getAllOptions(true, true); | |
foreach ($allOptions as $instance) { | |
$id = $instance['value']; //id of the option | |
$value = $instance['label']; //Label of the option | |
} | |
?> |
This file contains hidden or 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 | |
$template_info = array(); | |
$template_collection = Mage::getResourceSingleton('newsletter/template_collection'); | |
if(!empty($template_collection)){ | |
$cnt = 0; | |
foreach($template_collection as $template){ | |
$template_info[$cnt]['id'] = $template->getTemplateId(); | |
$template_info[$cnt]['code'] = $template->getTemplateCode(); | |
$cnt++; | |
} |
This file contains hidden or 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 if ($_products = $this->getRecentlyViewedProducts()): ?> | |
<div class="block block-list block-viewed"> | |
<div class="block-title"> | |
<strong><span><?php echo $this->__('Recently Viewed Products') ?></span></strong> | |
</div> | |
<div class="block-content"> | |
<ol id="recently-viewed-items"> | |
<?php foreach ($_products as $_item): ?> | |
<li class="item"> | |
<p><img class="product-image" src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(50, 50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /> </p> |