add estimated shipping functionnality in cart

This commit is contained in:
Julien Chanséaume
2014-04-25 09:43:22 +02:00
parent f556a7d149
commit ac51ab21e4
7 changed files with 341 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ return array(
'Edit' => 'Editer',
'Edit this address' => 'Editer cette adresse',
'Email address' => 'Adresse e-mail',
'Estimated shipping ' => 'Estimation des frais de port',
'Facebook' => 'Facebook',
'Follow us' => 'Suivez-nous',
'Follow us introduction' => 'Abonnez vous à nos pages',
@@ -100,6 +101,7 @@ return array(
'Next product' => 'Produit suivant.',
'No Content in this folder.' => 'Aucun contenu dans ce dossier.',
'No articles currently' => 'Aucun article en ce moment',
'No deliveries available for this cart and this country' => 'Aucun mode de livraison disponible pour ce panier et ce pays',
'No products available in this category' => 'Aucun produit dans cette catégorie.',
'No results found' => 'Aucun résultat',
'No.' => 'N°',
@@ -166,6 +168,7 @@ return array(
'Secure payment' => 'Paiement sécurisé',
'Select Country' => 'Choisissez un pays',
'Select Title' => 'Civilité',
'Select your country:' => 'Sélectionnez votre pays :',
'Send' => 'Envoyer',
'Send us a message' => 'Envoyez nous un message.',
'Shipping Tax' => 'Frais de livraison',
@@ -214,7 +217,10 @@ return array(
'Your order will be confirmed by us upon receipt of your payment.' => 'Votre commande sera confirmée à réception de votre paiement.',
'Youtube' => 'Youtube',
'deliveries' => 'Livraisons',
'for' => 'pour',
'instead of' => 'au lieu de',
'missing or invalid data' => 'Information érronée ou incomplète',
'per page' => 'par page',
'update' => 'mettre à jour',
'with:' => 'avec :',
);

View File

@@ -115,17 +115,57 @@
<span class="price">{$real_price * $QUANTITY} {currency attr="symbol"}</span>
</td>
</tr>
{/loop}
{postage}
{assign var="postageAmount" value=$postage }
<tr>
<td class="product" colspan="2">
<form action="{url path="/cart/country"}" class="form-inline" method="post">
<h3>
{intl l="Estimated shipping "}
{if $is_customizable == false}
{loop type="country" name="countryLoop" id="$country_id"}
{intl l="for"} {$TITLE}
{/loop}
{/if}
</h3>
{if $is_customizable}
<div>
<label for="cart-country">{intl l="Select your country:"}</label>
<select id="cart-country" name="country">
{loop type="country" name="countryLoop" with_area="true"}
<option value="{$ID}" {if $ID == $country_id }selected="selected" {/if}>{$TITLE}</option>
{/loop}
</select>
<a class="btn btn-change-country" href="#"><i class="icon-refresh"></i> {intl l="update"}</a>
</div>
{/if}
{if $delivery_id != 0 }
<div>
{intl l="with:"} {loop type="delivery" name="deliveryLoop" id=$delivery_id}{$TITLE} {/loop}
</div>
{else}
<div class="alert alert-danger">
{intl l="No deliveries available for this cart and this country"}
</div>
{/if}
</form>
</td>
<td class="unitprice">{$postage} {currency attr="symbol"}</td>
<td class="qty">-</td>
<td class="subprice">{$postage} {currency attr="symbol"}</td>
</tr>
{/postage}
</tbody>
<tfoot>
<tr >
<tr>
<td colspan="3" class="empty">&nbsp;</td>
<th class="total">{intl l="Total"}</th>
<td class="total">
<div class="total-price">
<span class="price">{cart attr="total_taxed_price_without_discount"} {currency attr="symbol"}</span>
</div>
{assign var="totalAmount" value={cart attr='total_taxed_price_without_discount'} + $postageAmount }
<span class="price">{$totalAmount} {currency attr="symbol"}</span>
</div>cart
</td>
</tr>
</tfoot>
@@ -169,6 +209,11 @@
$("select[name=quantity]").change(function(){
$(this).parents('form').submit();
});
$(".btn-change-country").click(function(e){
e.preventDefault();
var $form = $(this).parents('form');
$form.submit();
})
});
</script>
{/block}