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 | |
# Upload multiple files and attach them to post using single function | |
// Files Uploader attach to shop | |
if ($_FILES) { | |
$files = $_FILES['shop-imgs']; | |
foreach ($files['name'] as $key => $value) { | |
if ($files['name'][$key]) { | |
$file = array( | |
'name' => $files['name'][$key], |
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
// JavaScript Document | |
function initialize() { | |
var myOptions = { | |
zoom: 10, | |
center: new google.maps.LatLng(0, 0), | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
} | |
var map = new google.maps.Map( | |
document.getElementById("map_canvas"), |
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 | |
$categories = Mage::getModel('catalog/category')->getCollection(); | |
$categories->addAttributeToSelect('*'); | |
$categories->addAttributeToFilter('is_active', 1); | |
$categories->addAttributeToFilter('entity_id', array('in' => array(3,4,5,6,7)));// Loading selected categories by passing array | |
$categories->load(); | |
// Normal list of categories | |
if($categories){ | |
echo "<ul>"; |
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 | |
$categories = array(8,22); | |
$collection = mage::getModel('catalog/product')->getCollection() | |
->addAttributeToSelect('*') | |
->addAttributeToFilter('status',1) | |
->joinField('category_id', | |
'catalog/category_product', | |
'category_id', | |
'product_id=entity_id', | |
null, |
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
<block type="cms/block" name="block_name"> | |
<action method="setBlockId"><id>block_code</id></action> | |
</block> | |
{{block type="cms/block" block_id="block_code"}} | |
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}} |
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 | |
// Get resized Image on list page.( Mage_Catalog_Block_Product_List ) | |
echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(149); | |
// Get attribute | |
$_helper = $this->helper('catalog/output'); | |
echo $_helper->productAttribute($_product, $_product->getName() , 'name'); | |
?> |
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 | |
// Using singleton | |
$_category = Mage::getSingleton('catalog/layer')->getCurrentCategory(); | |
// Using Model | |
$_category = Mage::getModel('catalog/layer')->getCurrentCategory(); | |
// Using Registry | |
$_category = Mage::registry('current_category'); | |
?> |
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 | |
function string_limit_words($string, $word_limit){ | |
$words = explode(' ', $string, ($word_limit + 1)); | |
if(count($words) > $word_limit) | |
array_pop($words); | |
return implode(' ', $words); | |
} | |
//Usage | |
//Suppose for wordpress content/excerpt length |
NewerOlder