jxdyzwh Posted April 8, 2014 Share Posted April 8, 2014 i want to change product list sqlif (id_category=="3"){ $where =" where id_category not in (4,5)";}the webstite url is "index.php?id_category=3&controller=category"how can i change the sql? Link to comment Share on other sites More sharing options...
vekia Posted April 8, 2014 Share Posted April 8, 2014 in this case you have to modify controller: controllers/front/categoryController.php there is an sql query to get products from database. you can use your modification there. 1 Link to comment Share on other sites More sharing options...
jxdyzwh Posted April 9, 2014 Author Share Posted April 9, 2014 controllers/front/categoryController.php is function assignProductList(),your say "get products from database" is here? the function have code if (!$hookExecuted) { $this->context->smarty->assign('categoryNameComplement', '');//the program is not execution here $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); } // Hook executed, use the override else // Pagination must be call after "getProducts" $this->pagination($this->nbProducts); Link to comment Share on other sites More sharing options...
aliabc Posted September 3, 2014 Share Posted September 3, 2014 (edited) categoryController.php $hookExecuted = false; /* Hook::exec('actionProductListOverride', array( 'nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted, ));*/ //after comment out this , override category work! // The hook was not executed, standard working if (!$hookExecuted) { //the program now execution here Edited September 9, 2014 by aliabc (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts