$_product->getC ollection()->ad dAttributeToSor t('position')
Sunday, 24 February 2013
Wednesday, 20 February 2013
Magento Product Collection By category id
<?php
$categoryid=2;
$collection = Mage::getModel('catalog/category')->load($categoryid)
->getProductCollection()
->addAttributeToSelect('*') // add all attributes - optional
->addAttributeToFilter('status', 1) // enabled
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
->addAttributeToFilter('featured', 1)
->setOrder('position', 'ASC')
->setPageSize(6)
->setCurPage(1);
foreach($collection as $_product){
$productID=$_product->getId();
$_product = Mage::getModel('catalog/product')->load($productID);
echo $_product->getName();
}
?>
$categoryid=2;
$collection = Mage::getModel('catalog/category')->load($categoryid)
->getProductCollection()
->addAttributeToSelect('*') // add all attributes - optional
->addAttributeToFilter('status', 1) // enabled
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
->addAttributeToFilter('featured', 1)
->setOrder('position', 'ASC')
->setPageSize(6)
->setCurPage(1);
foreach($collection as $_product){
$productID=$_product->getId();
$_product = Mage::getModel('catalog/product')->load($productID);
echo $_product->getName();
}
?>
Friday, 8 February 2013
Thursday, 7 February 2013
text wordwrap demo
<?php
$val="rem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the
1960s with the release of Letraset sheets containing Lorem Ipsum
passages, and more recently with desktop publishing software like Aldus
PageMaker including versions of Lorem Ipsum.";
$str=wordwrap($val,30,"<br>");
echo substr($str,0,strpos($str,"< br>"))."..." ;
?>
Magento database feache code
<?php
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$row = $write->fetchRow('SELECT * FROM colings_eav_attribute_option_value WHERE value="'.$lens_col.'"'); ?>
Subscribe to:
Posts (Atom)