fix isset

This commit is contained in:
Romuald 2016-07-20 10:14:12 +02:00
parent c6c1755af7
commit 6ca84bd2e0
2 changed files with 125 additions and 127 deletions

View File

@ -100,9 +100,7 @@ class ProductAccessories extends Module
}
if(isset($showAccessories)) {
$context->smarty->assign(array('enable' => 1, 'label' => $label, 'showAccessories' => $showAccessories));
} else {
$context->smarty->assign(array('enable' => 0));
$context->smarty->assign(array('label' => $label, 'showAccessories' => $showAccessories));
}
}

View File

@ -1,130 +1,130 @@
{if !empty($showAccessories)}
<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)}
<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 ($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}
<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}
<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>
<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 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>
</div>
</li>
{/if}
{/for}
</ul>
</div>
</li>
{/if}
{/for}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/if}