Tuesday, 9 February 2016

magento custom search by name ,description short_description

// Code to Search Product by $searchstring and get Product IDs
    $product_collection = Mage::getResourceModel('catalog/product_collection')
                 ->addAttributeToSelect('*')
                 ->addAttributeToFilter('name', array('like' => '%'.$searchstring.'%'))
                 ->load();

    foreach ($product_collection as $product) {
        $ids[] = $product->getId();
    }

No comments:

Post a Comment