Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
+1
-2
@@ -423,7 +423,7 @@ class CartCore extends ObjectModel
|
||||
p.`id_manufacturer`, product_shop.`on_sale`, product_shop.`ecotax`, product_shop.`additional_shipping_cost`, product_shop.`available_for_order`, product_shop.`price`, p.`weight`,
|
||||
stock.`quantity` quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, product_shop.`active`, p.`date_add`,
|
||||
p.`date_upd`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category,
|
||||
CONCAT(cp.`id_product`, cp.`id_product_attribute`, cp.`id_address_delivery`) AS unique_id, cp.id_address_delivery,
|
||||
CONCAT(cp.`id_product`, IFNULL(cp.`id_product_attribute`, 0), IFNULL(cp.`id_address_delivery`, 0)) AS unique_id, cp.id_address_delivery,
|
||||
product_shop.`wholesale_price`, product_shop.advanced_stock_management');
|
||||
|
||||
// Build FROM
|
||||
@@ -1507,7 +1507,6 @@ class CartCore extends ObjectModel
|
||||
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
||||
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
||||
|
||||
}
|
||||
|
||||
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), $wrapping_fees + $order_total_products + $shipping_fees);
|
||||
|
||||
@@ -28,6 +28,10 @@ global $smarty;
|
||||
$smarty->debugging = false;
|
||||
$smarty->debugging_ctrl = 'NONE';
|
||||
|
||||
/* Smarty should be in compile check mode in the BackOffice */
|
||||
$smarty->force_compile = false;
|
||||
$smarty->compile_check = true;
|
||||
|
||||
function smartyTranslate($params, &$smarty)
|
||||
{
|
||||
$htmlentities = !isset($params['js']);
|
||||
|
||||
@@ -49,9 +49,9 @@ class BlockViewed extends Module
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
OR !$this->registerHook('leftColumn')
|
||||
OR !$this->registerHook('header')
|
||||
OR !Configuration::updateValue('PRODUCTS_VIEWED_NBR', 2))
|
||||
|| !$this->registerHook('leftColumn')
|
||||
|| !$this->registerHook('header')
|
||||
|| !Configuration::updateValue('PRODUCTS_VIEWED_NBR', 2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class BlockViewed extends Module
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$productsViewed = (isset($params['cookie']->viewed) && !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();
|
||||
|
||||
if (sizeof($productsViewed))
|
||||
if (count($productsViewed))
|
||||
{
|
||||
$defaultCover = Language::getIsoById($params['cookie']->id_lang).'-default';
|
||||
|
||||
@@ -116,11 +116,11 @@ class BlockViewed extends Module
|
||||
);
|
||||
|
||||
$productsImagesArray = array();
|
||||
foreach ($productsImages AS $pi)
|
||||
foreach ($productsImages as $pi)
|
||||
$productsImagesArray[$pi['id_product']] = $pi;
|
||||
|
||||
$productsViewedObj = array();
|
||||
foreach ($productsViewed AS $productViewed)
|
||||
foreach ($productsViewed as $productViewed)
|
||||
{
|
||||
$obj = (object)'Product';
|
||||
if (!isset($productsImagesArray[$productViewed]) || (!$obj->active = $productsImagesArray[$productViewed]['active']))
|
||||
@@ -147,29 +147,20 @@ class BlockViewed extends Module
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_product AND !in_array($id_product, $productsViewed))
|
||||
if ($id_product && !in_array($id_product, $productsViewed))
|
||||
{
|
||||
// Check if the user to the right of access to this product
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT COUNT(cug.`id_customer`) AS total
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`)
|
||||
WHERE p.`id_product` = '.(int)($id_product).'
|
||||
'.($this->context->customer->id ? 'AND cug.`id_customer` = '.(int)$this->context->customer->id :
|
||||
'AND cg.`id_group` = 1')
|
||||
);
|
||||
if ($result['total'])
|
||||
$product = new Product((int)$id_product);
|
||||
if ($product->checkAccess((int)$this->context->customer->id))
|
||||
array_unshift($productsViewed, $id_product);
|
||||
}
|
||||
$viewed = '';
|
||||
foreach ($productsViewed AS $id_product_viewed)
|
||||
foreach ($productsViewed as $id_product_viewed)
|
||||
$viewed .= (int)($id_product_viewed).',';
|
||||
$params['cookie']->viewed = rtrim($viewed, ',');
|
||||
|
||||
if (!sizeof($productsViewedObj))
|
||||
return ;
|
||||
if (!count($productsViewedObj))
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'productsViewedObj' => $productsViewedObj,
|
||||
@@ -179,7 +170,7 @@ class BlockViewed extends Module
|
||||
}
|
||||
elseif ($id_product)
|
||||
$params['cookie']->viewed = (int)($id_product);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
|
||||
Reference in New Issue
Block a user