Merge branch 'master' of gitlab.antadis.net:dev-antadis/toutpratique into develop

This commit is contained in:
Romu 2016-12-13 01:32:29 -08:00
commit 2022fd0e7b
8 changed files with 47 additions and 10 deletions

View File

@ -181,8 +181,8 @@ class AdvPicto extends Module
public function clearCache($id_product = 0)
{
if ($id_product != 0) {
$this->_clearCache('category.tpl', 'advpicto', 'advPicto_product_'.$id_product);
$this->_clearCache('product.tpl', 'advpicto', 'advPicto_product_'.$id_product);
$this->_clearCache('category.tpl', 'advpicto', 'advPicto_category_'.(int) $id_product);
$this->_clearCache('product.tpl', 'advpicto', 'advPicto_product_'.(int) $id_product);
}
}

View File

@ -174,11 +174,22 @@ class AdminAdvPictoProductController extends ModuleAdminController
public function postProcess()
{
parent::postProcess();
// clearcache
$module_picto = Module::getInstanceByName('advpicto');
$module_picto->clearCache((int) Tools::getValue('id_product', 0));
parent::postProcess();
}
// CACHE REMOVE on delete
public function processDelete()
{
if (Validate::isLoadedObject($object = $this->loadObject())) {
// clearcache
$module_picto = Module::getInstanceByName('advpicto');
$module_picto->clearCache((int) $object->id_product);
}
parent::processDelete();
}
}

View File

@ -11,7 +11,7 @@ class BlockBestSellersOverride extends BlockBestSellers
return true;
}
public function hookdisplayHome($params)
public function hookDisplayHome($params)
{
if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
{
@ -28,13 +28,30 @@ class BlockBestSellersOverride extends BlockBestSellers
return $this->display(__FILE__, 'blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home'));
}
public function hookDisplayHomestoreProduct($params)
{
if (!$this->isCached('blockbestsellers-store.tpl', $this->getCacheId('blockbestsellers-store')))
{
BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
$this->smarty->assign(array(
'best_sellers' => BlockBestSellers::$cache_best_sellers,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
));
}
if (BlockBestSellers::$cache_best_sellers === false)
return false;
return $this->display(__FILE__, 'blockbestsellers-store.tpl', $this->getCacheId('blockbestsellers-store'));
}
protected function getBestSellers($params)
{
$limit = isset($params['limit']) ? $params['limit'] : 5;
if (Configuration::get('PS_CATALOG_MODE'))
return false;
if (!($result = ProductSale::getProductHome((int)$params['cookie']->id_lang, 0, 5)))
if (!($result = ProductSale::getProductHome((int)$params['cookie']->id_lang, 0, $limit)))
return (Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false);
$currency = new Currency($params['cookie']->id_currency);

View File

@ -357,7 +357,7 @@ body.content_only { margin: 0 }
overflow: hidden;
height: 265px;
}
#constructorLink div .inner.small-title { padding: 30px 0 30px 30px }
#constructorLink div .inner.small-title { padding: 30px }
#constructorLink div .inner .img { width: 168px; height: 100%;position: relative; float: left;}
#constructorLink div:nth-child(2) .inner { background-color: #edf4f3; }
#constructorLink div img { position: absolute; left: -5px;}

View File

@ -19,6 +19,7 @@
<meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta property="fb:pages" content="182589007555" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.png" />
<link rel="alternate" type="application/rss+xml" title="Boutique RSS" href="{$base_url}/rss/boutique.xml" />

View File

@ -12,7 +12,7 @@
<div class="separator"></div>
<div id="best_sales">
{hook h='displayHome' mod='blockbestsellers'}
{hook h='displayHomestoreProduct' mod='blockbestsellers' limit=4}
</div>
<div class="separator"></div>

View File

@ -8,7 +8,7 @@
{elseif $homeEdito}
<div>
<div class="inner{if $homeEdito->smallTitle} small-title{/if}">
<div class="img"><img src="http://toutpratique.local/img/constructor/image/1_1.jpg"></div>
<div class="img"><img src="{$base_dir}/img/constructor/image/1_1.jpg"></div>
<h2 class="title">{$homeEdito->title}</h2>
<p>{$homeEdito->intro|strip_tags|truncate:135:"..."}</p>
<a class="btn" href="{$link->getPostEditoLink($homeEdito->id_edito)}">{l s='Lire l\'edito'}</a>
@ -61,7 +61,7 @@
<div class="col-xs-12">
<h2 class="title">{l s='Les indispensables du moment'}</h2>
</div>
{hook h='displayHome' mod='blockbestsellers'}
{hook h='displayHome' mod='blockbestsellers' limit=5}
<div class="col-md-6 hidden-sm hidden-xs">
<div class="pub">

View File

@ -0,0 +1,8 @@
<h2>{l s='Produits les plus populaires' mod='blockbestsellers'}</h2>
{if isset($best_sellers) && $best_sellers}
{include file="$tpl_dir./product-list-blocs.tpl" products=$best_sellers class='blockbestsellers tab-pane' id='blockbestsellers' position=2 position_sm=4}
{else}
<ul id="blockbestsellers" class="blockbestsellers tab-pane">
<li class="alert alert-info">{l s='No best sellers at this time.' mod='blockbestsellers'}</li>
</ul>
{/if}