Add filter value in cookie
This commit is contained in:
parent
4691d8bb0f
commit
9803b2424c
@ -12,8 +12,13 @@ $order = array(
|
|||||||
'quantity',
|
'quantity',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Category
|
||||||
$id_category = (int) Tools::getValue('c');
|
$id_category = (int) Tools::getValue('c');
|
||||||
|
|
||||||
|
// Page
|
||||||
$p = (int) Tools::getValue('p');
|
$p = (int) Tools::getValue('p');
|
||||||
|
|
||||||
|
// Filters value - attribute
|
||||||
$f = Tools::getValue('f');
|
$f = Tools::getValue('f');
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
@ -22,56 +27,70 @@ $result = array(
|
|||||||
'endreached' => FALSE,
|
'endreached' => FALSE,
|
||||||
);
|
);
|
||||||
|
|
||||||
if($id_category && $p && $id_category > 1) {
|
if ($id_category && $p && $id_category > 1) {
|
||||||
if(Module::isInstalled('privatesales')) {
|
// Private Sales
|
||||||
include(dirname(__FILE__).'/../privatesales/Sale.php');
|
if (Module::isInstalled('privatesales')) {
|
||||||
|
include dirname(__FILE__).'/../privatesales/Sale.php';
|
||||||
$sale = Sale::getSaleFromCategory($id_category);
|
$sale = Sale::getSaleFromCategory($id_category);
|
||||||
|
|
||||||
if($cookie->isLogged() || !$cookie->isLogged() && $sale->pub == 1) {
|
if ($cookie->isLogged() || !$cookie->isLogged() && $sale->pub == 1) {
|
||||||
|
|
||||||
|
// Reset filters
|
||||||
|
if (empty($f)) {
|
||||||
|
$cookie->filters_category = null;
|
||||||
|
$cookie->filters_value = null;
|
||||||
|
}
|
||||||
|
// Add filters
|
||||||
|
else {
|
||||||
|
$cookie->filters_category = $id_category;
|
||||||
|
$cookie->filters_value = $f;
|
||||||
|
}
|
||||||
|
$cookie->write();
|
||||||
|
|
||||||
$now = mktime();
|
$now = mktime();
|
||||||
$category = new Category($id_category, $cookie->id_lang);
|
$category = new Category($id_category, $cookie->id_lang);
|
||||||
$customer = new Customer((int) $cookie->id_customer);
|
$customer = new Customer((int) $cookie->id_customer);
|
||||||
|
|
||||||
if( ($sale !== NULL
|
if( ($sale !== null
|
||||||
&& $sale->enabled
|
&& $sale->enabled
|
||||||
&& strtotime($sale->date_start) < $now
|
&& strtotime($sale->date_start) < $now
|
||||||
&& strtotime($sale->date_end) > $now
|
&& strtotime($sale->date_end) > $now
|
||||||
&& count(array_intersect(($cookie->isLogged()? Customer::getGroupsStatic((int) $cookie->id_customer): array(1)), $sale->groups) > 0)
|
&& count(array_intersect(($cookie->isLogged()? Customer::getGroupsStatic((int) $cookie->id_customer): array(1)), $sale->groups) > 0)
|
||||||
&& $category->active) || ($customer->isMemberOfGroup(2) == 1) ) {
|
&& $category->active)
|
||||||
|
|| ($customer->isMemberOfGroup(2) == 1) ) {
|
||||||
|
|
||||||
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
||||||
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
||||||
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
||||||
|
|
||||||
if (!empty($f)){
|
if (!empty($cookie->filters_value)) {
|
||||||
$nbProducts = count($category->getProductsByAttributes($cookie->id_lang, $f, false, false));
|
$nbProducts = count($category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, false, false));
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($p >= $nbProducts / $n) {
|
if ($p >= $nbProducts / $n && !Tools::getValue('init')) {
|
||||||
if($p >= $nbProducts / $n && !Tools::getValue('init')) {
|
|
||||||
$result['endreached'] = TRUE;
|
$result['endreached'] = TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (!empty($f)){
|
if (!empty($cookie->filters_value)) {
|
||||||
if (Tools::getValue('init')){
|
if (Tools::getValue('init')) {
|
||||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p, $n, $orderBy, $orderWay);
|
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, $p, $n, $orderBy, $orderWay);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p+1, $n, $orderBy, $orderWay);
|
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, $p+1, $n, $orderBy, $orderWay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if (Tools::getValue('init')){
|
if (Tools::getValue('init')) {
|
||||||
$cat_products = $category->getProducts($cookie->id_lang, $p, $n, $orderBy, $orderWay);
|
$cat_products = $category->getProducts($cookie->id_lang, $p, $n, $orderBy, $orderWay);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
$cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
||||||
}
|
}
|
||||||
// $cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$cat_products) {
|
if (!$cat_products) {
|
||||||
$smarty->assign('products', array());
|
$smarty->assign('products', array());
|
||||||
} else {
|
} else {
|
||||||
$smarty->assign('products', $cat_products);
|
$smarty->assign('products', $cat_products);
|
||||||
@ -81,7 +100,7 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
}
|
}
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
$id_attributes = array();
|
$id_attributes = array();
|
||||||
foreach(Db::getInstance()->ExecuteS('
|
foreach (Db::getInstance()->ExecuteS('
|
||||||
SELECT pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`, al.`id_attribute`
|
SELECT pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`, al.`id_attribute`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
|
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
|
||||||
WHERE pa.`id_product` IN ('.implode(', ', $id_products).')
|
WHERE pa.`id_product` IN ('.implode(', ', $id_products).')
|
||||||
@ -95,17 +114,17 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
AND ag.`id_attribute_group` IN(75, 9, 272, 172)
|
AND ag.`id_attribute_group` IN(75, 9, 272, 172)
|
||||||
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
||||||
') as $attr) {
|
') as $attr) {
|
||||||
if(!isset($attributes[$attr['id_product']])) {
|
if (!isset($attributes[$attr['id_product']])) {
|
||||||
$attributes[$attr['id_product']] = array();
|
$attributes[$attr['id_product']] = array();
|
||||||
}
|
}
|
||||||
if(!isset($attributes[$attr['id_product']][$attr['group']])) {
|
if (!isset($attributes[$attr['id_product']][$attr['group']])) {
|
||||||
$attributes[$attr['id_product']][$attr['group']] = array();
|
$attributes[$attr['id_product']][$attr['group']] = array();
|
||||||
}
|
}
|
||||||
if(!isset($id_attributes[$attr['id_product']])) {
|
if (!isset($id_attributes[$attr['id_product']])) {
|
||||||
$id_attributes[$attr['id_product']] = array();
|
$id_attributes[$attr['id_product']] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($attr['id_attribute'], $id_attributes[$attr['id_product']])) {
|
if (!in_array($attr['id_attribute'], $id_attributes[$attr['id_product']])) {
|
||||||
$attributes[$attr['id_product']][$attr['group']][] = array(
|
$attributes[$attr['id_product']][$attr['group']][] = array(
|
||||||
'name' => $attr['name'],
|
'name' => $attr['name'],
|
||||||
'quantity' => $attr['quantity'],
|
'quantity' => $attr['quantity'],
|
||||||
@ -147,14 +166,16 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
} else {
|
} else {
|
||||||
$result['error'] = 'permission_denied';
|
$result['error'] = 'permission_denied';
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
// No private sales
|
||||||
|
else {
|
||||||
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
||||||
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
||||||
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
||||||
$category = new Category($id_category, $cookie->id_lang);
|
$category = new Category($id_category, $cookie->id_lang);
|
||||||
if($category->active) {
|
if ($category->active) {
|
||||||
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
||||||
if($p >= $nbProducts / $n) {
|
if ($p >= $nbProducts / $n) {
|
||||||
$result['endreached'] = TRUE;
|
$result['endreached'] = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
$cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
||||||
@ -165,7 +186,7 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
$id_products[] = $p['id_product'];
|
$id_products[] = $p['id_product'];
|
||||||
}
|
}
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach(Db::getInstance()->ExecuteS('
|
foreach (Db::getInstance()->ExecuteS('
|
||||||
SELECT pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`
|
SELECT pa.`id_product`, pa.`quantity`, ag.`public_name` as `group`, al.`name`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
|
FROM `'._DB_PREFIX_.'product_attribute` pa, `'._DB_PREFIX_.'product_attribute_combination` ac, `'._DB_PREFIX_.'attribute` a, `'._DB_PREFIX_.'attribute_lang` al, `'._DB_PREFIX_.'attribute_group_lang` ag
|
||||||
WHERE pa.`id_product` IN ('.implode(', ', $id_products).')
|
WHERE pa.`id_product` IN ('.implode(', ', $id_products).')
|
||||||
@ -178,10 +199,10 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
AND pa.`quantity` > 0
|
AND pa.`quantity` > 0
|
||||||
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
||||||
') as $attr) {
|
') as $attr) {
|
||||||
if(!isset($attributes[$attr['id_product']])) {
|
if (!isset($attributes[$attr['id_product']])) {
|
||||||
$attributes[$attr['id_product']] = array();
|
$attributes[$attr['id_product']] = array();
|
||||||
}
|
}
|
||||||
if(!isset($attributes[$attr['id_product']][$attr['group']])) {
|
if (!isset($attributes[$attr['id_product']][$attr['group']])) {
|
||||||
$attributes[$attr['id_product']][$attr['group']] = array();
|
$attributes[$attr['id_product']][$attr['group']] = array();
|
||||||
}
|
}
|
||||||
$attributes[$attr['id_product']][$attr['group']][] = array(
|
$attributes[$attr['id_product']][$attr['group']][] = array(
|
||||||
@ -200,4 +221,5 @@ if($id_category && $p && $id_category > 1) {
|
|||||||
} else {
|
} else {
|
||||||
$result['error'] = 'invalid_request';
|
$result['error'] = 'invalid_request';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode(array($result));
|
echo json_encode(array($result));
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
class CategoryController extends CategoryControllerCore {
|
class CategoryController extends CategoryControllerCore
|
||||||
public function preProcess() {
|
{
|
||||||
|
public function preProcess()
|
||||||
|
{
|
||||||
global $site_version_front;
|
global $site_version_front;
|
||||||
global $cookie;
|
global $cookie;
|
||||||
|
|
||||||
parent::preProcess();
|
parent::preProcess();
|
||||||
|
|
||||||
if(Module::isInstalled('privatesales')) {
|
if (Module::isInstalled('privatesales')) {
|
||||||
include_once dirname(__FILE__).'/../../modules/privatesales/Sale.php';
|
include_once dirname(__FILE__).'/../../modules/privatesales/Sale.php';
|
||||||
$id_category = Tools::getValue('id_category');
|
$id_category = Tools::getValue('id_category');
|
||||||
$sale = Sale::getSaleFromCategory($id_category);
|
$sale = Sale::getSaleFromCategory($id_category);
|
||||||
|
|
||||||
$other_sales = array();
|
$other_sales = array();
|
||||||
if(!empty($sale)){
|
if (!empty($sale)){
|
||||||
$other_sales = $sale->getOthersSales(true, null, null, 'current', false, Configuration::get('PRIVATES_SHOW_PUBLIC'), '`date_start` desc', $site_version_front);
|
$other_sales = $sale->getOthersSales(true, null, null, 'current', false, Configuration::get('PRIVATES_SHOW_PUBLIC'), '`date_start` desc', $site_version_front);
|
||||||
foreach ($other_sales as $key => &$s) {
|
foreach ($other_sales as $key => &$s) {
|
||||||
$s['is_thumb_img_lang'] = false;
|
$s['is_thumb_img_lang'] = false;
|
||||||
@ -23,7 +25,7 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
$s['is_thumb_img'] = true;
|
$s['is_thumb_img'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/banner_mobile_'.$cookie->id_lang.'.jpg')) {
|
if (file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/banner_mobile_'.$cookie->id_lang.'.jpg')) {
|
||||||
$banner_mobile = true;
|
$banner_mobile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
'category' => $this->category,
|
'category' => $this->category,
|
||||||
'HOOK_PRIVATESALES_CATEGORY' => Module::hookExec('privatesales_category', array('sale' => $sale)),
|
'HOOK_PRIVATESALES_CATEGORY' => Module::hookExec('privatesales_category', array('sale' => $sale)),
|
||||||
'HOOK_LEFT_COLUMN_VP' => Module::hookExec('displayleftVP', array('id_category' => $id_category)),
|
'HOOK_LEFT_COLUMN_VP' => Module::hookExec('displayleftVP', array('id_category' => $id_category)),
|
||||||
'is_sale_home' => ($sale? $sale->id_category == $id_category: FALSE),
|
'is_sale_home' => ($sale ? $sale->id_category == $id_category : false),
|
||||||
'other_sales' => $other_sales,
|
'other_sales' => $other_sales,
|
||||||
'last_qties' => (int)Configuration::get('PS_LAST_QTIES'),
|
'last_qties' => (int)Configuration::get('PS_LAST_QTIES'),
|
||||||
'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('other_sales_category' => $other_sales, 'futuresales' => array())),
|
'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('other_sales_category' => $other_sales, 'futuresales' => array())),
|
||||||
@ -46,7 +48,8 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia() {
|
public function setMedia()
|
||||||
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
|
||||||
global $css_files;
|
global $css_files;
|
||||||
@ -58,12 +61,14 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
$js_files[] = _PS_JS_DIR_.'/jquery.flexslider-min.js';
|
$js_files[] = _PS_JS_DIR_.'/jquery.flexslider-min.js';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function productListAssign() {
|
public function productListAssign()
|
||||||
|
{
|
||||||
global $cookie;
|
global $cookie;
|
||||||
|
|
||||||
$hookExecuted = false;
|
$hookExecuted = false;
|
||||||
Module::hookExec('productListAssign', array('nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted));
|
Module::hookExec('productListAssign', array('nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted));
|
||||||
if(!$hookExecuted) { // The hook was not executed, standard working
|
|
||||||
|
if (!$hookExecuted) { // The hook was not executed, standard working
|
||||||
self::$smarty->assign('categoryNameComplement', '');
|
self::$smarty->assign('categoryNameComplement', '');
|
||||||
$this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, TRUE, TRUE, FALSE, 1, TRUE/*, ((($sale = self::$smarty->getTemplateVars('sale')) !== NULL) && (int) $sale->id > 0 && $sale->avail_only == TRUE? TRUE: FALSE)*/);
|
$this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, TRUE, TRUE, FALSE, 1, TRUE/*, ((($sale = self::$smarty->getTemplateVars('sale')) !== NULL) && (int) $sale->id > 0 && $sale->avail_only == TRUE? TRUE: FALSE)*/);
|
||||||
$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
|
$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
|
||||||
@ -73,19 +78,11 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
(int)($this->n),
|
(int)($this->n),
|
||||||
$this->orderBy,
|
$this->orderBy,
|
||||||
$this->orderWay,
|
$this->orderWay,
|
||||||
FALSE,
|
false,
|
||||||
TRUE,
|
true,
|
||||||
FALSE,
|
false,
|
||||||
1,
|
1,
|
||||||
TRUE/*,
|
true
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
$sale = self::$smarty->getTemplateVars('sale')
|
|
||||||
) !== NULL
|
|
||||||
)
|
|
||||||
&& (int) $sale->id > 0 && $sale->avail_only == TRUE? TRUE: FALSE
|
|
||||||
)*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$id_products = array();
|
$id_products = array();
|
||||||
@ -115,17 +112,17 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
$attributes = array();
|
$attributes = array();
|
||||||
$id_attributes = array();
|
$id_attributes = array();
|
||||||
foreach($result as $attr) {
|
foreach($result as $attr) {
|
||||||
if(!isset($attributes[$attr['id_product']])) {
|
if (!isset($attributes[$attr['id_product']])) {
|
||||||
$attributes[$attr['id_product']] = array();
|
$attributes[$attr['id_product']] = array();
|
||||||
}
|
}
|
||||||
if(!isset($attributes[$attr['id_product']][$attr['group']])) {
|
if (!isset($attributes[$attr['id_product']][$attr['group']])) {
|
||||||
$attributes[$attr['id_product']][$attr['group']] = array();
|
$attributes[$attr['id_product']][$attr['group']] = array();
|
||||||
}
|
}
|
||||||
if(!isset($id_attributes[$attr['id_product']])) {
|
if (!isset($id_attributes[$attr['id_product']])) {
|
||||||
$id_attributes[$attr['id_product']] = array();
|
$id_attributes[$attr['id_product']] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($attr['id_attribute'], $id_attributes[$attr['id_product']])) {
|
if (!in_array($attr['id_attribute'], $id_attributes[$attr['id_product']])) {
|
||||||
$attributes[$attr['id_product']][$attr['group']][] = array(
|
$attributes[$attr['id_product']][$attr['group']][] = array(
|
||||||
'name' => $attr['name'],
|
'name' => $attr['name'],
|
||||||
'quantity' => $attr['quantity'],
|
'quantity' => $attr['quantity'],
|
||||||
@ -150,7 +147,14 @@ class CategoryController extends CategoryControllerCore {
|
|||||||
|
|
||||||
self::$smarty->assign('images', $images);
|
self::$smarty->assign('images', $images);
|
||||||
self::$smarty->assign('categoryProductAttributes', $attributes);
|
self::$smarty->assign('categoryProductAttributes', $attributes);
|
||||||
} else { // Hook executed, use the override
|
|
||||||
|
// Filters
|
||||||
|
$id_category = Tools::getValue('id_category');
|
||||||
|
if ($cookie->filters_category == $id_category && !empty($cookie->filters_value)) {
|
||||||
|
$this->cat_products = $this->category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // Hook executed, use the override
|
||||||
$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
|
$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
|
||||||
}
|
}
|
||||||
self::$smarty->assign('nb_products', (int)$this->nbProducts);
|
self::$smarty->assign('nb_products', (int)$this->nbProducts);
|
||||||
|
Loading…
Reference in New Issue
Block a user