Skip to content

Commit

Permalink
Optional final checkout summary before payment
Browse files Browse the repository at this point in the history
  • Loading branch information
paeddl committed Jun 16, 2016
1 parent c26525a commit 9f7c617
Showing 8 changed files with 150 additions and 0 deletions.
1 change: 1 addition & 0 deletions classes/checkout/CheckoutPaymentStep.php
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ public function render(array $extraParams = array())
->getConditionsToApproveForTemplate(),
'selected_payment_option' => $this->selected_payment_option,
'selected_delivery_option' => $selectedDeliveryOption,
'show_final_summary' => Configuration::get('PS_FINAL_SUMMARY_ENABLED'),
);

return $this->renderTemplate($this->getTemplate(), $extraParams, $assignedVars);
7 changes: 7 additions & 0 deletions controllers/admin/AdminOrderPreferencesController.php
Original file line number Diff line number Diff line change
@@ -51,6 +51,13 @@ public function __construct()
'title' => $this->l('General'),
'icon' => 'icon-cogs',
'fields' => array(
'PS_FINAL_SUMMARY_ENABLED' => array(
'title' => $this->l('Enable final summary'),
'hint' => $this->l('Display an overview of the addresses, shipping method and cart just before the order button (required in some European countries).'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_GUEST_CHECKOUT_ENABLED' => array(
'title' => $this->l('Enable guest checkout'),
'hint' => $this->l('Allow guest visitors to place an order without registering.'),
36 changes: 36 additions & 0 deletions themes/classic/_dev/css/components/checkout.scss
Original file line number Diff line number Diff line change
@@ -268,6 +268,42 @@ body#checkout {
vertical-align: middle;
}
}
#order-summary-content {
padding-top: em(25px);
h4.h4 {
font-size: em(16px);
margin-top: em(10px);
margin-bottom: em(20px);
color: $gray;
}
h4.black {
color: #000000;
}
h4.addresshead {
margin-top: em(3px);
}
.noshadow {
box-shadow: none;
}
#order-items {
border-right: 0;
h3.h3 {
color: $gray;
margin-top: em(20px);
}
}
.step-edit {
display: inline;
}
.step-edit:hover {
cursor: pointer;
}
a {
.step-edit {
color: $gray;
}
}
}
#footer {
@include box-shadow;
margin-top: em(90px);
9 changes: 9 additions & 0 deletions themes/classic/_dev/js/checkout.js
Original file line number Diff line number Diff line change
@@ -25,6 +25,15 @@ function setupMyCheckoutScripts() {

$('#modal').modal('show');
});

$('#order-summary-content span.step-to-addresses').on('click', (event) => {
$('#checkout-addresses-step h1.step-title').trigger('click');
});

$('#order-summary-content span.step-to-delivery').on('click', (event) => {
$('#checkout-delivery-step h1.step-title').trigger('click');
});

}

$(document).ready(() => {
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{block name='order-items-table-head'}
<div id="order-items" class="col-md-8">
<h3 class="card-title h3">{l s='Order items' d='Shop.Theme.Checkout'}</h3>
{/block}
<table class="table">
{foreach from=$products item=product}
<tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{extends file='checkout/_partials/order-confirmation-table.tpl'}

{block name='order-items-table-head'}
<div id="order-items" class="col-md-12">
<h3 class="card-title h3">
{if $products_count == 1}
{l s='%s item in your cart' sprintf=$products_count d='Shop.Theme.Checkout'}
{else}
{l s='%s items in your cart' sprintf=$products_count d='Shop.Theme.Checkout'}
{/if}
<a href="{url entity=cart params=['action' => 'show']}"><span class="step-edit"><i class="material-icons edit">mode_edit</i> edit</span></a>
</h3>
{/block}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<section id="order-summary-content" class="page-content page-order-confirmation">
<div class="row">
<div class="col-md-12">
<h4 class="h4 black">{l s='Please check your order before payment' d='Shop.Theme.Checkout'}</h4>
</div>
</div>

<div class="row">
<div class="col-md-12">
<h4 class="h4">
{l s='Addresses' d='Shop.Theme.Checkout'}
<span class="step-edit step-to-addresses"><i class="material-icons edit">mode_edit</i> edit</span>
</h4>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card noshadow">
<div class="card-block">
<h4 class="h4 black addresshead">{l s='My Delivery Address' d='Shop.Theme.Checkout'}</h4>
{$customer.addresses[$cart.id_address_delivery]['formatted'] nofilter}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card noshadow">
<div class="card-block">
<h4 class="h4 black addresshead">{l s='My Invoice Address' d='Shop.Theme.Checkout'}</h4>
{$customer.addresses[$cart.id_address_invoice]['formatted'] nofilter}
</div>
</div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<h4 class="h4">
{l s='Shipping Method' d='Shop.Theme.Checkout'}
<span class="step-edit step-to-delivery"><i class="material-icons edit">mode_edit</i> edit</span>
</h4>

<div class="col-md-12">
<div class="row">
<div class="col-md-2">
<div class="logo-container">
{if $selected_delivery_option.logo}
<img src="{$selected_delivery_option.logo}" alt="{$selected_delivery_option.name}">
{else}
&nbsp;
{/if}
</div>
</div>
<div class="col-md-4">
<span class="carrier-name">{$selected_delivery_option.name}</span>
</div>
<div class="col-md-4">
<span class="carrier-delay">{$selected_delivery_option.delay}</span>
</div>
<div class="col-md-2">
<span class="carrier-price">{$selected_delivery_option.price}</span>
</div>
</div>
</div>
</div>
</div>

<div class="row">
{block name='order_confirmation_table'}
{include file='checkout/_partials/order-final-summary-table.tpl'
products=$cart.products
products_count=$cart.products_count
subtotals=$cart.subtotals
totals=$cart.totals
labels=$cart.labels
}
{/block}
</div>
</section>
4 changes: 4 additions & 0 deletions themes/classic/templates/checkout/_partials/steps/payment.tpl
Original file line number Diff line number Diff line change
@@ -61,6 +61,10 @@
<p class="alert alert-danger">{l s='Unfortunately, there are no payment method available.' d='Shop.Theme.Checkout'}</p>
{/foreach}
</div>

{if $show_final_summary}
{include file='checkout/_partials/order-final-summary.tpl'}
{/if}

{if $conditions_to_approve|count}
<p class="ps-hidden-by-js">

0 comments on commit 9f7c617

Please sign in to comment.