Merge branch 'ticket/r16686-filter_back' into develop
This commit is contained in:
commit
4a85441bbf
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
2
modules/blockauth/.hg/cache/branchheads
vendored
2
modules/blockauth/.hg/cache/branchheads
vendored
@ -1,2 +0,0 @@
|
||||
22140c622301271e8694549e29e360916921e485 0
|
||||
22140c622301271e8694549e29e360916921e485 default
|
2
modules/blockauth/.hg/cache/tags
vendored
2
modules/blockauth/.hg/cache/tags
vendored
@ -1,2 +0,0 @@
|
||||
0 22140c622301271e8694549e29e360916921e485
|
||||
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
[paths]
|
||||
default = ssh://ewen@localhost//hg/blockauth
|
@ -1,4 +0,0 @@
|
||||
revlogv1
|
||||
fncache
|
||||
store
|
||||
dotencode
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
data/logo.gif.i
|
||||
data/config.xml.i
|
||||
data/fr.php.i
|
||||
data/blockauth.php.i
|
||||
data/blockauth.tpl.i
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
@ -1,3 +0,0 @@
|
||||
0
|
||||
pull
|
||||
ssh://ewen@localhost//hg/blockauth
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
2
modules/blockcartex/.hg/cache/branchheads
vendored
2
modules/blockcartex/.hg/cache/branchheads
vendored
@ -1,2 +0,0 @@
|
||||
55a547b9200e199cbe52370d3ee590a2a8237c03 2
|
||||
55a547b9200e199cbe52370d3ee590a2a8237c03 default
|
2
modules/blockcartex/.hg/cache/tags
vendored
2
modules/blockcartex/.hg/cache/tags
vendored
@ -1,2 +0,0 @@
|
||||
2 55a547b9200e199cbe52370d3ee590a2a8237c03
|
||||
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
[paths]
|
||||
default = ssh://ewen@localhost//hg/blockcartex
|
@ -1,4 +0,0 @@
|
||||
revlogv1
|
||||
fncache
|
||||
store
|
||||
dotencode
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,16 +0,0 @@
|
||||
data/img/index.php.i
|
||||
data/index.php.i
|
||||
data/config.xml.i
|
||||
data/img/icon/delete.gif.i
|
||||
data/img/icon/index.php.i
|
||||
data/img/icon/basket_go.png.i
|
||||
data/blockcart-ajax.php.i
|
||||
data/img/icon/checkout.png.i
|
||||
data/blockcart-set-collapse.php.i
|
||||
data/blockcartex.php.i
|
||||
data/fr.php.i
|
||||
data/logo.gif.i
|
||||
data/ajax-cart.js.i
|
||||
data/blockcart.tpl.i
|
||||
data/img/icon/basket.png.i
|
||||
data/blockcart-json.tpl.i
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
@ -1,3 +0,0 @@
|
||||
0
|
||||
pull
|
||||
ssh://ewen@localhost//hg/blockcartex
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
2
modules/blocklogo/.hg/cache/branchheads
vendored
2
modules/blocklogo/.hg/cache/branchheads
vendored
@ -1,2 +0,0 @@
|
||||
a0b6701fd7c40b9759a83fc8e78566aa84a678e2 0
|
||||
a0b6701fd7c40b9759a83fc8e78566aa84a678e2 default
|
2
modules/blocklogo/.hg/cache/tags
vendored
2
modules/blocklogo/.hg/cache/tags
vendored
@ -1,2 +0,0 @@
|
||||
0 a0b6701fd7c40b9759a83fc8e78566aa84a678e2
|
||||
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
[paths]
|
||||
default = ssh://ewen@localhost//hg/blocklogo
|
@ -1,4 +0,0 @@
|
||||
revlogv1
|
||||
fncache
|
||||
store
|
||||
dotencode
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
data/index.php.i
|
||||
data/config.xml.i
|
||||
data/logo.gif.i
|
||||
data/en.php.i
|
||||
data/blocklogo.php.i
|
||||
data/blocklogo.tpl.i
|
||||
data/fr.php.i
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
@ -1,3 +0,0 @@
|
||||
0
|
||||
pull
|
||||
ssh://ewen@localhost//hg/blocklogo
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
2
modules/categoryscroll/.hg/cache/branchheads
vendored
2
modules/categoryscroll/.hg/cache/branchheads
vendored
@ -1,2 +0,0 @@
|
||||
613b481451e73594f52e08e2a35120c98652d63c 3
|
||||
613b481451e73594f52e08e2a35120c98652d63c default
|
2
modules/categoryscroll/.hg/cache/tags
vendored
2
modules/categoryscroll/.hg/cache/tags
vendored
@ -1,2 +0,0 @@
|
||||
3 613b481451e73594f52e08e2a35120c98652d63c
|
||||
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
[paths]
|
||||
default = ssh://ewen@localhost//hg/categoryscroll
|
@ -1,4 +0,0 @@
|
||||
revlogv1
|
||||
fncache
|
||||
store
|
||||
dotencode
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
data/config.xml.i
|
||||
data/product-list.tpl.i
|
||||
data/product_list.tpl.i
|
||||
data/header.tpl.i
|
||||
data/ajax.php.i
|
||||
data/categoryscroll.php.i
|
||||
data/logo.gif.i
|
||||
data/fr.php.i
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
@ -1,3 +0,0 @@
|
||||
0
|
||||
pull
|
||||
ssh://ewen@localhost//hg/categoryscroll
|
@ -12,8 +12,13 @@ $order = array(
|
||||
'quantity',
|
||||
);
|
||||
|
||||
// Category
|
||||
$id_category = (int) Tools::getValue('c');
|
||||
|
||||
// Page
|
||||
$p = (int) Tools::getValue('p');
|
||||
|
||||
// Filters value - attribute
|
||||
$f = Tools::getValue('f');
|
||||
|
||||
$result = array(
|
||||
@ -22,56 +27,70 @@ $result = array(
|
||||
'endreached' => FALSE,
|
||||
);
|
||||
|
||||
if($id_category && $p && $id_category > 1) {
|
||||
if(Module::isInstalled('privatesales')) {
|
||||
include(dirname(__FILE__).'/../privatesales/Sale.php');
|
||||
if ($id_category && $p && $id_category > 1) {
|
||||
// Private Sales
|
||||
if (Module::isInstalled('privatesales')) {
|
||||
include dirname(__FILE__).'/../privatesales/Sale.php';
|
||||
$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();
|
||||
$category = new Category($id_category, $cookie->id_lang);
|
||||
$customer = new Customer((int) $cookie->id_customer);
|
||||
|
||||
if( ($sale !== NULL
|
||||
&& $sale->enabled
|
||||
&& strtotime($sale->date_start) < $now
|
||||
&& strtotime($sale->date_end) > $now
|
||||
&& count(array_intersect(($cookie->isLogged()? Customer::getGroupsStatic((int) $cookie->id_customer): array(1)), $sale->groups) > 0)
|
||||
&& $category->active) || ($customer->isMemberOfGroup(2) == 1) ) {
|
||||
if( ($sale !== null
|
||||
&& $sale->enabled
|
||||
&& strtotime($sale->date_start) < $now
|
||||
&& strtotime($sale->date_end) > $now
|
||||
&& count(array_intersect(($cookie->isLogged()? Customer::getGroupsStatic((int) $cookie->id_customer): array(1)), $sale->groups) > 0)
|
||||
&& $category->active)
|
||||
|| ($customer->isMemberOfGroup(2) == 1) ) {
|
||||
|
||||
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
||||
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
||||
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
||||
|
||||
if (!empty($f)){
|
||||
$nbProducts = count($category->getProductsByAttributes($cookie->id_lang, $f, false, false));
|
||||
if (!empty($cookie->filters_value)) {
|
||||
$nbProducts = count($category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, false, false));
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$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;
|
||||
} else {
|
||||
if (!empty($f)){
|
||||
if (Tools::getValue('init')){
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p, $n, $orderBy, $orderWay);
|
||||
if (!empty($cookie->filters_value)) {
|
||||
if (Tools::getValue('init')) {
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, $p, $n, $orderBy, $orderWay);
|
||||
}
|
||||
else{
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p+1, $n, $orderBy, $orderWay);
|
||||
else {
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $cookie->filters_value, $p+1, $n, $orderBy, $orderWay);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (Tools::getValue('init')){
|
||||
else {
|
||||
if (Tools::getValue('init')) {
|
||||
$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);
|
||||
}
|
||||
|
||||
if(!$cat_products) {
|
||||
if (!$cat_products) {
|
||||
$smarty->assign('products', array());
|
||||
} else {
|
||||
$smarty->assign('products', $cat_products);
|
||||
@ -89,7 +108,7 @@ if($id_category && $p && $id_category > 1) {
|
||||
}
|
||||
$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`
|
||||
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).')
|
||||
@ -103,17 +122,17 @@ if($id_category && $p && $id_category > 1) {
|
||||
AND ag.`id_attribute_group` IN('.implode(',', $sale_group_attributes).')
|
||||
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
||||
') as $attr) {
|
||||
if(!isset($attributes[$attr['id_product']])) {
|
||||
if (!isset($attributes[$attr['id_product']])) {
|
||||
$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();
|
||||
}
|
||||
if(!isset($id_attributes[$attr['id_product']])) {
|
||||
if (!isset($id_attributes[$attr['id_product']])) {
|
||||
$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(
|
||||
'name' => $attr['name'],
|
||||
'quantity' => $attr['quantity'],
|
||||
@ -155,14 +174,16 @@ if($id_category && $p && $id_category > 1) {
|
||||
} else {
|
||||
$result['error'] = 'permission_denied';
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// No private sales
|
||||
else {
|
||||
$n = (int) Configuration::get('PS_PRODUCTS_PER_PAGE', 10);
|
||||
$orderBy = $order[Configuration::get('PS_PRODUCTS_ORDER_BY', 1)];
|
||||
$orderWay = (Configuration::get('PS_PRODUCTS_ORDER_WAY', 0) == 0? 'ASC': 'DESC');
|
||||
$category = new Category($id_category, $cookie->id_lang);
|
||||
if($category->active) {
|
||||
if ($category->active) {
|
||||
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
||||
if($p >= $nbProducts / $n) {
|
||||
if ($p >= $nbProducts / $n) {
|
||||
$result['endreached'] = TRUE;
|
||||
} else {
|
||||
$cat_products = $category->getProducts($cookie->id_lang, $p + 1, $n, $orderBy, $orderWay);
|
||||
@ -173,7 +194,7 @@ if($id_category && $p && $id_category > 1) {
|
||||
$id_products[] = $p['id_product'];
|
||||
}
|
||||
$attributes = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
foreach (Db::getInstance()->ExecuteS('
|
||||
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
|
||||
WHERE pa.`id_product` IN ('.implode(', ', $id_products).')
|
||||
@ -186,10 +207,10 @@ if($id_category && $p && $id_category > 1) {
|
||||
AND pa.`quantity` > 0
|
||||
ORDER BY pa.`id_product` ASC, ag.`public_name` ASC, al.`name` ASC
|
||||
') as $attr) {
|
||||
if(!isset($attributes[$attr['id_product']])) {
|
||||
if (!isset($attributes[$attr['id_product']])) {
|
||||
$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(
|
||||
@ -208,4 +229,5 @@ if($id_category && $p && $id_category > 1) {
|
||||
} else {
|
||||
$result['error'] = 'invalid_request';
|
||||
}
|
||||
|
||||
echo json_encode(array($result));
|
||||
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
default
|
2
modules/exports/.hg/cache/branchheads
vendored
2
modules/exports/.hg/cache/branchheads
vendored
@ -1,2 +0,0 @@
|
||||
f505c0c88c1966e5f7ec9c5b7498e432e829987f 0
|
||||
f505c0c88c1966e5f7ec9c5b7498e432e829987f default
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user