When the customer clicks on add to cart button, the widget will show and be updated with the new price. When the user clicks clear cart, it hides.
Simple. The second part automatically hides the cart when its empty. This could also be done with CSS.
<script type="text/javascript">
jQuery(function(){
jQuery('.wpsc_buy_button').click(function(){
jQuery('.widget_wpsc_shopping_cart').show();
});
jQuery('.emptycart').click(function(){
jQuery('.widget_wpsc_shopping_cart').hide();
});
})
</script>
<?php if(wpsc_cart_item_count() <= 0)
{ ?>
<script type="text/javascript">
jQuery(function(){
jQuery('.widget_wpsc_shopping_cart').hide();
})
</script>
<?php } ?>
No comments:
Post a Comment