remove presta cache system for similar products

This commit is contained in:
Marion Muszynski 2017-03-29 10:07:59 +02:00
parent 79b2174ae3
commit 85ca91ccfc

View File

@ -144,78 +144,66 @@ class Privatesales_similarproducts extends Module
{
global $smarty;
$cache_id = (int)$params['cookie']->id_lang.'_'.(int)$params['product']->id;
$other_products = array();
if (!$this->isTemplateCached($cache_id)) {
$other_products = array();
$accessories = $params['product']->getAccessories($params['cookie']->id_lang);
if(is_array($accessories)) {
$accessories = $params['product']->getAccessories($params['cookie']->id_lang);
if(is_array($accessories)) {
$currency = new Currency((int)($params['cookie']->id_currency));
$currency = new Currency((int)($params['cookie']->id_currency));
foreach ($accessories AS $accessory)
{
$accessory['price'] = Tools::displayPrice(Product::getPriceStatic((int)($accessory['id_product'])), $currency);
$other_products[] = $accessory;
}
foreach ($accessories AS $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)
{
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)) {
$currency = new Currency((int)($params['cookie']->id_currency));
// get all best sales of the product family
$other_products = array();
$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,
)
$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 '';
}
return $this->flushTemplateCache($cache_id);
$smarty->assign(
array(
'label' => $this->label,
'ps_other_products' => $other_products,
)
);
return $this->display(__FILE__, 'front_similarproducts.tpl');
}