How would I go about adding a small cart display to my side bar. I follow the instructions verbatim on http://lemonstandapp...docs/cart_page/ to get an idea but I always get undefined items error. Can some one show me a proper working example example? Thanks.
Page 1 of 1
Adding a cart to the sidebar
#2
Posted 13 February 2012 - 09:37 AM
..this is an example mini cart partial:
...then on all the external pages "AJAX" tab (that don't use the "shop:cart" action) you need pretty much this:
...the "cart" page "AJAX" tab, could do with this too:
...check out the free themes on marketplace as a useful guide too:
http://lemonstandapp...ategory/themes/
<div id="mini_cart_id" class="mini_cart">
<?= open_form() ?>
<a href="<?= root_url('/cart') ?>" title="Cart items">CART :
<?= Shop_Cart::get_item_total_num() ?> item(s) | <?= format_currency(Shop_Cart::total_price()) ?></a>
<ul>
<?php $counter = 0; ?>
<?php foreach (Shop_Cart::list_active_items() as $item): ?>
<li>
<a href="<?= root_url($item->product->page_url('/product')) ?>" title="<?= h($item->product->name) ?>">
<?= substr(h($item->product->name),0,32) ?></a>
<a title="REMOVE" onclick="$(this).getForm().sendRequest(
'shop:on_deleteCartItem',
{
extraFields: {
'key': '<?= $item->key ?>'
},
update: {'cart_page_div': 'cart_partial', 'mini_cart_id': 'shop_mini_cart'}
});return false" href="#">
<img class="cart_delete" alt="REMOVE" src="<?= root_url('/resources/images/cart_delete.gif') ?>" /></a>
</li>
<?php $counter++; if ($counter == 4) break;?>
<? endforeach; ?>
</ul>
</form>
</div>...then on all the external pages "AJAX" tab (that don't use the "shop:cart" action) you need pretty much this:
function add_to_cart_ext($controller)
{
$_POST['product_cart_quantity'] = post_array_item('grouped_product_cart_quantity', post('product_id'));
$controller->exec_action_handler('shop:on_addToCart');
}
...the "cart" page "AJAX" tab, could do with this too:
function on_removeAllCartItems($controller) {
Shop_Cart::remove_active_items(); }
function add_to_cart_ext($controller)
{
$_POST['product_cart_quantity'] = post_array_item('grouped_product_cart_quantity', post('product_id'));
$controller->exec_action_handler('shop:on_addToCart');
}...check out the free themes on marketplace as a useful guide too:
http://lemonstandapp...ategory/themes/
This post has been edited by apepp: 13 February 2012 - 09:43 AM
Share this topic:
Page 1 of 1

Help












