==========================
You will need to have the CGSimpleSmarty module for this to work
I needed an Empty Cart button in my View Cart template, so at the bottom (but still within the {$formstart}{$formend} tags) I added this button:
Code: Select all
<button type="submit" name="empty_cart" value="empty">Empty Cart</button>
Code: Select all
{*=== $smarty.post.empty_cart is the same as $_POST['empty_cart'] ===*}
{if $smarty.post.empty_cart=="empty"}
{*=== this next line clears the session for Cart ===*}
{session_erase var='cgcart'}
<p>Your cart has been cleared.</p>
{else}
{*=== Cart has no items... ===*}
{if !isset($cartitems) || count($cartitems) == 0 }
<p>Your cart is empty.</p>
{else}
{*=== display all the products... rest of the template goes here ===*}
{*=== .... ===*}
{/if}
{/if}
More tips soon...