public function searchResult($hit)
 {
     $catalog = new Storefront_Model_Catalog();
     $product = $catalog->getProductById($hit->productId);
     if (null !== $product) {
         $category = $catalog->getCategoryById($product->categoryId);
         $this->view->product = $product;
         $this->view->category = $category;
         return $this->view->render('index/_result.phtml');
     }
 }
 protected function _getProductImageForm()
 {
     $urlHelper = $this->_helper->getHelper('url');
     $this->_forms['addImage'] = $this->_catalogModel->getForm('catalogProductImageAdd');
     $this->_forms['addImage']->setAction($urlHelper->url(array('controller' => 'catalog', 'action' => 'saveimage'), 'admin'));
     $this->_forms['addImage']->setMethod('post');
     return $this->_forms['addImage'];
 }
 public function Category()
 {
     $catalogModel = new Storefront_Model_Catalog();
     return $catalogModel->getCached()->getCategoriesByParentId(0);
 }
 /**
  * Re-index all the products
  * 
  * @param Storefront_Model_Catalog $catalogModel 
  */
 public function reIndexAllProducts(Storefront_Model_Catalog $catalogModel)
 {
     $products = $catalogModel->getAllProducts();
     if (null !== $products) {
         foreach ($products as $product) {
             $categories = $catalogModel->getCategoryChildrenIds($product->categoryId);
             foreach ($categories as $key => $catId) {
                 if (null !== ($cat = $catalogModel->getCategoryById($catId))) {
                     $categories[$key] = $cat->name;
                 }
             }
             $categories[] = $catalogModel->getCategoryById($product->categoryId)->name;
             $document = new Storefront_Model_Document_Product($product, join(',', $categories));
             $this->indexProduct($document);
         }
         $this->getIndexingEngine()->commit();
         $this->doMaintenance();
     }
 }