public function init() { $Param = $this->getRequest('Params'); //var_dump($this->getRequest()->getActionName()); $Action = $this->getRequest()->getActionName(); parent::init(); // echo $Action; if ($Action != "site-map") { $langId = Zend_Registry::get('languageID'); //parent::init(); $this->setModuleId(); $this->view->headLink()->offsetSetStylesheet($this->_moduleID, $this->view->locateFile('catalog.css')); $this->view->headLink()->appendStylesheet($this->view->locateFile('catalog.css')); // $oTypes = new TypesObject(); $oCollections = new SubCategoriesObject(); // $oClientele = new ClienteleObject(); // $types = $oTypes->getAll($langId); $collections = $oCollections->getAll($langId); // $clienteles = $oClientele->clienteleList($langId); // $this->view->types = $types; $this->view->collections = $collections; // $this->view->clientele = $clienteles; } }
public function listSubCatAction() { // web page title $this->view->title = "Sous-catégories"; if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) { $tables = array('Catalog_CategoriesData' => array('CC_ID'), 'Catalog_CategoriesIndex' => array('CCI_CategoryID', 'CCI_Name'), 'Catalog_SousCategoriesData' => array('SC_ID', 'SC_CategoryID'), 'Catalog_SousCategoriesIndex' => array('SCI_SousCategoryID', 'SCI_LanguageID', 'SCI_Name')); $field_list = array('SC_ID' => array('width' => '50px'), 'SCI_Name' => array('width' => '150px'), 'CCI_Name' => array('width' => '150px')); $this->view->params = $this->_getAllParams(); $pageID = $this->_getParam('pageID'); $lang = $this->_getParam('lang'); if (!$lang) { $this->_registry->currentEditLanguage = $this->_defaultEditLanguage; $langId = $this->_defaultEditLanguage; } else { $langId = Cible_FunctionsGeneral::getLanguageID($lang); $this->_registry->currentEditLanguage = $langId; } $oSubCategories = new SubCategoriesObject(); $select = $oSubCategories->getAll($langId, false); $select->joinLeft('Catalog_CategoriesData', 'CC_ID = SC_CategoryID'); $select->joinLeft('BannerGroup', 'BG_ID = SC_BannerGroupID'); $select->joinLeft('Catalog_CategoriesIndex', 'CC_ID = CCI_CategoryID AND CCI_LanguageID = "' . $langId . '"'); $commands = array(); if ($langId == $this->_defaultEditLanguage) { $commands = array($this->view->link($this->view->url(array('controller' => $this->_name, 'action' => 'add')), $this->view->getCibleText('button_add_news'), array('class' => 'action_submit add'))); } $options = array('commands' => $commands, 'disable-export-to-excel' => 'true', 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('button_edit'), 'url' => $this->view->baseUrl() . "/" . $this->_moduleTitle . "/" . $this->_name . "/edit/" . $this->_paramId . "/%ID%", 'findReplace' => array('search' => '%ID%', 'replace' => 'SC_ID')), 'delete' => array('label' => $this->view->getCibleText('button_delete'), 'url' => $this->view->baseUrl() . "/" . $this->_moduleTitle . "/" . $this->_name . "/delete/" . $this->_paramId . "/%ID%/" . $pageID, 'findReplace' => array('search' => '%ID%', 'replace' => 'SC_ID'))))); $mylist = new Cible_Paginator($select, $tables, $field_list, $options); $this->view->assign('mylist', $mylist); } }
/** * 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; }