ClickAndCollect : module finalisé

This commit is contained in:
2021-03-16 11:22:27 +01:00
parent 27d98adf28
commit 2ad54772ff
16 changed files with 156 additions and 531 deletions

View File

@@ -25,7 +25,7 @@
<tr>
<td style="text-align: center"><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
<td>
{format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"}
{format_date date=$START_DATE format="d/m/Y"}
</td>
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-right: 10px; width:25px">{$DELTA} jour(s)</td>
<td>{$PLACE}</td>

View File

@@ -41,14 +41,14 @@
{else}
<table class="table table-schedule">
{assign var="nextDate" value=""}
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID}}
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID} click_and_collect=1}
<tr class="creneau">
<td>{$DAY_LABEL}</td>
<td>{format_date date=$BEGIN format="H\hi"}</td>
<td>{format_date date=$END format="H\hi"}</td>
</tr>
{if $nextDate eq ''}
{assign var="nextDate" value="$DAY_LABEL $CALCULATED_DAY"}
{assign var="nextDate" value="$CALCULATED_DAY"}
{/if}
{/loop}
</table>
@@ -127,7 +127,8 @@
}
};
DataCnc.map = new google.maps.Map(document.getElementById('cnc_map'), opt);
if (document.getElementById('cnc_map'))
DataCnc.map = new google.maps.Map(document.getElementById('cnc_map'), opt);
displayPinsCnc();
}

View File

@@ -54,12 +54,12 @@ class LivraisonParSecteurs extends AbstractDeliveryModule
$zipcode = AddressQuery::create()->filterById($currentAddressId)->findOne($con)->getZipcode();
// Condition 1 : le client doit être situé dans un secteur couvert par la livraison à domicile.
if (null !== $areaId = LpsAreaCityQuery::create()->filterByZipcode($zipcode)->findOne($con))
if (null !== $areaId = LpsAreaCityQuery::create()->filterByZipcode($zipcode)->findOne($con)->getIdArea())
{
$area = LpsAreaQuery::create()->findOneById($areaId);
// Condition 2 : le secteur doit être actif à date.
if ($area->getActive() === self::SECTEUR_ACTIF)
if (null !== $area && $area->getActive() === self::SECTEUR_ACTIF)
$isValid = true;
}
}

View File

@@ -19,7 +19,6 @@
<div class="scheduled-deliveries-list">
<table class="table table-striped" id="deliveries-table">
<thead>
<th>&nbsp;</th>
<th>{intl l="Order number" d="livraisonparsecteurs"}</th>
<th>{intl l="Scheduled date" d="livraisonparsecteurs"}</th>
<th>{intl l="Delivery delay" d="livraisonparsecteurs"}</th>
@@ -43,12 +42,11 @@
{assign var=title value="{$DELTA} jour(s) de délai"}
<tr>
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-left: 30px; width:25px"></td>
<td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
<td>
{format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"}
</td>
<td>{$DELTA} jour(s)</td>
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-right:15px; width:25px">{$DELTA} jour(s)</td>
<td>{$CITY}</td>
<td>{$AREA}</td>
</tr>

View File

@@ -98,6 +98,13 @@
alert("Veuillez choisir un point de retrait.");
ev.preventDefault();
}
if ($('[delivery-mode=cnc]').is(':checked')
&&
$('input[name=cnc-choosen-day]:checked').length === 0) {
alert("Veuillez choisir un point Click and Collect.");
ev.preventDefault();
}
});

View File

@@ -103,12 +103,11 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface
$sessionData->setPlaceId($placeId);
// On sauvegarde la date de disponibilité, pour affichage ultérieur.
$now = new DateTime();
$today = $now->format('w');
$chosenDate = PlanificationLivraison::calculateRelativeDate($today);
$completeDay = PlanificationLivraison::getDayLabel($today);
$chosenDate = PlanificationLivraison::calculateRelativeDate(null, $placeId);
$completeDay = PlanificationLivraison::getDayLabel(($chosenDate->format('w') - 1) % 6);
$completeDay .= " " . $chosenDate->format(PlanificationLivraison::FORMAT_DATES);
$sessionData->setDeliveryDate($completeDay);
$sessionData->setDeliveryFullDate($chosenDate->format(PlanificationLivraison::FORMAT_DATE_COMPLETE));
$session->set('cncData', $sessionData);
}
@@ -169,12 +168,20 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface
$schedule = PdrScheduleQuery::create()->findOneById($scheduleId);
}
$chosenDate = PlanificationLivraison::calculateRelativeDate($schedule->getDay());
$format = PlanificationLivraison::FORMAT_DATE_COMPLETE;
$startDate = DateTime::createFromFormat($format, $chosenDate->format('Y-m-d ') . $schedule->getBeginTime()->format('H:i:s'));
$query->setDueDeliveryTimeStart($startDate);
$endDate = DateTime::createFromFormat($format, $chosenDate->format('Y-m-d ') . $schedule->getEndTime()->format('H:i:s'));
$query->setDueDeliveryTimeEnd($endDate);
if ($deliveryModuleId == ClickAndCollect::getModuleId()) {
$completeDate = $sessionData->getDeliveryFullDate();
$query->setDueDeliveryTimeStart($completeDate);
$query->setDueDeliveryTimeEnd($completeDate);
}
else {
$chosenDate = PlanificationLivraison::calculateRelativeDate($schedule->getDay());
$format = PlanificationLivraison::FORMAT_DATE_COMPLETE;
$startDate = DateTime::createFromFormat($format, $chosenDate->format('Y-m-d ') . $schedule->getBeginTime()->format('H:i:s'));
$query->setDueDeliveryTimeStart($startDate);
$endDate = DateTime::createFromFormat($format, $chosenDate->format('Y-m-d ') . $schedule->getEndTime()->format('H:i:s'));
$query->setDueDeliveryTimeEnd($endDate);
}
$query->save($con);
$con->commit();

View File

@@ -10,7 +10,8 @@ return array(
'Help for orange alert' => 'Si le délai entre la date du jour et la date de livraison/retrait prévue est inférieur à ce nombre de jours, la commande apparaitra comme URGENTE dans votre tableau de bord',
'Help for preparation delay' => 'Délai incompressible entre la commande client et la possibilité de livraison/retrait (achats des produits, préparation, ...)',
'Save' => 'Enregistrer',
'Warning withdrawal date' => 'N\'oubliez pas de venir retirer votre commande le %date entre %heure_debut et %heure_fin',
'Warning withdrawal date' => 'Vous pourrez récupérer votre commande à compter du %date.',
'Warning withdrawal date complete' => 'N\'oubliez pas de venir retirer votre commande le %date entre %heure_debut et %heure_fin',
'Monday' => 'Lundi',
'Tuesday' => 'Mardi',
'Wednesday' => 'Mercredi',

View File

@@ -117,10 +117,10 @@ class ScheduledDeliveriesLoop extends BaseLoop implements PropelSearchLoopInterf
$deliveries->filterByDeliveryAddressId(null, Criteria::NOT_EQUAL);
break;
case self::RETRAIT:
$deliveries->filterByDeliveryPlaceId(null, Criteria::NOT_EQUAL)->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::NOT_IN);
$deliveries->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::IN);
break;
case self::CLICK_AND_COLLECT:
$deliveries->filterByDeliveryPlaceId(null, Criteria::NOT_EQUAL)->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::IN);
$deliveries->filterByDeliveryPlaceId($clickAndCollectPlaces, Criteria::NOT_IN);
break;
default:
break;

View File

@@ -8,11 +8,29 @@ class SessionData
{
protected $scheduleId = null;
protected $deliveryDate = null;
protected $deliveryFullDate = null;
protected $deliveryStartTime = null;
protected $deliveryEndTime = null;
protected $deliveryAddressId = null;
protected $placeId = null;
/**
* @return null
*/
public function getDeliveryFullDate()
{
return $this->deliveryFullDate;
}
/**
* @param null $deliveryFullDate
*/
public function setDeliveryFullDate($deliveryFullDate)
{
$this->deliveryFullDate = $deliveryFullDate;
}
/**
* @return null
*/

View File

@@ -3,6 +3,8 @@
namespace PlanificationLivraison;
use DateInterval;
use DateTime;
use PointRetrait\Model\PdrScheduleQuery;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Install\Database;
@@ -13,7 +15,17 @@ class PlanificationLivraison extends BaseModule
/** @var string */
const DOMAIN_NAME = 'planificationlivraison';
const FORMAT_DATES = 'd/m/Y';
const FORMAT_DATE_AVEC_JOUR = 'w d/m/Y';
const FORMAT_DATE_COMPLETE = 'Y-m-d H:i:s';
const DAYS_OF_WEEK = [
0 => 'monday',
1 => 'tuesday',
2 => 'wednesday',
3 => 'thursday',
4 => 'friday',
5 => 'saturday',
6 => 'sunday'
];
const CONFIG_API_KEY = 'googlemap_api_key';
const CONFIG_MAP_CENTER_LAT = 'map_center_latitude';
@@ -32,36 +44,53 @@ class PlanificationLivraison extends BaseModule
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
}
static public function calculateRelativeDate($baseDay)
static public function calculateRelativeDate($baseDay, $placeId = null)
{
$minimumDelayBeforeOrder = PlanificationLivraison::getConfigValue(PlanificationLivraison::CONFIG_PREPARATION_DELAY, 0, "en_US");
$date = new \DateTime();
$date = new DateTime();
$date->add(new DateInterval('P'. $minimumDelayBeforeOrder . 'D'));
$nextPossibleDay = '';
switch ($baseDay) {
case 0 :
$nextPossibleDay = $date->modify('next monday');
break;
case 1 :
$nextPossibleDay = $date->modify('next tuesday');
break;
case 2 :
$nextPossibleDay = $date->modify('next wednesday');
break;
case 3 :
$nextPossibleDay = $date->modify('next thursday');
break;
case 4 :
$nextPossibleDay = $date->modify('next friday');
break;
case 5 :
$nextPossibleDay = $date->modify('next saturday');
break;
case 6 :
$nextPossibleDay = $date->modify('next sunday');
break;
if (null !== $baseDay) { // Cas où l'on a choisi une date
switch ($baseDay) {
case 0 :
$nextPossibleDay = $date->modify('next monday');
break;
case 1 :
$nextPossibleDay = $date->modify('next tuesday');
break;
case 2 :
$nextPossibleDay = $date->modify('next wednesday');
break;
case 3 :
$nextPossibleDay = $date->modify('next thursday');
break;
case 4 :
$nextPossibleDay = $date->modify('next friday');
break;
case 5 :
$nextPossibleDay = $date->modify('next saturday');
break;
case 6 :
$nextPossibleDay = $date->modify('next sunday');
break;
}
}
else {
// Cas du Click and Collect où l'on doit prendre la première date dispo
if (null !== $placeId) {
$allPossibleDaysOfWeek = PdrScheduleQuery::create()->filterByIdPlace($placeId)->orderByDay()->find()->getData();
$allPossibleDays = [];
foreach ($allPossibleDaysOfWeek as $theDay) {
$dow = self::DAYS_OF_WEEK[$theDay->getDay()];
array_push($allPossibleDays, date(self::FORMAT_DATE_COMPLETE, strtotime("next $dow", $date->getTimestamp())));
}
$nextPossibleDay = new DateTime(min($allPossibleDays));
}
}
return $nextPossibleDay;

View File

@@ -20,7 +20,7 @@ return array(
'Free' => 'Gratuit',
'Location set' => 'Coordonnées GPS présentes ?',
'Main' => 'Généralités',
'Message explicatif' => 'Il est possible de récupérer votre commande directement auprès de nous, lors d\'une de nos tournées.',
'Message explicatif' => 'Il est possible de récupérer votre commande directement auprès de nous, lors de notre prochaine tournée.',
'Message no location' => 'Ce point de retrait ne possède pas de coordonnées GPS : pour vos clients, il est conseillé de géolocaliser son adresse.',
'Message info minimum de commande' => 'Vous n\'avez pas atteint le minimum de commande de %minimum € sur ce point de retrait.',
'Minimum amount' => 'Minimum de commande',

View File

@@ -4,7 +4,6 @@ namespace PointRetrait\Loop;
use PlanificationLivraison\PlanificationLivraison;
use PointRetrait\Model\PdrScheduleQuery;
use PointRetrait\PointRetrait;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
@@ -31,8 +30,20 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
*/
public function parseResults(LoopResult $loopResult)
{
$theDate = '';
foreach ($loopResult->getResultDataCollection() as $pdr_schedule) {
if (null === $this->getClickAndCollect()) {
$theDate = PlanificationLivraison::calculateRelativeDate($pdr_schedule->getDay(), null);
}
else {
$newDate = PlanificationLivraison::calculateRelativeDate(null, $this->getPlaceId());
if ($theDate == '' || $newDate < $theDate)
$theDate = $newDate;
}
$loopResultRow = new LoopResultRow($pdr_schedule);
$loopResultRow
->set("ID", $pdr_schedule->getId())
@@ -41,7 +52,7 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
->set("DAY_LABEL", PlanificationLivraison::getDayLabel($pdr_schedule->getDay()))
->set("BEGIN", $pdr_schedule->getBeginTime())
->set("END", $pdr_schedule->getEndTime())
->set("CALCULATED_DAY", PlanificationLivraison::calculateRelativeDate($pdr_schedule->getDay())->format(PlanificationLivraison::FORMAT_DATES))
->set("CALCULATED_DAY", PlanificationLivraison::getDayLabel(($theDate->format('w') - 1) % 6) . ' ' . $theDate->format(PlanificationLivraison::FORMAT_DATES))
;
$loopResult->addRow($loopResultRow);
}
@@ -56,7 +67,8 @@ class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('place_id')
Argument::createIntListTypeArgument('place_id'),
Argument::createBooleanTypeArgument('click_and_collect', null)
);
}

View File

@@ -40,7 +40,7 @@
<table class="table table-schedule">
{loop type="pdr_schedule" name="schedule-loop" place_id={$ID}}
<tr class="creneau">
<td style="padding:10px; text-align: center">{$DAY_LABEL} {$CALCULATED_DAY} {format_date date=$BEGIN format="H\hi"} à {format_date date=$END format="H\hi"}</td>
<td style="padding:10px; text-align: center">{$CALCULATED_DAY} {format_date date=$BEGIN format="H\hi"} à {format_date date=$END format="H\hi"}</td>
<td style="padding:10px; text-align: center"><input type="radio" name="pdr-choosen-day" value="{$ID}"{if {cart attr='total_taxed_price_without_discount'} < $MINIMUM_AMOUNT} disabled{/if} /></td>
</tr>
{/loop}
@@ -82,7 +82,6 @@
</script>
<script>
// Masquer par défaut les options du mode PDR
@@ -102,17 +101,17 @@
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "https://maps.googleapis.com/maps/api/js?callback=initMaps" +
"&key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}";
"&key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}";
document.body.appendChild(script);
}
function initMaps() {
initMap();
initMapCnc();
if (typeof initMapPdr === "function") initMapPdr();
if (typeof initMapCnc === "function") initMapCnc();
}
function initMap() {
function initMapPdr() {
const LIMITES = {
north: 50.85043724044059,
east: 2.6869845409159923,
@@ -131,12 +130,13 @@
}
};
Data.map = new google.maps.Map(document.getElementById('pdr_map'), opt);
if (document.getElementById('pdr_map'))
Data.map = new google.maps.Map(document.getElementById('pdr_map'), opt);
displayPins();
displayPinsPdr();
}
function displayPins() {
function displayPinsPdr() {
var arrays = [];
$('#coordinates').eq(0).find('tr').each((r,row) => arrays.push($(row).find('td,th').map((c,cell) => $(cell).text()).toArray()))

View File

@@ -53,7 +53,12 @@
<div class="col-md-2 mode-livraison">
{loop name="delivery-module-loop" type="module" id=$DELIVERY_MODULE}
<p>{$CODE}</p>
<p>{format_date date=$planifDebut output='date' format="d/m"} entre {format_date date=$planifDebut output='time' format="H\hi"} et {format_date date=$planifFin output='time' format="H\hi"}</p>
<p>{if $planifDebut eq $planifFin}
Au plus tard le {format_date date=$planifDebut output='date' format="d/m"}
{else}
{format_date date=$planifDebut output='date' format="d/m"} entre {format_date date=$planifDebut output='time' format="H\hi"} et {format_date date=$planifFin output='time' format="H\hi"}
{/if}
</p>
{/loop}
</div>

View File

@@ -29,6 +29,12 @@
{assign var="customerRef" value=$REF}
{/loop}
{assign var="module_cnc" value=""}
{loop name="module_cnc_loop" type="module" code="ClickAndCollect"}
{assign var="module_cnc" value=$ID}
{/loop}
{loop type="scheduled_deliveries" name="order-schedule-loop" order_id=$order_id}
{assign var="planifDebut" value=$START_DATE}
{assign var="planifFin" value=$END_DATE}
@@ -71,11 +77,17 @@
{if $planifPlaceId neq ''}
<span style="color:red; font-weight:900">
{intl l="Warning withdrawal date" d="planificationlivraison"
date={format_date date=$planifDebut output="date" format="d/m/Y"}
heure_debut={format_date date=$planifDebut output="time" format="H\hi"}
heure_fin={format_date date=$planifFin output="time" format="H\hi"}
}
{if {order attr="delivery_module"} eq {$module_cnc}}
{intl l="Warning withdrawal date" d="planificationlivraison"
date={format_date date=$planifDebut output="date" format="d/m/Y"}
}
{else}
{intl l="Warning withdrawal date complete" d="planificationlivraison"
date={format_date date=$planifDebut output="date" format="d/m/Y"}
heure_debut={format_date date=$planifDebut output="time" format="H\hi"}
heure_fin={format_date date=$planifFin output="time" format="H\hi"}
}
{/if}
</span>
{/if}

View File

@@ -1,465 +0,0 @@
{extends file="layout.tpl"}
{* Security *}
{block name="no-return-functions" prepend}
{check_auth role="CUSTOMER" login_tpl="login"}
{check_cart_not_empty}
{check_valid_delivery}
{/block}
{* Body Class *}
{block name="body-class"}page-order-invoice{/block}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = [
['title' => {intl l="Cart"}, 'url'=>{url path="/cart"}],
['title' => {intl l="My order"}, 'url'=>{url path="/order/invoice"}]
]}
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Check my order"}</h1>
{include file="misc/checkout-progress.tpl" step="invoice"}
{hook name="order-invoice.top"}
{form name="thelia.order.coupon"}
<form id="form-coupon" action="{url path="/order/coupon"}" method="post" {form_enctype}>
{form_hidden_fields}
{form_field field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/order/invoice"}" />
{/form_field}
{form_field field='error_url'}
<input type="hidden" name="{$name}" value="{url path="/order/invoice"}" />
{/form_field}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<table class="table table-cart table-bordered">
<colgroup>
<col width="150">
<col>
<col width="200">
<col width="250">
</colgroup>
<thead>
<tr>
<th class="image">&nbsp;</th>
<th class="product">
<span class="hidden-xs">{intl l="Product Name"}</span>
<span class="visible-xs">{intl l="Name"}</span>
</th>
<th class="unitprice">
<span class="hidden-xs">{intl l="Unit Price"}</span>
<span class="visible-xs">{intl l="Price"}</span>
</th>
<th class="unitprice">
<span class="hidden-xs">{intl l="Unit Taxed Price"}</span>
<span class="visible-xs">{intl l="Taxed Price"}</span>
</th>
<th class="qty">
<span class="hidden-xs">{intl l="Quantity"}</span>
<span class="visible-xs">{intl l="Qty"}</span>
</th>
<th class="subprice">
<span class="hidden-xs">{intl l="Total incl. tax"}</span>
<span class="visible-xs">{intl l="Total incl.tax"}</span>
</th>
</tr>
</thead>
<tbody>
{loop type="cart" name="cartloop"}
<tr>
<td class="image">
<a href="{$PRODUCT_URL nofilter}">
{assign var="product_image_url" value=null}
{ifloop rel="pse-first-image"}
{loop type="product-sale-elements-image" name="pse-first-image" product_sale_elements_id=$PRODUCT_SALE_ELEMENTS_ID limit="1"}
{loop type="image" name="product-image" id=$PRODUCT_IMAGE_ID product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
{assign var="product_image_url" value=$IMAGE_URL}
{/loop}
{/loop}
{/ifloop}
{elseloop rel="pse-first-image"}
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
{assign var="product_image_url" value=$IMAGE_URL}
{/loop}
{/elseloop}
{if $product_image_url}
<img itemprop="image" src="{$product_image_url nofilter}" alt="Product #{$LOOP_COUNT}">
{else}
<img itemprop="image" src="{image file='assets/dist/img/product/1/118x85.png'}" alt="Product #{$LOOP_COUNT}">
{/if}
</a>
</td>
<td class="product" >
<h3 class="name">
<a href="{$PRODUCT_URL nofilter}">{$TITLE}</a>
</h3>
<div class="product-options">
<dl class="dl-horizontal">
<dt class="stockView">{intl l="Available"} :</dt>
{if $STOCK > 0}
<dd>{intl l="In Stock"}</dd>
{else}
<dd>{intl l="Out of Stock"}</dd>
{/if}
{loop type="product_sale_elements" name="ref" id=$PRODUCT_SALE_ELEMENTS_ID}
<dt class="refView">{intl l="No."}</dt>
<dd>{$REF}</dd>
{/loop}
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID"}
<dt class="attributeView">{$ATTRIBUTE_TITLE}</dt>
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
{/loop}
</dl>
</div>
</td>
<td class="unitprice">
<div class="secondary-price">
<span class="price">{format_money number=$REAL_PRICE}</span>
</div>
</td>
<td class="unitprice">
<div class="secondary-price">
<div class="special-price"><span class="price">{format_money number=$REAL_TAXED_PRICE}</span>
{if $IS_PROMO == 1}
<small class="old-price">{intl l="instead of"} <span class="price">{format_money number=$TAXED_PRICE}</span></small>
{/if}
</div>
</td>
<td class="qty">
<span class="price">{$QUANTITY}</span>
</td>
<td class="subprice">
<span class="price">
{format_money number=$REAL_TOTAL_TAXED_PRICE}
</span>
</td>
</tr>
{/loop}
</tbody>
</table>
<div class="row">
<div class="col-md-6 col-md-offset-6 col-sm-9 col-sm-offset-3 col-xs-12">
<table class="table table-cart table-bordered table-cart-total">
<tfoot>
{$discount={order attr="discount"}}
<tr>
<th class="coupon"><label for="coupon">{intl l="You may have a coupon ?"}</label></th>
<td class="coupon">
{form_field field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/order/invoice"}" />
{/form_field}
{form_field field='coupon-code'}
<div class="{if $error}has-error{/if}">
<div class="input-group">
<label class="control-label sr-only" for="code">{intl l='Code :'}</label>
<input id="coupon" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='Coupon code'}" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-default">{intl l="Ok"}</button>
</span>
</div>
{if $error}<span class="help-block">{$message}</span>{/if}
</div>
{/form_field}
<!-- /input-group -->
</td>
</tr>
<tr>
<th>{intl l="Cart total excl. taxes"}</th>
<td>
<div>
<span class="price">{format_money number={cart attr="total_price_without_discount"}}</span>
</div>
</td>
</tr>
<tr>
<th>{intl l="Taxes total"}</th>
<td>
<div>
<span class="price">{format_money number={cart attr="total_tax_amount_without_discount"}}</span>
</div>
</td>
</tr>
<tr>
<th>{intl l="Cart total incl. taxes"}</th>
<td>
<div>
<span class="price">{format_money number={cart attr="total_taxed_price_without_discount"}}</span>
</div>
</td>
</tr>
{if $discount > 0}
<tr>
<th class="discount">
{intl l="Discount incl. taxes"}
<br>{intl l="Tax: %tax" tax={format_money number={cart attr="discount_tax_amount"} currency_id=$CURRENCY}}
</th>
<td class="shipping">
<div class="total-price">
<span class="price">-{format_money number=$discount}</span>
</div>
</td>
</tr>
{/if}
{if {cart attr="is_virtual"} != 1}
<tr>
<th class="shipping">
{intl l="Shipping"}
{$postageTax = {order attr="postage_tax"}}
{if $postageTax > 0}
<br>
{intl l="Including %tax tax" tax={format_money number=$postageTax}}
{/if}
</th>
<td class="shipping">
<div class="shipping-price">
<span class="price">{format_money number={order attr="postage"}}</span>
</div>
</td>
</tr>
{/if}
<tr>
<th class="total">{intl l="Total incl. taxes"}</th>
<td class="total">
<div class="total-price">
<span class="price">{format_money number={{cart attr="total_taxed_price"} + {order attr="postage"}}}</span>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
{hook name="order-invoice.coupon-form"}
</form>
{/form}
{form name="thelia.order.payment"}
{assign var="isPost" value=$smarty.post|count}
<form id="form-cart-payment" action="{url path="/order/invoice"}" method="post" {form_enctype}>
{form_hidden_fields}
{form_field field="error_url"}
<input type="hidden" name="{$name}" value="{url path="/order/invoice"}">
{/form_field}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<div id="cart-address" class="row">
{ifhook rel="order-invoice.delivery-address"}
{* delivery module can customize the delivery address *}
{hook name="order-invoice.delivery-address" modulecode="LivraisonParSecteurs"}
{hook name="order-invoice.delivery-address" modulecode="PointRetrait"}
{hook name="order-invoice.delivery-address" modulecode="ClickAndCollect"}
{/ifhook}
{elsehook rel="order-invoice.delivery-address"}
<div class="panel panel-default col-sm-6">
{loop type="address" name="delivery-address" id={order attr="delivery_address"}}
<div class="panel-heading">{intl l="Delivery address"}</div>
<div class="panel-body">
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
<span class="org">{$COMPANY}</span>
<address class="adr">
<span class="street-address">{$ADDRESS1}</span><br>
{if $ADDRESS2 != ""}
<span class="street-address">{$ADDRESS2}</span><br>
{/if}
{if $ADDRESS3 != ""}
<span class="street-address">{$ADDRESS3}</span><br>
{/if}
<span class="postal-code">{$ZIPCODE}</span>
<span class="locality">{$CITY},
<span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
{if $STATE}, <span class="state-name">{loop type="state" name="customer.state.info" id=$STATE}{$TITLE}{/loop}</span></span>{/if}
</address>
</div>
{/loop}
</div>
{/elsehook}
{form_field field='invoice-address'}
<div class="panel panel-default col-sm-6">
<div class="panel-heading">{intl l="Billing address"}</div>
{if $error}
<span class="help-block"><span class="fa fa-remove"></span> {$message}</span>
{/if}
<div class="panel-body">
{loop type="address" name="invoice-address"}
{assign var="isInvoiceAddressChecked" value="0"}
{if $isPost}
{if $value == $ID && $value != ""}
{assign var="isInvoiceAddressChecked" value="1"}
{elseif $DEFAULT}
{assign var="isInvoiceAddressChecked" value="1"}
{/if}
{elseif $DEFAULT}
{assign var="isInvoiceAddressChecked" value="1"}
{/if}
<div class="radio">
<label for="invoice-address_{$ID}">
<input type="radio" name="{$name}" id="invoice-address_{$ID}" value="{$ID}"{if $isInvoiceAddressChecked} checked="checked"{/if}>
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
<span class="org">{$COMPANY}</span>
<address class="adr">
<span class="street-address">{$ADDRESS1}</span><br>
{if $ADDRESS2 != ""}
<span class="street-address">{$ADDRESS2}</span><br>
{/if}
{if $ADDRESS3 != ""}
<span class="street-address">{$ADDRESS3}</span><br>
{/if}
<span class="postal-code">{$ZIPCODE}</span>
<span class="locality">{$CITY},
<span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
{if $STATE}, <span class="state-name">{loop type="state" name="customer.state.info" id=$STATE}{$TITLE}{/loop}</span></span>{/if}
</address>
</label>
</div>
{/loop}
<a href="#" class="btn btn-change-address btn-link hidden"><i class="fa fa-pencil"></i> {intl l="Change address"}</a>
</div>
</div>
</div>
{/form_field}
{form_field field='payment-module'}
<div id="payment-method" class="panel panel-default">
<div class="panel-heading">{intl l="Choose your payment method"}</div>
{if $error}
<span class="help-block"><span class="fa fa-remove"></span> {$message}</span>
{/if}
<div class="panel-body">
<ul class="list-group">
{loop type="payment" name="payments" force_return="true"}
{assign "paymentModuleId" $ID}
<li class="list-group-item text-left">
<label for="payment_{$paymentModuleId}">
<input type="radio" name="{$name}" id="payment_{$paymentModuleId}" value="{$paymentModuleId}" {if ($LOOP_TOTAL ==1 && $LOOP_COUNT == 1) || ($value == $paymentModuleId)}checked{/if}>
{loop type="image" name="paymentspicture" source="module" source_id=$ID force_return="true" width="100" height="72"}
<img src="{$IMAGE_URL nofilter}" alt="{intl l="Pay with %module_title" module_title={$TITLE}}">
{/loop}
{$TITLE}
</label>
{hook name="order-invoice.payment-extra" module={$paymentModuleId}}
</li>
{/loop}
</ul>
</div>
</div>
{/form_field}
{form_field field="agreed"}
<div class="well">
<div class="form-group group-agreed{if $error} has-error{/if}">
<div class="control-input">
<div class="checkbox">
<label class="control-label" for="{$label_attr.for}">
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}"{if $checked} checked{/if} {if $required} aria-required="true" required{/if}>
{$termsAndConditionsId={config key="terms_conditions_content_id"}}
{if $termsAndConditionsId}
{loop name="content-terms" type="content" id=$termsAndConditionsId}
{$termsAndConditionsUrl=$URL}
{/loop}
{/if}
{intl l="I've read and agreed on <a href='%link' class='terms-quickview'>Terms &amp; Conditions</a>" link={$termsAndConditionsUrl nofilter}}.
</label>
{if $error }
<span class="help-block">{$message}</span>
{/if}
</div>
</div>
</div><!--/.form-group-->
</div>
{/form_field}
{hook name="order-invoice.payment-form"}
<a href="{url path="/order/delivery"}" role="button" class="btn btn-default"><i class="fa fa-chevron-left"></i> {intl l="Back"}</a>
<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-chevron-right"></i> {intl l="Next Step"}</button>
</form>
{/form}
{hook name="order-invoice.bottom"}
</article>
</div>
{/block}
{block name="javascript-initialization"}
<script type="text/javascript">
jQuery(function($) {
$('#cart-address').each(function(){
var $radio = $('.radio', this),
$btn = $('.btn-change-address');
// Hide other invoice address
$radio.filter( function(){ return !$(this).find(':radio').is(':checked'); }).hide();
$btn
.removeClass('hidden')
.bind('click.btn-change-address', function(){
$radio.show();
$(this).hide();
return false;
});
});
$(".terms-quickview").on('click', function (ev) {
ev.preventDefault();
$.get(this.href, function (data) {
// Hide all currently active bootbox dialogs
bootbox.hideAll();
// Show dialog
bootbox.dialog({
message : '<div class="clearfix">'+$("#content-main",data).html()+'</div>',
onEscape: function() {
bootbox.hideAll();
}
});
});
return false;
});
});
</script>
{hook name="order-invoice.javascript-initialization"}
{/block}
{block name="stylesheet"}
{hook name="order-invoice.stylesheet"}
{/block}
{block name="after-javascript-include"}
{hook name="order-invoice.after-javascript-include"}
{/block}