Compare commits
4 Commits
master
...
ticket-131
Author | SHA1 | Date | |
---|---|---|---|
|
c410d4a59e | ||
|
75853ae3e1 | ||
|
cee909f10b | ||
|
9f7da4b63a |
@ -15,6 +15,13 @@ $order = array(
|
||||
$id_category = (int) Tools::getValue('c');
|
||||
$p = (int) Tools::getValue('p');
|
||||
$f = Tools::getValue('f');
|
||||
if(empty($f)){
|
||||
$f = false;
|
||||
}
|
||||
$features = Tools::getValue('ff');
|
||||
if (empty($features)){
|
||||
$features = false;
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'error' => FALSE,
|
||||
@ -42,23 +49,22 @@ if($id_category && $p && $id_category > 1) {
|
||||
$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 ($f || $features){
|
||||
$nbProducts = count($category->getProductsByAttributesAndFeatures($cookie->id_lang, $f, $features, false, false));
|
||||
}
|
||||
else{
|
||||
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
|
||||
}
|
||||
|
||||
// if($p >= $nbProducts / $n) {
|
||||
if($p >= $nbProducts / $n && !Tools::getValue('init')) {
|
||||
$result['endreached'] = TRUE;
|
||||
} else {
|
||||
if (!empty($f)){
|
||||
if ($f || $features){
|
||||
if (Tools::getValue('init')){
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p, $n, $orderBy, $orderWay);
|
||||
$cat_products = $category->getProductsByAttributesAndFeatures($cookie->id_lang, $f, $features, $p, $n, $orderBy, $orderWay);
|
||||
}
|
||||
else{
|
||||
$cat_products = $category->getProductsByAttributes($cookie->id_lang, $f, $p+1, $n, $orderBy, $orderWay);
|
||||
$cat_products = $category->getProductsByAttributesAndFeatures($cookie->id_lang, $f, $features, $p+1, $n, $orderBy, $orderWay);
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -68,7 +74,6 @@ if($id_category && $p && $id_category > 1) {
|
||||
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) {
|
||||
@ -79,6 +84,14 @@ if($id_category && $p && $id_category > 1) {
|
||||
foreach($cat_products as $p) {
|
||||
$id_products[] = $p['id_product'];
|
||||
}
|
||||
$sale_group_attributes = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute_group_ps`
|
||||
WHERE `id_sale` = '.(int)$sale->id_sale.'
|
||||
') as $row){
|
||||
$sale_group_attributes[] = $row['id_attribute_group'];
|
||||
}
|
||||
$attributes = array();
|
||||
$id_attributes = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
@ -92,7 +105,7 @@ if($id_category && $p && $id_category > 1) {
|
||||
AND ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
AND ag.`id_lang` = '.(int) $cookie->id_lang.'
|
||||
AND pa.`quantity` > 0
|
||||
AND ag.`id_attribute_group` IN(75, 9, 272, 172)
|
||||
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']])) {
|
||||
|
@ -1,17 +1,46 @@
|
||||
{if count($sizes) > 0}
|
||||
{if count($attr) > 0 || count($features) > 0}
|
||||
<div class="block_filter">
|
||||
<div class="content">
|
||||
<h4 class="open">{l s='Recherche par' mod='filtervp'} {$name}</h4>
|
||||
<h4 class="open">{l s='Recherche par' mod='filtervp'}</h4>
|
||||
|
||||
<div class="content_filter">
|
||||
<ul id="filters">
|
||||
{foreach from=$sizes item=size}
|
||||
{if count($attr) > 0}
|
||||
<h5>{$attr[0]['group']}</h5>
|
||||
{assign var="current_name" value=$attr[0]['group']}
|
||||
<ul class="filters" id="filters">
|
||||
{foreach from=$attr key=key item=attribute}
|
||||
{if $key!=0 && $current_name!=$attribute['group']}
|
||||
</ul>
|
||||
<h5>{$attribute['group']}</h5>
|
||||
<ul class="filters">
|
||||
{/if}
|
||||
<li>
|
||||
<input type="checkbox" name="size" value="{$size.id_attribute}" id="size_{$size.id_attribute}">
|
||||
<label for="size_{$size.id_attribute}">{$size.name}</label>
|
||||
<input type="checkbox" name="size" value="{$attribute['id_attribute']}" id="size_{$attribute['id_attribute']}">
|
||||
<label for="size_{$attribute['id_attribute']}">{$attribute['name']}</label>
|
||||
</li>
|
||||
{assign var="current_name" value=$attribute['group']}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if count($features) > 0}
|
||||
<h5>{$features[0]['group']}</h5>
|
||||
{assign var="current_name" value=$features[0]['group']}
|
||||
<ul class="filters" id="features">
|
||||
{foreach from=$features key=key item=feature}
|
||||
{if $key!=0 && $current_name!=$feature['group']}
|
||||
</ul>
|
||||
<h5>{$feature['group']}</h5>
|
||||
<ul class="filters">
|
||||
{/if}
|
||||
<li>
|
||||
<input type="checkbox" name="feature" value="{$feature['id_feature_value']}" id="feature_{$feature['id_feature_value']}">
|
||||
<label for="feature_{$feature['id_feature_value']}">{$feature['name']}</label>
|
||||
</li>
|
||||
{assign var="current_name" value=$feature['group']}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
class Filtervp extends Module {
|
||||
const FILTER_ID = 75;
|
||||
const FILTER_SIZE = 272;
|
||||
// const FILTER_ID = 75;
|
||||
const FILTER_ID = 1;
|
||||
// const FILTER_SIZE = 272;
|
||||
|
||||
public function __construct() {
|
||||
$this->name = 'filtervp';
|
||||
@ -23,36 +24,100 @@ class Filtervp extends Module {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function hookdisplayLeftVP($params) {
|
||||
global $smarty;
|
||||
$sizes = self::getAllValueAttr(Filtervp::FILTER_ID, Tools::getValue('id_category'));
|
||||
public function hookPrivateSales_Edit($params) {
|
||||
|
||||
if (empty($sizes)) {
|
||||
$sizes = self::getAllValueAttr(self::FILTER_SIZE, Tools::getValue('id_category'));
|
||||
$name = self::getAttrName(self::FILTER_SIZE);
|
||||
} else {
|
||||
$name = self::getAttrName(self::FILTER_ID);
|
||||
$attr_groups = Db::getInstance()->ExecuteS('
|
||||
SELECT
|
||||
al.`name`,
|
||||
a.`id_attribute_group`'.($params['sale'] !== NULL? ', (
|
||||
SELECT IFNULL(s.`id_sale`, NULL)
|
||||
FROM `'._DB_PREFIX_.'attribute_group_ps` s
|
||||
WHERE a.`id_attribute_group` = s.`id_attribute_group` AND s.`id_sale` = '.$params['sale']->id.'
|
||||
) AS `id_sale`': '').'
|
||||
FROM ps_attribute_group a
|
||||
LEFT JOIN ps_attribute_group_lang al ON al.id_attribute_group = a.id_attribute_group
|
||||
WHERE al.`id_lang` = 2
|
||||
');
|
||||
|
||||
echo '
|
||||
<div class="form-group">
|
||||
<label class="control-label">'.$this->l('Attribute groups:').'</label>
|
||||
<div class="">
|
||||
<select id="attr_groups" name="attr_groups[]" multiple="multiple" size="5" class="form-control">';
|
||||
$all_opt = array();
|
||||
foreach($attr_groups as $attribute) {
|
||||
$all_opt[] = $attribute['id_attribute_group'];
|
||||
echo '<option value="'.$attribute['id_attribute_group'].'"'.(isset($attribute['id_sale']) && $attribute['id_sale'] !== NULL?' selected="selected"':'').'>'.$attribute['name'].'</option>';
|
||||
}
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<button type="button" class="select_all_for_attr_group btn btn-default">Tout</button>
|
||||
<button type="button" class="clear_for_attr_group btn btn-default">Clear</button>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#attr_groups").select2({
|
||||
maximumSelectionLength: '.count($attr_groups).',
|
||||
placeholder: "'.$this->l('Select one or more attribute group:').'",
|
||||
allowClear: true
|
||||
});
|
||||
$(".select_all_for_attr_group").on("click", function () { $("#attr_groups").select2().val(["'.(implode('","',$all_opt)).'"]).trigger("change"); });
|
||||
$(".clear_for_attr_group").on("click", function () { $("#attr_groups").select2().val(null).trigger("change"); });
|
||||
});
|
||||
</script>
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function hookPrivateSales_Delete($params) {
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'attribute_group_ps`
|
||||
WHERE `id_sale` = '.$params['sale']->id
|
||||
);
|
||||
}
|
||||
|
||||
public function hookPrivateSales_Create($params) {
|
||||
if($attr_groups = Tools::getValue('attr_groups')) {
|
||||
foreach($attr_groups as $group) {
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'attribute_group_ps` VALUES (
|
||||
'.(int) $group.', '.$params['sale']->id.'
|
||||
)
|
||||
');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($name == 'Tailles') {
|
||||
$name = 'Taille';
|
||||
};
|
||||
|
||||
public function hookPrivateSales_Update($params) {
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'attribute_group_ps`
|
||||
WHERE `id_sale` = '.$params['sale']->id
|
||||
);
|
||||
$this->hookPrivateSales_Create($params);
|
||||
}
|
||||
|
||||
public function hookdisplayLeftVP($params) {
|
||||
global $smarty;
|
||||
$attributes = self::getAllAttrByGroup(Tools::getValue('id_category'));
|
||||
$features = self::getAllFeaturesByCat(Tools::getValue('id_category'));
|
||||
$smarty->assign(array(
|
||||
'name' => $name,
|
||||
'sizes' => $sizes,
|
||||
'attr' => $attributes,
|
||||
'features' => $features,
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'filter.tpl');
|
||||
}
|
||||
return $this->display(__FILE__, 'filter.tpl');
|
||||
}
|
||||
|
||||
public static function getAllValueAttr($id_attr, $id_cat){
|
||||
|
||||
public static function getAllValueAttr($id_attr, $id_cat){
|
||||
global $cookie;
|
||||
|
||||
|
||||
$id_lang = $cookie->id_lang;
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
SELECT
|
||||
al.`name`,
|
||||
SELECT
|
||||
al.`name`,
|
||||
a.`id_attribute`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'attribute` a
|
||||
@ -61,23 +126,80 @@ class Filtervp extends Module {
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON cp.id_product = p.id_product
|
||||
INNER JOIN '._DB_PREFIX_.'product_attribute pa ON pa.id_product = cp.id_product
|
||||
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_attribute = a.id_attribute AND pac.id_product_attribute = pa.id_product_attribute
|
||||
WHERE
|
||||
a.id_attribute_group = "'.$id_attr.'"
|
||||
WHERE
|
||||
a.id_attribute_group = "'.$id_attr.'"
|
||||
GROUP BY
|
||||
a.`id_attribute`
|
||||
ORDER BY
|
||||
al.`name` ASC
|
||||
al.`name` ASC
|
||||
');
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function getAttrName($id_attr){
|
||||
public function getAllAttrByGroup($id_cat)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$id_lang = $cookie->id_lang;
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
SELECT
|
||||
al.`name`,
|
||||
a.`id_attribute`,
|
||||
agl.`name` as `group`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'attribute` a
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON al.id_lang = '.(int)$id_lang.' AND al.id_attribute = a.id_attribute
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = '.(int)$id_lang.'
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_ps agp ON agp.id_attribute_group = agl.id_attribute_group
|
||||
LEFT JOIN '._DB_PREFIX_.'privatesale_category pc ON pc.id_sale = agp.id_sale
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON cp.id_category = pc.id_category
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON cp.id_product = p.id_product
|
||||
INNER JOIN ps_product_attribute pa ON pa.id_product = cp.id_product
|
||||
INNER JOIN ps_product_attribute_combination pac ON pac.id_attribute = a.id_attribute AND pac.id_product_attribute = pa.id_product_attribute
|
||||
WHERE agp.id_sale IS NOT NULL AND pc.id_category = '.(int)$id_cat.'
|
||||
GROUP BY
|
||||
a.`id_attribute`
|
||||
ORDER BY
|
||||
agl.`name` ASC, al.`name` ASC
|
||||
');
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function getAllFeaturesByCat($id_cat)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$id_lang = $cookie->id_lang;
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
SELECT
|
||||
fl.`name` as `group`,
|
||||
fp.`id_feature_value`,
|
||||
fvl.`value` as `name`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'feature_ps` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_category` pc ON pc.id_sale = a.id_sale
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON fl.id_lang = '.(int)$id_lang.' AND fl.id_feature = a.id_feature
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON cp.id_category = pc.id_category
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON cp.id_product = p.id_product
|
||||
INNER JOIN `'._DB_PREFIX_.'feature_product` fp ON fp.id_product = cp.id_product
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_value_lang` fvl ON fvl.id_lang = '.(int)$id_lang.' AND fvl.id_feature_value = fp.id_feature_value
|
||||
WHERE a.id_sale IS NOT NULL
|
||||
AND pc.id_category = '.(int)$id_cat.'
|
||||
GROUP BY
|
||||
fvl.`id_feature_value`
|
||||
ORDER BY
|
||||
fl.`name` ASC, fvl.`value` ASC
|
||||
');
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function getAttrName($id_attr){
|
||||
global $cookie;
|
||||
$id_lang = $cookie->id_lang;
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT
|
||||
`public_name`
|
||||
FROM `'._DB_PREFIX_.'attribute_group_lang`
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT
|
||||
`public_name`
|
||||
FROM `'._DB_PREFIX_.'attribute_group_lang`
|
||||
WHERE `id_attribute_group` = "'.(int)$id_attr.'"
|
||||
AND `id_lang` = "'.(int)$id_lang.'"
|
||||
');
|
||||
|
@ -379,6 +379,113 @@ class Category extends CategoryCore {
|
||||
return Product::getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
public function getProductsByAttributesAndFeatures($id_lang, $attributes=false, $features=false, $p=false, $n=false, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true)
|
||||
{
|
||||
|
||||
global $cookie;
|
||||
if (!$checkAccess OR !$this->checkAccess($cookie->id_customer))
|
||||
return false;
|
||||
|
||||
if ($p < 1) $p = 1;
|
||||
|
||||
if (empty($orderBy))
|
||||
$orderBy = 'position';
|
||||
else
|
||||
/* Fix for all modules which are now using lowercase values for 'orderBy' parameter */
|
||||
$orderBy = strtolower($orderBy);
|
||||
|
||||
if (empty($orderWay))
|
||||
$orderWay = 'ASC';
|
||||
if ($orderBy == 'id_product' OR $orderBy == 'date_add')
|
||||
$orderByPrefix = 'p';
|
||||
elseif ($orderBy == 'name')
|
||||
$orderByPrefix = 'pl';
|
||||
elseif ($orderBy == 'manufacturer')
|
||||
{
|
||||
$orderByPrefix = 'm';
|
||||
$orderBy = 'name';
|
||||
}
|
||||
elseif ($orderBy == 'position')
|
||||
$orderByPrefix = 'cp';
|
||||
|
||||
if ($orderBy == 'price')
|
||||
$orderBy = 'orderprice';
|
||||
|
||||
if (!Validate::isBool($active) OR !Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay))
|
||||
die (Tools::displayError());
|
||||
|
||||
$id_supplier = (int)(Tools::getValue('id_supplier'));
|
||||
|
||||
/* Return only the number of products */
|
||||
if ($getTotal)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT COUNT(cp.`id_product`) AS total
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
|
||||
WHERE cp.`id_category` = '.(int)($this->id).($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($id_supplier ? 'AND p.id_supplier = '.(int)($id_supplier) : ''));
|
||||
return isset($result) ? $result['total'] : 0;
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT DISTINCT p.*, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||
(p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` )
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||
'.($features? 'LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = cp.`id_product`)':'').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE cp.`id_category` = '.(int)($this->id).($active ? ' AND p.`active` = 1' : '').'
|
||||
'.($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '').'
|
||||
AND p.`quantity` > 0';
|
||||
|
||||
if ( $attributes ){
|
||||
$sql .= ' AND pac.`id_attribute` IN ('.$attributes.')
|
||||
AND pa.`quantity` > 0';
|
||||
}
|
||||
|
||||
if ( $features ){
|
||||
$sql .= ' AND fp.`id_feature_value` IN ('.$features.')';
|
||||
}
|
||||
|
||||
if ($random === true)
|
||||
{
|
||||
$sql .= ' ORDER BY RAND()';
|
||||
$sql .= ' LIMIT 0, '.(int)($randomNumberProducts);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= ' ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay);
|
||||
if ( $n && $p ){
|
||||
$sql.=' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
}
|
||||
}
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
if ($orderBy == 'orderprice')
|
||||
Tools::orderbyPrice($result, $orderWay);
|
||||
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
/* Modify SQL result */
|
||||
return $data = Product::getProductsProperties($id_lang, $result);
|
||||
|
||||
return Product::getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
public static function getMaxId()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
|
@ -7350,4 +7350,11 @@ table#carrierTable tbody td {
|
||||
#cart_remove_gift_message{
|
||||
float:right;
|
||||
background: #e26ea2;
|
||||
}
|
||||
|
||||
.block_filter .content_filter h5{
|
||||
font-size: 15px;
|
||||
text-decoration: underline;
|
||||
color: #514E8C;
|
||||
margin:10px 0px;
|
||||
}
|
@ -4,6 +4,7 @@ $(document).ready(function() {
|
||||
var error = false;
|
||||
var endreached = false;
|
||||
var filter = new Array();
|
||||
var features = new Array();
|
||||
|
||||
$('.random').each(function(){
|
||||
$(this).hover(function() {
|
||||
@ -21,9 +22,13 @@ $(document).ready(function() {
|
||||
$(".block_filter input:checkbox[name=size]:checked").each(function(){
|
||||
filter.push($(this).val());
|
||||
});
|
||||
|
||||
features.length = 0
|
||||
$(".block_filter input:checkbox[name=feature]:checked").each(function(){
|
||||
features.push($(this).val());
|
||||
});
|
||||
console.log(features);
|
||||
loading = true;
|
||||
$.get("{/literal}{$base_dir_ssl}{literal}modules/categoryscroll/ajax.php?c={/literal}{$id_category}{literal}&f="+ filter +"&p=" + $("#product_list").val(), function(loaded) {
|
||||
$.get("{/literal}{$base_dir_ssl}{literal}modules/categoryscroll/ajax.php?c={/literal}{$id_category}{literal}&f="+ filter +"&ff="+ features +"&p=" + $("#product_list").val(), function(loaded) {
|
||||
loaded = $.parseJSON(loaded)[0];
|
||||
if(loaded.error == false) {
|
||||
endreached = loaded.endreached;
|
||||
@ -63,9 +68,14 @@ $(document).ready(function() {
|
||||
$(".block_filter input:checkbox[name=size]:checked").each(function(){
|
||||
filter.push($(this).val());
|
||||
});
|
||||
features.length = 0
|
||||
$(".block_filter input:checkbox[name=feature]:checked").each(function(){
|
||||
features.push($(this).val());
|
||||
});
|
||||
console.log(features);
|
||||
$("#product_list").val(0);
|
||||
loading = true;
|
||||
$.get("{/literal}{$base_dir_ssl}{literal}modules/categoryscroll/ajax.php?c={/literal}{$id_category}{literal}&init=1&f="+ filter +"&p=1", function(loaded) {
|
||||
$.get("{/literal}{$base_dir_ssl}{literal}modules/categoryscroll/ajax.php?c={/literal}{$id_category}{literal}&init=1&f="+ filter +"&ff="+features+"&p=1", function(loaded) {
|
||||
loaded = $.parseJSON(loaded)[0];
|
||||
if(loaded.error == false) {
|
||||
endreached = loaded.endreached;
|
||||
|
Loading…
Reference in New Issue
Block a user