public function formatProductNameAction() { $oProduct = new ProductsObject(); $select = $oProduct->getAll(null, false); $select->where('PI_ValUrl is NULL'); $db = Zend_Registry::get('db'); $products = $db->fetchAll($select); foreach ($products as $product) { $name = $product['PI_Name']; $formatted = Cible_FunctionsGeneral::formatValueForUrl($name); $data = array('PI_ValUrl' => $formatted); $oProduct->save($product['P_ID'], $data, $product['PI_LanguageID']); } }
/** * Get the list of the products for the current category * * @param int $limit * * @return array */ public function getList() { $products = array(); $this->getDataByName(); $oProducts = new ProductsObject(); $oSubCat = new SubCategoriesObject(); $oCategory = new CatalogCategoriesObject(); // $oType = new TypesObject(); // $oCli = new ClienteleObject(); $oSubCat->setOrderBy('SCI_Seq'); if (isset($this->_blockParams['1'])) { Zend_Registry::set('defaultCategory', $this->_blockParams['1']); } if (!$this->_prodId) { // If no category selected, set the default one. if (!$this->_catId && !$this->_keywords && isset($this->_blockParams['1'])) { $categoryId = $this->_blockParams['1']; } else { $categoryId = $this->_catId; } Zend_Registry::set('catId_', $categoryId); $subCategories = $oSubCat->getSubCatByCategory($categoryId, false, $this->_currentLang); // if($this->_subCatId) // $subCategories->where('SC_ID = ?', $this->_subCatId); $oCategory->setQuery($subCategories); $categoryQuery = $oCategory->getDataCatagory($this->_currentLang, false); $oProducts->setQuery($categoryQuery); $select = $oProducts->getProducts($this->_currentLang, false); // $oType->setQuery($select); // $select = $oType->getDataTypes($this->_currentLang, false); // $oCli->setQuery($select); // $select = $oCli->getDataClientele($this->_currentLang, false); $select->order('PI_Seq ASC'); if ($this->_subCatId) { $select->where('P_SubCategoryID = ?', $this->_subCatId); Zend_Registry::set('subCatId_', $this->_subCatId); } if (count($this->_keywords)) { $this->_setFilterByKeyword($select); } if (count($this->_filter)) { $filterClause = ""; foreach ($this->_filter as $key => $value) { $select = $this->_addFilterQuery($key, $value, $select); } } $products = $this->_db->fetchAll($select); $num_products = count($products); } else { $product = $oProducts->getAll($this->_currentLang, true, $this->_prodId); $tmpArray = $product[0]; $dataSubCat = $oSubCat->getAll($this->_currentLang, true, $tmpArray['P_SubCategoryID']); $subCategory = $dataSubCat[0]; $dataCategory = $oCategory->getAll($this->_currentLang, true, $subCategory['SC_CategoryID']); $category = $dataCategory[0]; $products = array_merge($tmpArray, $subCategory, $category); // $type = $oType->getAll($this->_currentLang, true, $tmpArray['P_TypeID']); // $cli = $oCli->getAll($this->_currentLang, true, $tmpArray['P_ClienteleID']); $products['type'] = $type[0]; $products['clientele'] = $cli[0]; // $oItems = new ItemsObject(); // $items = $oItems->getItemsByProductId($this->_prodId); Zend_Registry::set('catId_', $subCategory['SC_CategoryID']); Zend_Registry::set('subCatId_', $tmpArray['P_SubCategoryID']); // $products['items'] = $items; // $oAssocProd = new ProductsAssociationObject(); // $relations = $oAssocProd->getAll($this->_currentLang, true, $this->_prodId ); // $tmp = array(); // // $relatedProd = array(); // // foreach ($relations as $relProd) // { // if ($relProd['AP_RelatedProductID'] != -1) // { // $tmp = $oProducts->populate($relProd['AP_RelatedProductID'], $this->_currentLang); // $subCat = $oSubCat->getAll($this->_currentLang, true, $tmp['P_SubCategoryID']); // $tmpSubCat = $subCat[0]; // $category = $oCategory->getAll($this->_currentLang, true, $tmpSubCat['SC_CategoryID']); // $tmpCat = $category[0]; // $tmp = array_merge($tmp, $tmpSubCat, $tmpCat); // // $relatedProd[] = $tmp; // } // } // // $products['relatedProducts'] = $relatedProd; } // $products['relatedProducts'] = $relatedProd; // } return $products; }