[-] FO : BugFix : #PSFV-629 : random special product display only special products
This commit is contained in:
1 parent
26cca35960
commit
6f08f5a59a
1 file changed
+11
-5
+11
-5
@@ -1930,7 +1930,7 @@ class ProductCore extends ObjectModel
|
|||||||
$beginning,
|
$beginning,
|
||||||
$ending,
|
$ending,
|
||||||
0,
|
0,
|
||||||
true
|
$with_combination
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1952,14 +1952,12 @@ class ProductCore extends ObjectModel
|
|||||||
$current_date = date('Y-m-d H:i:s');
|
$current_date = date('Y-m-d H:i:s');
|
||||||
$product_reductions = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context, true);
|
$product_reductions = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context, true);
|
||||||
|
|
||||||
$ids_product = false;
|
|
||||||
if ($product_reductions)
|
if ($product_reductions)
|
||||||
{
|
{
|
||||||
$ids_product = ' AND (';
|
$ids_product = ' AND (';
|
||||||
foreach ($product_reductions as $product_reduction)
|
foreach ($product_reductions as $product_reduction)
|
||||||
$ids_product .= '( p.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND pa.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
$ids_product .= '( p.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND pa.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||||
$ids_product = rtrim($ids_product, 'OR').')';
|
$ids_product = rtrim($ids_product, 'OR').')';
|
||||||
}
|
|
||||||
|
|
||||||
$groups = FrontController::getCurrentCustomerGroups();
|
$groups = FrontController::getCurrentCustomerGroups();
|
||||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||||
@@ -1981,7 +1979,6 @@ class ProductCore extends ObjectModel
|
|||||||
ORDER BY RAND()';
|
ORDER BY RAND()';
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
|
|
||||||
|
|
||||||
if (!$id_product = $result['id_product'])
|
if (!$id_product = $result['id_product'])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -2010,6 +2007,9 @@ class ProductCore extends ObjectModel
|
|||||||
$row['id_product_attribute'] = $result['id_product_attribute'];
|
$row['id_product_attribute'] = $result['id_product_attribute'];
|
||||||
return Product::getProductProperties($id_lang, $row);
|
return Product::getProductProperties($id_lang, $row);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get prices drop
|
* Get prices drop
|
||||||
@@ -2070,6 +2070,12 @@ class ProductCore extends ObjectModel
|
|||||||
$order_by = explode('.', $order_by);
|
$order_by = explode('.', $order_by);
|
||||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||||
}
|
}
|
||||||
|
$tab_id_product = array();
|
||||||
|
foreach ($ids_product as $product)
|
||||||
|
if (is_array($product))
|
||||||
|
$tab_id_product[] = $product['id_product'];
|
||||||
|
else
|
||||||
|
$tab_id_product = $product;
|
||||||
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
$sql = 'SELECT p.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
||||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
||||||
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||||
@@ -2099,7 +2105,7 @@ class ProductCore extends ObjectModel
|
|||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
AND p.`show_price` = 1
|
AND p.`show_price` = 1
|
||||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($ids_product) && count($ids_product)) ? implode(', ', $ids_product) : 0).')' : '').'
|
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').'
|
||||||
AND p.`id_product` IN (
|
AND p.`id_product` IN (
|
||||||
SELECT cp.`id_product`
|
SELECT cp.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'category_group` cg
|
FROM `'._DB_PREFIX_.'category_group` cg
|
||||||
|
|||||||
Reference in new issue
Block a user