Public Member Functions | |
load () |
Definition at line 28 of file Catalog.php.
load | ( | ) |
Definition at line 30 of file Catalog.php.
00031 { 00032 $arr = array(); 00033 00034 if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) { 00035 $this->setResults($arr); 00036 return $this; 00037 } 00038 00039 $collection = Mage::helper('catalogSearch')->getQuery()->getResultCollection() 00040 ->addAttributeToSelect('name') 00041 ->addAttributeToSelect('description') 00042 ->addSearchFilter($this->getQuery()) 00043 ->setCurPage($this->getStart()) 00044 ->setPageSize($this->getLimit()) 00045 ->load(); 00046 00047 foreach ($collection as $product) { 00048 $arr[] = array( 00049 'id' => 'product/1/'.$product->getId(), 00050 'type' => 'Product', 00051 'name' => $product->getName(), 00052 'description' => Mage::helper('core/string')->substr($product->getDescription(), 0, 50), 00053 'url' => Mage::helper('adminhtml')->getUrl('*/catalog_product/edit', array('id'=>$product->getId())), 00054 ); 00055 } 00056 00057 $this->setResults($arr); 00058 00059 return $this; 00060 }