remontee product home
This commit is contained in:
parent
5df1a18462
commit
143d26a77c
@ -47,9 +47,9 @@ class Homeproduct extends Module
|
||||
{
|
||||
$collection = new Collection('Product', $id_lang);
|
||||
$collection->where('active', '=', 1);
|
||||
$collection->where('online_only', '=', 1);
|
||||
$collection->where('online_only', '=', 1);
|
||||
$collection->where('online_only', '=', 1);
|
||||
$collection->setPageSize($limit);
|
||||
$collection->sqlOrderBy('RAND()');
|
||||
$products = $collection->getResults();
|
||||
|
||||
$products = array_map(function($elem) {
|
||||
|
@ -57,21 +57,15 @@ class ProductSale extends ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
AND tr.`id_state` = 0
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cprod ON (cprod.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0);
|
||||
|
||||
$sql .= '
|
||||
WHERE product_shop.`active` = 1
|
||||
AND p.`online_only` = 1
|
||||
AND cprod.`id_category` = 2
|
||||
AND p.`visibility` != \'none\'';
|
||||
|
||||
if (Group::isFeatureActive()) {
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql .= ' AND EXISTS(SELECT 1 FROM `'._DB_PREFIX_.'category_product` cp
|
||||
JOIN `'._DB_PREFIX_.'category_group` cg ON (cp.id_category = cg.id_category AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').')
|
||||
WHERE cp.`id_product` = p.`id_product`)';
|
||||
}
|
||||
|
||||
if ($final_order_by != 'price') {
|
||||
$sql .= '
|
||||
ORDER BY RAND()
|
||||
|
@ -36,7 +36,7 @@ class BlockBestSellersOverride extends BlockBestSellers
|
||||
|
||||
if (!($result = ProductSale::getProductHome((int)$params['cookie']->id_lang, 0, (int)Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY'))))
|
||||
return (Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false);
|
||||
|
||||
|
||||
$currency = new Currency($params['cookie']->id_currency);
|
||||
$usetax = (Product::getTaxCalculationMethod((int)$this->context->customer->id) != PS_TAX_EXC);
|
||||
foreach ($result as &$row)
|
||||
|
Loading…
Reference in New Issue
Block a user