Modif dans le calcul du code promo
This commit is contained in:
@@ -92,18 +92,23 @@
|
|||||||
{$errorStock="TRUE"}
|
{$errorStock="TRUE"}
|
||||||
<dd>{intl l="Out of Stock"}</dd>
|
<dd>{intl l="Out of Stock"}</dd>
|
||||||
{/if}
|
{/if}
|
||||||
<!-- TheCoreDev : pas besoin
|
<!-- TheCoreDev : pas besoin de la référence
|
||||||
<dt class="refView">{intl l="No."}</dt>
|
<dt class="refView">{intl l="No."}</dt>
|
||||||
<dd>{$REF}</dd>//-->
|
<dd>{$REF}</dd>//-->
|
||||||
|
|
||||||
|
<!-- TheCoreDev : calcul du nombre de pots de chaque taille //-->
|
||||||
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID" order="manual"}
|
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID" order="manual"}
|
||||||
<dt class="attributeView">{$ATTRIBUTE_TITLE}</dt>
|
<dt class="attributeView">{$ATTRIBUTE_TITLE}</dt>
|
||||||
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
|
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
|
||||||
|
|
||||||
<!-- TheCoreDev : on compte le nb de pots pour savoir si l'offre de réduc 3 pots est applicable //-->
|
<!-- TheCoreDev : on compte le nb de pots pour savoir si l'offre de réduc 3 pots est applicable //-->
|
||||||
{if $ATTRIBUTE_AVAILABILITY_ID == 6}
|
{if $ATTRIBUTE_AVAILABILITY_TITLE|strstr:"106"}
|
||||||
|
{$nb_pots_taille_S = $nb_pots_taille_S + $QUANTITY}
|
||||||
|
{/if}
|
||||||
|
{if $ATTRIBUTE_AVAILABILITY_TITLE|strstr:"228"}
|
||||||
{$nb_pots_taille_M = $nb_pots_taille_M + $QUANTITY}
|
{$nb_pots_taille_M = $nb_pots_taille_M + $QUANTITY}
|
||||||
{/if}
|
{/if}
|
||||||
{if $ATTRIBUTE_AVAILABILITY_ID == 11}
|
{if $ATTRIBUTE_AVAILABILITY_TITLE|strstr:"385"}
|
||||||
{$nb_pots_taille_L = $nb_pots_taille_L + $QUANTITY}
|
{$nb_pots_taille_L = $nb_pots_taille_L + $QUANTITY}
|
||||||
{/if}
|
{/if}
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -217,28 +222,35 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label class="control-label sr-only" for="code">{intl l='Code :'}</label>
|
<label class="control-label sr-only" for="code">{intl l='Code :'}</label>
|
||||||
|
|
||||||
<!-- TheCoreDev : Application automatique d'un code promo //-->
|
<!-- TheCoreDev : Application d'un éventuel code promo //-->
|
||||||
{$promo_totale = 0}
|
{assign var=promo_totale value=0}
|
||||||
{if $nb_pots_taille_M >= 3}
|
{if $nb_pots_taille_S >= 3}
|
||||||
{$promo_totale = 1.5}
|
{$promo_totale = 1.5}
|
||||||
{if $nb_pots_taille_M >= 6}
|
{if $nb_pots_taille_S >= 6}
|
||||||
{$promo_totale = 2}
|
{$promo_totale = 2}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
{if $nb_pots_taille_M >= 3}
|
||||||
|
{$promo_totale = $promo_totale + 2}
|
||||||
|
{if $nb_pots_taille_M >= 6}
|
||||||
|
{$promo_totale = $promo_totale + 4}
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
{if $nb_pots_taille_L >= 3}
|
{if $nb_pots_taille_L >= 3}
|
||||||
|
{$promo_totale = $promo_totale + 2}
|
||||||
{if $nb_pots_taille_L >= 6}
|
{if $nb_pots_taille_L >= 6}
|
||||||
{$promo_totale = $promo_totale + 4}
|
{$promo_totale = $promo_totale + 4}
|
||||||
{else}
|
|
||||||
{$promo_totale = $promo_totale + 2}
|
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $promo_totale = 1.5}
|
{if $promo_totale > 0}
|
||||||
{$code_promo="PROMO_1.5"}
|
{if $promo_totale > 2}
|
||||||
{elseif $promo_totale = 2}
|
{$code_promo="PROMO_4"}
|
||||||
{$code_promo="PROMO_2"}
|
{else}
|
||||||
{elseif $promo_totale > 2}
|
{$code_promo="PROMO_"|cat:$promo_totale}
|
||||||
{$code_promo="PROMO_4"}
|
{/if}
|
||||||
|
{else}
|
||||||
|
{$code_promo=""}
|
||||||
{/if}
|
{/if}
|
||||||
<input id="coupon" class="form-control" type="text" name="{$name}" value="{$code_promo}" placeholder="{intl l='Coupon code'}" required readonly>
|
<input id="coupon" class="form-control" type="text" name="{$name}" value="{$code_promo}" placeholder="{intl l='Coupon code'}" required readonly>
|
||||||
|
|
||||||
|
|||||||
10
templates/frontOffice/hooktest/composer.json
Normal file
10
templates/frontOffice/hooktest/composer.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "thelia/hooktest-template",
|
||||||
|
"type": "thelia-frontoffice-template",
|
||||||
|
"require": {
|
||||||
|
"thelia/installer": "~1.1"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "hooktest"
|
||||||
|
}
|
||||||
|
}
|
||||||
110
templates/frontOffice/hooktest/includes/single-product.html
Normal file
110
templates/frontOffice/hooktest/includes/single-product.html
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<li class="item">
|
||||||
|
{if $PSE_COUNT > 1}
|
||||||
|
{assign var="hasSubmit" value = false}
|
||||||
|
{else}
|
||||||
|
{assign var="hasSubmit" value = true}
|
||||||
|
{/if}
|
||||||
|
{assign var="productTitle" value="{$TITLE}"}
|
||||||
|
{if not $product_id}
|
||||||
|
{assign var="product_id" value=$ID}
|
||||||
|
{/if}
|
||||||
|
<article itemscope itemtype="http://schema.org/Product">
|
||||||
|
|
||||||
|
{hook name="singleproduct.top" product="{$product_id}"}
|
||||||
|
|
||||||
|
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image{if $hasQuickView == true} product-quickview{/if}">
|
||||||
|
{loop name="product_thumbnail" type="image" product=$product_id width="{$width}" height="{$height}" resize_mode="borders" limit="1"}
|
||||||
|
<img itemprop="image" src="{$IMAGE_URL}" alt="{$productTitle}">
|
||||||
|
{/loop}
|
||||||
|
{elseloop rel="product_thumbnail"}
|
||||||
|
{images file='../assets/img/218x146.png'}<img itemprop="image" src="{$asset_url}" alt="{$productTitle}">{/images}
|
||||||
|
{/elseloop}
|
||||||
|
<span class="mask"></span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="product-info">
|
||||||
|
<h2 class="name"><a href="{$URL}"><span itemprop="name">{$productTitle}</span></a></h2>
|
||||||
|
{if $hasDescription}
|
||||||
|
<div class="description" itemprop="description">
|
||||||
|
<p>{$DESCRIPTION nofilter}</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{* Stock *}
|
||||||
|
{assign var="current_stock_content" value = "in_stock"}
|
||||||
|
{assign var="current_stock_href" value = "http://schema.org/InStock"}
|
||||||
|
{if {config key="check-available-stock"} != 0}
|
||||||
|
{if $QUANTITY == 0}
|
||||||
|
{assign var="current_stock_content" value = "out_stock"}
|
||||||
|
{assign var="current_stock_href" value = "http://schema.org/OutOfStock"}
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="product-price">
|
||||||
|
<div class="price-container" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
||||||
|
<meta itemprop="category" content="{category attr="title"}">
|
||||||
|
{* List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition *}
|
||||||
|
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition">
|
||||||
|
{* List of currency : The currency used to describe the product price, in three-letter ISO format. *}
|
||||||
|
<meta itemprop="priceCurrency" content="{currency attr="symbol"}">
|
||||||
|
<link itemprop="availability" href="{$current_stock_href}" content="{$current_stock_content}" />
|
||||||
|
{if $IS_PROMO }
|
||||||
|
<span class="special-price"><span itemprop="price" class="price-label">{intl l="Special Price:"} </span><span class="price">{format_number number=$TAXED_PROMO_PRICE} {currency attr="symbol"}</span></span>
|
||||||
|
<span class="old-price"><span class="price-label">{intl l="Regular Price:"} </span><span class="price">{format_number number=$TAXED_PRICE} {currency attr="symbol"}</span></span>
|
||||||
|
{else}
|
||||||
|
<span class="regular-price"><span itemprop="price" class="price">{format_number number=$BEST_TAXED_PRICE} {currency attr="symbol"}</span></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{if $hasBtn == true}
|
||||||
|
{if $hasSubmit == true}
|
||||||
|
{form name="thelia.cart.add" }
|
||||||
|
<form id="form-product-details{$product_id}" action="{url path="/cart/add" }" method="post" class="form-product">
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
<input type="hidden" name="view" value="product">
|
||||||
|
<input type="hidden" name="product_id" value="{$product_id}">
|
||||||
|
|
||||||
|
{if $form_error}<div class="alert alert-error">{$form_error_message}</div>{/if}
|
||||||
|
|
||||||
|
{form_field form=$form field='product_sale_elements_id'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$PRODUCT_SALE_ELEMENT}" {$attr}>
|
||||||
|
{/form_field}
|
||||||
|
{form_field form=$form field="product"}
|
||||||
|
<input id="{$label_attr.for}" type="hidden" name="{$name}" value="{$product_id}" {$attr} >
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
<fieldset class="product-cart form-inline">
|
||||||
|
{form_field form=$form field='quantity'}
|
||||||
|
<div class="form-group group-qty hide {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label for="{$label_attr.for}">{$label}</label>
|
||||||
|
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="0" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
<div>
|
||||||
|
<div class="product-btn">
|
||||||
|
<button type="submit" class="btn btn-cart">{intl l="Add to cart"}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
{/form}
|
||||||
|
{else}
|
||||||
|
<div>
|
||||||
|
<div class="product-btn">
|
||||||
|
<a href="{$URL}" class="btn btn-cart">{intl l="View product"}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{hook name="singleproduct.bottom" product="{$product_id}"}
|
||||||
|
|
||||||
|
</article><!-- /product -->
|
||||||
|
</li>
|
||||||
24
templates/frontOffice/hooktest/index.html
Normal file
24
templates/frontOffice/hooktest/index.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{extends file="layout.tpl"}
|
||||||
|
|
||||||
|
{block name="main-content"}
|
||||||
|
|
||||||
|
{ifhook rel="home.body"}
|
||||||
|
{hook name="home.body"}
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="home.body"}
|
||||||
|
::NO home.body::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="stylesheet"}
|
||||||
|
{hook name="home.stylesheet"}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="after-javascript-include"}
|
||||||
|
{hook name="home.after-javascript-include"}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="javascript-initialization"}
|
||||||
|
{hook name="home.javascript-initialization"}
|
||||||
|
{/block}
|
||||||
110
templates/frontOffice/hooktest/layout.tpl
Normal file
110
templates/frontOffice/hooktest/layout.tpl
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<!--
|
||||||
|
______ __ __ ______ __ __ ______
|
||||||
|
/\__ _\ /\ \_\ \ /\ ___\ /\ \ /\ \ /\ __ \
|
||||||
|
\/_/\ \/ \ \ __ \ \ \ __\ \ \ \____ \ \ \ \ \ __ \
|
||||||
|
\ \_\ \ \_\ \_\ \ \_____\ \ \_____\ \ \_\ \ \_\ \_\
|
||||||
|
\/_/ \/_/\/_/ \/_____/ \/_____/ \/_/ \/_/\/_/
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (c) OpenStudio
|
||||||
|
email : info@thelia.net
|
||||||
|
web : http://www.thelia.net
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the
|
||||||
|
GNU General Public License : http://www.gnu.org/licenses/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
TEMPLATE-TEST-HOOK
|
||||||
|
-->
|
||||||
|
|
||||||
|
{* Declare assets directory, relative to template base directory *}
|
||||||
|
{declare_assets directory='assets'}
|
||||||
|
|
||||||
|
{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
|
||||||
|
{default_translation_domain domain='fo.default'}
|
||||||
|
|
||||||
|
{hook name="main.head-top"}
|
||||||
|
|
||||||
|
{hook name="main.stylesheet"}
|
||||||
|
|
||||||
|
{hook name="main.body-top"}
|
||||||
|
|
||||||
|
{hook name="main.header-top"}
|
||||||
|
|
||||||
|
{hook name="main.navbar-secondary"}
|
||||||
|
{ifhook rel="main.navbar-secondary"}
|
||||||
|
::main.navbar-secondary ifhook::
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="main.navbar-secondary"}
|
||||||
|
::main.navbar-secondary elsehook::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{hook name="main.navbar-primary"}
|
||||||
|
{ifhook rel="main.navbar-primary"}
|
||||||
|
::main.navbar-primary ifhook::
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="main.navbar-primary"}
|
||||||
|
::main.navbar-primary elsehook::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{hook name="main.header-bottom"}
|
||||||
|
|
||||||
|
{hook name="main.content-top"}
|
||||||
|
|
||||||
|
|
||||||
|
{block name="main-content"}{/block}
|
||||||
|
|
||||||
|
|
||||||
|
{hook name="main.content-bottom"}
|
||||||
|
|
||||||
|
{ifhook rel="main.footer-top"}
|
||||||
|
{hook name="main.footer-top"}
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="main.footer-top"}
|
||||||
|
::NO main.footer-top::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{ifhook rel="product.additional"}
|
||||||
|
{hookblock name="product.additional"}
|
||||||
|
{forhook rel="product.additional"}
|
||||||
|
::product.additional ifhook::
|
||||||
|
{/forhook}
|
||||||
|
{/hookblock}
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="product.additional"}
|
||||||
|
::product.additional elsehook::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ifhook rel="main.footer-body"}
|
||||||
|
::main.footer-body ifhook::
|
||||||
|
{hookblock name="main.footer-body"}
|
||||||
|
{forhook rel="main.footer-body"}
|
||||||
|
::main.footer-body {$id} {$class} {$content}::
|
||||||
|
{/forhook}
|
||||||
|
{/hookblock}
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="main.footer-body"}
|
||||||
|
::main.footer-body elsehook::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{ifhook rel="main.footer-bottom"}
|
||||||
|
{hook name="main.footer-bottom"}
|
||||||
|
{/ifhook}
|
||||||
|
{elsehook rel="main.footer-bottom"}
|
||||||
|
::NO main.footer-bottom::
|
||||||
|
{/elsehook}
|
||||||
|
|
||||||
|
{hook name="main.after-javascript-include"}
|
||||||
|
|
||||||
|
{block name="after-javascript-include"}{/block}
|
||||||
|
|
||||||
|
{hook name="main.javascript-initialization"}
|
||||||
|
|
||||||
|
{block name="javascript-initialization"}{/block}
|
||||||
|
|
||||||
|
{hook name="main.body-bottom"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/* style3 in template/hooktest */
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
:: file override3 from template/hooktest ::
|
||||||
Reference in New Issue
Block a user