remove presta cache system for similar products
This commit is contained in:
parent
79b2174ae3
commit
85ca91ccfc
@ -144,78 +144,66 @@ class Privatesales_similarproducts extends Module
|
|||||||
{
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
|
||||||
$cache_id = (int)$params['cookie']->id_lang.'_'.(int)$params['product']->id;
|
$other_products = array();
|
||||||
|
|
||||||
if (!$this->isTemplateCached($cache_id)) {
|
$accessories = $params['product']->getAccessories($params['cookie']->id_lang);
|
||||||
$other_products = array();
|
if(is_array($accessories)) {
|
||||||
|
|
||||||
$accessories = $params['product']->getAccessories($params['cookie']->id_lang);
|
$currency = new Currency((int)($params['cookie']->id_currency));
|
||||||
if(is_array($accessories)) {
|
|
||||||
|
|
||||||
$currency = new Currency((int)($params['cookie']->id_currency));
|
foreach ($accessories AS $accessory)
|
||||||
|
{
|
||||||
foreach ($accessories AS $accessory)
|
$accessory['price'] = Tools::displayPrice(Product::getPriceStatic((int)($accessory['id_product'])), $currency);
|
||||||
{
|
$other_products[] = $accessory;
|
||||||
$accessory['price'] = Tools::displayPrice(Product::getPriceStatic((int)($accessory['id_product'])), $currency);
|
|
||||||
$other_products[] = $accessory;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($other_products)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$smarty->assign(
|
|
||||||
array(
|
|
||||||
'label' => $this->label,
|
|
||||||
'ps_other_products' => $other_products,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->flushTemplateCache($cache_id);
|
if (empty($other_products)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$smarty->assign(
|
||||||
|
array(
|
||||||
|
'label' => $this->label,
|
||||||
|
'ps_other_products' => $other_products,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $this->display(__FILE__, 'front_similarproducts.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function displayBestVPSalesSameFamily($params)
|
private function displayBestVPSalesSameFamily($params)
|
||||||
{
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
$currency = new Currency((int)($params['cookie']->id_currency));
|
||||||
|
|
||||||
$cache_id = (int)$params['cookie']->id_lang.'_'.(int)$params['product']->id;
|
// get all best sales of the product family
|
||||||
|
$other_products = array();
|
||||||
|
|
||||||
if (!$this->isTemplateCached($cache_id)) {
|
$bestsellers = ProductSale::getFamilyBestSales(
|
||||||
$currency = new Currency((int)($params['cookie']->id_currency));
|
$this->family['id_category_family'],
|
||||||
|
$params['cookie']->id_lang,
|
||||||
// get all best sales of the product family
|
3, 10,
|
||||||
$other_products = array();
|
$params['product']->id
|
||||||
|
|
||||||
$bestsellers = ProductSale::getFamilyBestSales(
|
|
||||||
$this->family['id_category_family'],
|
|
||||||
$params['cookie']->id_lang,
|
|
||||||
3, 10,
|
|
||||||
$params['product']->id
|
|
||||||
);
|
|
||||||
|
|
||||||
if(is_array($bestsellers)) {
|
|
||||||
foreach ($bestsellers AS $bestseller) {
|
|
||||||
$bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency);
|
|
||||||
$other_products[] = $bestseller;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($other_products)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$smarty->assign(
|
|
||||||
array(
|
|
||||||
'label' => $this->label,
|
|
||||||
'ps_other_products' => $other_products,
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(is_array($bestsellers)) {
|
||||||
|
foreach ($bestsellers AS $bestseller) {
|
||||||
|
$bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency);
|
||||||
|
$other_products[] = $bestseller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($other_products)) {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->flushTemplateCache($cache_id);
|
$smarty->assign(
|
||||||
|
array(
|
||||||
|
'label' => $this->label,
|
||||||
|
'ps_other_products' => $other_products,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $this->display(__FILE__, 'front_similarproducts.tpl');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user