How to search for product by name or sku with PageSize and CurPage programatically magento 1.9?
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter(
array(
array('attribute' => 'sku', 'like' => '%'.$search.'%'),
array('attribute' => 'name', 'like' => '%'.$search.'%')
)
)
->setPageSize(10)->setCurPage(1)->load();
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter(
array(
array('attribute' => 'sku', 'like' => '%'.$search.'%'),
array('attribute' => 'name', 'like' => '%'.$search.'%')
)
)
->setPageSize(10)->setCurPage(1)->load();
No comments:
Post a Comment