Skip to content

Instantly share code, notes, and snippets.

@dardub
Created January 23, 2012 20:08
Show Gist options
  • Save dardub/1665293 to your computer and use it in GitHub Desktop.
Save dardub/1665293 to your computer and use it in GitHub Desktop.
lemonstand side cart
<? $items = Shop_Cart::list_active_items();
$total = Shop_Cart::total_price();
$total_qty = Shop_cart::get_item_total_num();
?>
<div class="box base-mini mini-cart">
<div class="head">
<h4> &nbsp; My Cart</h4>
</div>
<div class="actions">
<p>There are <strong><?= $total_qty ?> item<? if($total_qty>1) echo 's' ?></strong> in your cart.</p>
<p class="subtotal">Cart Subtotal <strong><span class="price"><?= format_currency($total) ?></span></strong></p>
<button class="form-button" type="button" onclick="location.href='<?= site_url('/checkout-start') ?>'"><span>Checkout</span></button>
</div><!-- end .actions -->
<h5>Recently added items</h5>
<ol id="cart-sidebar">
<? $qty_count = 0;
$items = array_reverse($items);
foreach($items as $item):
?>
<li>
<?= open_form() ?>
<div class="product-images">
<img src="<?= root_url($item->product->image_url(0,50,50)) ?>" />
</div>
<div class="product-details">
<a href="#" class="widget-btn" onclick="return $(this).getForm().sendRequest('shop:on_deleteCartItem', {update: {'side_cart': 'shop:side_cart'}, confirm: 'Do you really want to remove this item from cart?', extraFields: {key: '<?= $item->key ?>'}})"><img src="<?= theme_resource_url('images/list_remove_btn.gif') ?>" alt="Remove Product"></a>
<?= $item->product->name ?><br/>
<strong><?= $item->quantity ?></strong> x <span class="price"><?= format_currency($item->single_price()) ?></span>
</div><!-- .product-details -->
</form>
</li>
<? if($qty_count > $item->quantity )
break;
$qty_count++;
?>
<? endforeach ?>
</ol>
</div><!-- end .mini-cart -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment