This commit is contained in:
Romuald 2016-07-20 11:20:33 +02:00
parent 6c7a4b5a5f
commit 259d98f972
9 changed files with 164 additions and 17 deletions

View File

@ -1895,6 +1895,7 @@ class CartCore extends ObjectModel
} }
unset($product); unset($product);
// Step 3 : grouped product from grouped_by_warehouse by available carriers // Step 3 : grouped product from grouped_by_warehouse by available carriers
$grouped_by_carriers = array(); $grouped_by_carriers = array();
foreach ($grouped_by_warehouse as $id_address_delivery => $products_in_stock_list) { foreach ($grouped_by_warehouse as $id_address_delivery => $products_in_stock_list) {
@ -1929,6 +1930,7 @@ class CartCore extends ObjectModel
} }
} }
$package_list = array(); $package_list = array();
// Step 4 : merge product from grouped_by_carriers into $package to minimize the number of package // Step 4 : merge product from grouped_by_carriers into $package to minimize the number of package
foreach ($grouped_by_carriers as $id_address_delivery => $products_in_stock_list) { foreach ($grouped_by_carriers as $id_address_delivery => $products_in_stock_list) {
@ -1983,6 +1985,7 @@ class CartCore extends ObjectModel
} }
} }
// Step 5 : Reduce depth of $package_list // Step 5 : Reduce depth of $package_list
$final_package_list = array(); $final_package_list = array();
foreach ($package_list as $id_address_delivery => $products_in_stock_list) { foreach ($package_list as $id_address_delivery => $products_in_stock_list) {

View File

@ -22,7 +22,7 @@
* @copyright 2007-2015 PrestaShop SA * @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
require(dirname(__FILE__).'/config/config.inc.php'); require(dirname(__FILE__).'/config/config.inc.php');
Dispatcher::getInstance()->dispatch(); Dispatcher::getInstance()->dispatch();

View File

@ -101,14 +101,14 @@ class AdvMenu extends Module
{ {
if(Context::getContext()->controller instanceOf IndexController) if(Context::getContext()->controller instanceOf IndexController)
{ {
if (!$this->isCached('advmenu.tpl', $this->getCacheId())) { if (!$this->isCached('advmenu.tpl', $this->getCacheId('advmenu_'.$params['isCms']))) {
$menuLinks = AdvMenuLink::getMenu(); $menuLinks = AdvMenuLink::getMenu();
if (!$menuLinks) { if (!$menuLinks) {
return false; return false;
} }
$this->smarty->assign('menuLinks', $menuLinks); $this->smarty->assign('menuLinks', $menuLinks);
} }
return $this->display(__FILE__, 'advmenu.tpl', $this->getCacheId()); return $this->display(__FILE__, 'advmenu.tpl', $this->getCacheId('advmenu_'.$params['isCms']));
} }
else else
{ {
@ -118,18 +118,19 @@ class AdvMenu extends Module
} }
} }
public function loadMenu() public function loadMenu($isCms)
{ {
if (!$this->isCached('advmenu.tpl', $this->getCacheId())) { $this->smarty->assign('isCms', (int) $isCms);
if (!$this->isCached('advmenu.tpl', $this->getCacheId('advmenu_'.$isCms))) {
$menuLinks = AdvMenuLink::getMenu(); $menuLinks = AdvMenuLink::getMenu();
if (!$menuLinks) { if (!$menuLinks) {
return false; return false;
} }
$this->smarty->assign('menuLinks', $menuLinks); $this->smarty->assign('menuLinks', $menuLinks);
} }
return $this->display(__FILE__, 'advmenu.tpl', $this->getCacheId()); return $this->display(__FILE__, 'advmenu.tpl', $this->getCacheId('advmenu_'.$isCms));
} }
public function hookHeader($params) public function hookHeader($params)
{ {
$this->context->controller->addJS($this->_path.'js/advmenu.js'); $this->context->controller->addJS($this->_path.'js/advmenu.js');

View File

@ -4,5 +4,5 @@ require dirname(dirname(__FILE__)).'/../init.php';
require dirname(__FILE__).'/advmenu.php'; require dirname(__FILE__).'/advmenu.php';
$module = new AdvMenu(); $module = new AdvMenu();
echo $module->loadMenu(); echo $module->loadMenu(Tools::getValue('isCms'));
die; die;

View File

@ -1,6 +1,10 @@
<?php <?php
class AdvMenuLink extends ObjectModel { class AdvMenuLink extends ObjectModel
{
const ID_CMS = 337;
const ID_BOUTIQUE = 9;
public $id_link; public $id_link;
public $id_parent; public $id_parent;
@ -86,19 +90,28 @@ class AdvMenuLink extends ObjectModel {
public static function getMenu() public static function getMenu()
{ {
$context = Context::getContext(); $context = Context::getContext();
$menuLinks = self::getLinks(0, $context); $menuLinks = self::getLinks(0, $context);
foreach($menuLinks as $i => $link) foreach($menuLinks as $i => $link)
{ {
;
$menuLinks[$i]['children'] = self::getLinks($link['id_link'], $context); $menuLinks[$i]['children'] = self::getLinks($link['id_link'], $context);
$menuLinks[$i]['nbChildren'] = count($menuLinks[$i]['children']); $menuLinks[$i]['nbChildren'] = count($menuLinks[$i]['children']);
$menuLinks[$i]['ctaImgExist'] = $menuLinks[$i]['nbChildren'] < 5 && file_exists(_PS_IMG_DIR_ . 'menu/' . $link['id_link'] . '.jpg'); $menuLinks[$i]['ctaImgExist'] = $menuLinks[$i]['nbChildren'] < 5 && file_exists(_PS_IMG_DIR_ . 'menu/' . $link['id_link'] . '.jpg');
foreach($menuLinks[$i]['children'] as $y => $children) if($menuLinks[$i]['children'])
{ {
$menuLinks[$i]['children'][$y]['children'] = self::getLinks($children['id_link'], $context); foreach($menuLinks[$i]['children'] as $y => $children)
{
$menuLinks[$i]['children'][$y]['children'] = self::getLinks($children['id_link'], $context);
if($menuLinks[$i]['children'][$y]['children'])
{
foreach($menuLinks[$i]['children'][$y]['children'] as $z => $subchildren)
{
$menuLinks[$i]['children'][$y]['children'][$z]['children'] = self::getLinks($subchildren['id_link'], $context);
}
}
}
} }
} }

View File

@ -6,7 +6,7 @@
</div> </div>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<img class="logo" src="{$base_dir|strval}img/payments/logo-cb.png" alt=""/> <img class="logo" src="{$base_dir_ssl|strval}img/payments/logo-cb.png" alt=""/>
</div> </div>
<div class="col-xs-7"> <div class="col-xs-7">
{l s='Payer par carte bancaire' mod='atos'} {l s='Payer par carte bancaire' mod='atos'}

View File

@ -1,12 +1,13 @@
<h2>{l s='Tous nos produits' mod='categorieshome'}</h2> <h2>{l s='Toutes nos rubriques' mod='categorieshome'}</h2>
<div class="row"> <div class="row">
{foreach from=$categories item=category name=category_index} {foreach from=$categories item=category name=category_index}
<div class="col-md-3 col-sm-4 col-xs-6 col-xxs-12 category"> <div class="col-md-3 col-sm-4 col-xs-6 col-xxs-12 category">
<p class="title"><a href="{$link->getCategoryLink($category)}">{$category->name}</a> <span>({$category->nbProducts})</span></p>
<a href="{$link->getCategoryLink($category)}"> <a href="{$link->getCategoryLink($category)}">
<img src="/img/c/{$category->id}-0_thumb.jpg" alt="{$category->name}" class="img-responsive"> <img src="/img/c/{$category->id}-0_thumb.jpg" alt="{$category->name}" class="img-responsive">
</a> </a>
<p class="title"><a href="{$link->getCategoryLink($category)}">{$category->name}</a> <span>({$category->nbProducts})</span></p>
</div> </div>
{/foreach} {/foreach}
</div> </div>

View File

@ -10,7 +10,7 @@
</div> </div>
<div class="layer_cart_cart col-xs-12 col-md-12"> <div class="layer_cart_cart col-xs-12 col-md-12">
<div class="button-container"> <div class="button-container">
<span class="continue link left" title="{l s='Continue reading' mod='cms_pack'}"> <span class="continue btn btn2 left" title="{l s='Continue reading' mod='cms_pack'}">
<i class="icon"></i>{l s='Continue reading' mod='cms_pack'} <i class="icon"></i>{l s='Continue reading' mod='cms_pack'}
</span> </span>
<a class="btn" href="{$link->getPageLink('order')}" title="{l s='Proceed to checkout' mod='cms_pack'}" rel="nofollow"> <a class="btn" href="{$link->getPageLink('order')}" title="{l s='Proceed to checkout' mod='cms_pack'}" rel="nofollow">

View File

@ -0,0 +1,129 @@
<div id="special_block_right" class="block products_block exclusive blockspecials productAccessories">
<div class="block_content">
<div class="products clearfix">
<h4 class="title">{l s='Nos suggestions pour compléter votre panier' mod='productaccessories'}</h4>
<div class="product_list">
<ul class="row grid">
{for $i=0 to ($showAccessories|@count-1)}
{if ($showAccessories[$i]!=null)}
{assign var='showAccessory' value=$showAccessories[$i]}
{assign var=percentReduction value=0}
{if isset($showAccessory['price_without_reduction']) && isset($showAccessory['price']) && $showAccessory['price']!= round($showAccessory['price_without_reduction'], 2)}
{math equation="round(100 - (price * 100 / price_without_reduction))" price=$showAccessory['price'] price_without_reduction=$showAccessory['price_without_reduction'] assign=percentReduction}
{/if}
<li class="col-xxs-12 col-xs-4 col-md-4 product-ctn">
{if $percentReduction != 0}
<span class="price-percent-reduction">
<span>-{$percentReduction}<sup>%</sup></span>
</span>
{/if}
<div class="row">
<div class="wrapImg col-sm-4">
<a href="{$showAccessory['link']}" class="content_img product_img_link product-img">
<img src="{$showAccessory['image_url']}"/>
</a>
</div>
<div class="product-infos col-sm-8">
<h5 class="product-name">
<a href="{$showAccessory['link']}" title="{$showAccessory['product']->name}">{$showAccessory['product']->name|truncate:60}</a>
</h5>
<div class="featureConditioning">
{foreach from=$showAccessory['features'] item='feature' name='feature'}
{if $feature.id_feature == 8}
{$feature.name} : <span class="value">{$feature.value}</span>
{/if}
{/foreach}
</div>
{if ((isset($showAccessory['product']->show_price) && $showAccessory['product']->show_price) || (isset($showAccessory['product']->available_for_order) && $showAccessory['product']->available_for_order))}
<div class="avail clearfix">
{if isset($showAccessory['product']->available_for_order) && $showAccessory['product']->available_for_order && !isset($restricted_country_mode)}
<div class="inner">
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
<link itemprop="price" content="{$product.price_without_reduction|number_format:2}">
{if (isset($showAccessory['allow_oosp']) && $showAccessory['allow_oosp'] || $showAccessory['quantity'] > 0)}
<link itemprop="availability" href="http://schema.org/InStock" />
<span>
{if $showAccessory['quantity'] <= 0}
{if $showAccessory['allow_oosp']}
{if isset($showAccessory['product']->available_later) && $showAccessory['product']->available_later}
<span class="label-warning rose valign-bottom"><i class="icon-logistics3"></i><span>{l s='En réassort'}</span></span>
<span class="shipping">{$showAccessory['product']->available_later}</span>
{else}
<span class="label-warning rose valign-bottom"><i class="icon-logistics3"></i><span>{l s='En réassort'}</span></span>
<span class="shipping">Expédition sous 15 jours</span>
{/if}
{/if}
{else}
<span class="label-success valign-bottom"><i class="icon-logistics3"></i><span>{l s='En stock'}</span></span>
<span class="shipping">Expédition sous 48h</span>
{/if}
{elseif (isset($showAccessory['product']->quantity_all_versions) && $showAccessory['product']->quantity_all_versions > 0)}
</span>
{elseif (isset($showAccessory['product']->quantity_all_versions) && $showAccessory['product']->quantity_all_versions > 0)}
<link itemprop="availability" href="http://schema.org/LimitedAvailability" />
{l s='Product available with different options'}
{else}
<link itemprop="availability" href="http://schema.org/OutOfStock" />
<span class="label-warning">{l s='Out of stock'}</span>
{/if}
</span>
</div>
{/if}
</div>
{/if}
</div>
<div class="col-md-12 clearfix"><hr/></div>
<div class="product-actions col-sm-12">
<div class="row">
<div class="priceWrap col-md-5 col-sm-12">
<div class="product-price">
{if isset($percentReduction) && $percentReduction > 0}
<span class="old-price product-price">
{l s='au lieu de'} <span class="barre">{displayPrice price=$showAccessory['price_without_reduction']}</span>
</span>
{/if}
<span class="price">{displayPrice price=$showAccessory['price']}</span>
</div>
</div>
<div class="btnWrap col-md-7 col-sm-12">
{if ($showAccessory['product']->id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $showAccessory['product']->available_for_order AND !isset($restricted_country_mode) AND $showAccessory['product']->minimal_quantity == 1 AND $showAccessory['product']->customizable != 2}
{if ($showAccessory['quantity'] > 0 OR $showAccessory['product']->allow_oosp)}
<p id="add_to_cart" class="buttons_bottom_block no-print cart_block_product_accessories" data-id-product="{$showAccessory['id_product']}">
<button type="submit" name="Submit" class="exclusive btn btn-cart">
<span><i class="icon icon-shopping-cart"></i>{l s='Ajouter au panier' mod='productaccessories'}</span>
</button>
</p>
{/if}
{else}
<div style="height:21px;"></div>
{/if}
</div>
</div>
</div>
</div>
</li>
{/if}
{/for}
</ul>
</div>
</div>
</div>
</div>