cart integration

This commit is contained in:
Etienne Roudeix
2013-09-16 13:15:35 +02:00
parent 2857d0621c
commit e0a48df23e
7 changed files with 304 additions and 106 deletions

View File

@@ -4,7 +4,7 @@
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">You are here: </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">Home</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{navigate to="index"}" itemprop="url"><span itemprop="title">Home</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">Cart</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
@@ -23,112 +23,117 @@
<a href="cart-step4.php" role="button" class="btn btn-step disabled"><span class="step-nb">4</span> <span class="step-label">Secure payment</span></a>
</div>
<form id="form-cart" action="cart-step2.php" method="post" role="form">
<table class="table table-cart">
<colgroup>
<col width="150">
<col>
<col width="150">
<col width="150">
<col width="150">
</colgroup>
<thead>
<tr>
<th class="image">&nbsp;</th>
<th class="product">
<span class="hidden-xs">Product Name</span>
<span class="visible-xs">Name</span>
</th>
<th class="unitprice">
<span class="hidden-xs">Unit Price</span>
<span class="visible-xs">Price</span>
</th>
<th class="qty">
<span class="hidden-xs">Quantity</span>
<span class="visible-xs">Qty</span>
</th>
<th class="subprice">
<span class="hidden-xs">Total <abbr title="Tax Inclusive">TTC</abbr></span>
<span class="visible-xs">Total</span>
</th>
</tr>
</thead>
<tbody>
<table class="table table-cart">
<colgroup>
<col width="150">
<col>
<col width="150">
<col width="150">
<col width="150">
</colgroup>
<thead>
<tr>
<th class="image">&nbsp;</th>
<th class="product">
<span class="hidden-xs">Product Name</span>
<span class="visible-xs">Name</span>
</th>
<th class="unitprice">
<span class="hidden-xs">Unit Price</span>
<span class="visible-xs">Price</span>
</th>
<th class="qty">
<span class="hidden-xs">Quantity</span>
<span class="visible-xs">Qty</span>
</th>
<th class="subprice">
<span class="hidden-xs">Total <abbr title="Tax Inclusive">TTC</abbr></span>
<span class="visible-xs">Total</span>
</th>
</tr>
</thead>
<tbody>
{loop type="cart" name="cartloop"}
{loop type="cart" name="cartloop"}
<tr>
<td class="image">
<a href="{$PRODUCT_URL}" class="thumbnail">
{assign "cart_count" $LOOP_COUNT}
{ifloop rel='product-image'}
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}"></a>
{/loop}
{/ifloop}
{elseloop rel="product-image"}
{images file='assets/img/product/1/118x85.png'}<img itemprop="image" src="{$asset_url}" alt="Product #{$LOOP_COUNT}">{/images}
{/elseloop}
</td>
<td class="product" >
<h3 class="name"><a href="product-details.php">
Product #{$LOOP_COUNT}
</a></h3>
<div class="product-options">
<dl class="dl-horizontal">
<dt>Available :</dt>
<dd>In Stock</dd>
<dt>No.</dt>
<dd>{$REF}</dd>
{*<dt>Select Size</dt>
<dd>Large</dd>
<dt>Select Delivery Date</dt>
<dd>Jan 2, 2013</dd>
<dt>Additional Option</dt>
<dd>Option 1</dd>*}
</dl>
</div>
<a href="{url path="/cart/delete/{$ITEM_ID}"}" class="btn btn-remove">Remove</a>
</td>
<td class="unitprice">
{if $IS_PROMO == 1}
{assign "real_price" $PROMO_TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$PROMO_TAXED_PRICE}</span></div>
<small class="old-price">instead of <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
{/if}
</td>
<td class="qty">
<div class="form-group group-qty">
<input type="number" name="quantity[]" id="quantity_<?php echo $count; ?>" class="form-control" value="{$QUANTITY}" min="0" required>
</div>
</td>
<td class="subprice">
<span class="price">{currency attr="symbol"} {$real_price * $QUANTITY}</span>
</td>
</tr>
<tr>
<td class="image">
<a href="{$PRODUCT_URL}" class="thumbnail">
{assign "cart_count" $LOOP_COUNT}
{ifloop rel='product-image'}
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}"></a>
{/loop}
{/ifloop}
{elseloop rel="product-image"}
{images file='assets/img/product/1/118x85.png'}<img itemprop="image" src="{$asset_url}" alt="Product #{$cart_count}">{/images}
{/elseloop}
</td>
<td class="product" >
<h3 class="name"><a href="product-details.php">
Product #{$LOOP_COUNT}
</a></h3>
<div class="product-options">
<dl class="dl-horizontal">
<dt>Available :</dt>
<dd>In Stock</dd>
<dt>No.</dt>
<dd>{$REF}</dd>
{*<dt>Select Size</dt>
<dd>Large</dd>
<dt>Select Delivery Date</dt>
<dd>Jan 2, 2013</dd>
<dt>Additional Option</dt>
<dd>Option 1</dd>*}
</dl>
</div>
<a href="{url path="/cart/delete/{$ITEM_ID}"}" class="btn btn-remove">Remove</a>
</td>
<td class="unitprice">
{if $IS_PROMO == 1}
{assign "real_price" $PROMO_TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$PROMO_TAXED_PRICE}</span></div>
<small class="old-price">instead of <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
{/if}
</td>
<td class="qty">
<div class="form-group group-qty">
<form action="{url path="/cart/update"}" method="post" role="form">
<input type="hidden" name="cart_item" value="{$ITEM_ID}">
<select name="quantity" class="form-control js-update-quantity">
{for $will=1 to $STOCK}
<option {if $QUANTITY == $will}selected="selected"{/if}>{$will}</option>
{/for}
</select>
</form>
</div>
</td>
<td class="subprice">
<span class="price">{currency attr="symbol"} {$real_price * $QUANTITY}</span>
</td>
</tr>
{/loop}
{/loop}
</tbody>
<tfoot>
<tr >
<td colspan="3" class="empty">&nbsp;</td>
<th class="total">Total <abbr title="Tax Inclusive">TTC</abbr></th>
<td class="total">
<div class="total-price">
<span class="price">$200.00</span>
</div>
</td>
</tr>
</tfoot>
</table>
</tbody>
<tfoot>
<tr >
<td colspan="3" class="empty">&nbsp;</td>
<th class="total">Total <abbr title="Tax Inclusive">TTC</abbr></th>
<td class="total">
<div class="total-price">
<span class="price">{currency attr="symbol"} {cart attr="total_taxed_price"}</span>
</div>
</td>
</tr>
</tfoot>
</table>
<a href="{navigate to="index"}" role="button" class="btn btn-continue-shopping"><span>Continue Shopping</span></a>
<button type="submit" name="checkout" class="btn btn-checkout"><span>Proceed checkout</span></button>
</form>
<a href="{navigate to="index"}" role="button" class="btn btn-continue-shopping"><span>Continue Shopping</span></a>
<a href="{url path="/cart/billing"}" class="btn btn-checkout">Proceed checkout</a>
</article>
@@ -154,6 +159,16 @@
</aside><!-- #products-upsell -->
</div>
{/block}
</div><!-- /.container -->
{block name="javascript-initialization"}
<script type="text/javascript">
jQuery(function($cart) {
$cart('.js-update-quantity').on('change', function(e) {
var newQuantity = $cart(this).val();
$cart(this).parent().submit();
})
});
</script>
{/block}