Jump to content

How to delete a item from the cart


BAJI26

Recommended Posts

  • 7 months later...

how exactly did you add the delete option to the boxes form? and thoughts on why its not been added into future releases? The boxes format is much more well laid out than the cart checkout option....

 

thanks

 

John

Link to comment
Share on other sites

If you are using the default cart:

 

Open viewcart.tpl

FIND:

<link rel="stylesheet" type="text/css" href="templates/orderforms/default/style.css" />

 

 

ADD BELOW;

<script type="text/javascript" src="includes/jscript/pwstrength.js"></script>
{literal}
<script language="javascript">
function removeItem(type,num) {
var response = confirm("{/literal}{$LANG.cartremoveitemconfirm}{literal}");
if (response) {
	window.location = 'cart.php?a=remove&r='+type+'&i='+num;
}
}
function emptyCart(type,num) {
var response = confirm("{/literal}{$LANG.cartemptyconfirm}{literal}");
if (response) {
	window.location = 'cart.php?a=empty';
}
}
</script>
{/literal}

 

 

FIND:

<a href="{$smarty.server.PHP_SELF}?a=confproduct&i={$num}" style="color:#009900;">[{$LANG.carteditproductconfig}]</a><br />

 

REPLACE WITH:

<a href="{$smarty.server.PHP_SELF}?a=confproduct&i={$num}" style="color:#009900;">[{$LANG.carteditproductconfig}]</a> <a href="#" onclick="removeItem('p','{$num}');return false" style="color:#cc0000;">[{$LANG.cartremove}]</a><br/>

 

FIND:

 

<p align="center"><input type="button" value="« {$LANG.orderstartover}" onclick="window.location='cart.php?a=startover'" /> <input type="button" value="{$LANG.checkout} »" onclick="window.location='cart.php?a=checkout'"{if $cartitems==0} disabled{/if} /></p>

 

 

REPLACE WITH:

<p width="45%" align="center"><input type="button" value="{$LANG.emptycart}" onclick="emptyCart();return false" /> 
     <input type="button" value="{$LANG.continueshopping}" onclick="window.location='cart.php'" /> 
   <input type="button" value="{$LANG.checkout}" onclick="window.location='cart.php?a=checkout'"{if $cartitems==0} disabled{/if} />
</p>

Edited by BAJI26
Link to comment
Share on other sites

  • 2 weeks later...

FIND:

 

<a href="{$smarty.server.PHP_SELF}?a=confdomains" style="color:#009900;">[{$LANG.cartconfigdomainextras}]</a>

 

 

REPLACE IT WITH:

 

<a href="{$smarty.server.PHP_SELF}?a=confdomains" style="color:#009900;">[{$LANG.cartconfigdomainextras}]</a>
<a href="#" onclick="removeItem('d','{$num}');return false" style="color:#cc0000;">[{$LANG.cartremove}]</a>

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • WHMCS CEO
Thanks for this addition, exactly what was needed. This should definitely be a standard addition - Matt?...

 

This code is from the default templates anyway. We supply 2 with and 2 without so you can choose. cart and web20cart have it by default, default and boxes do not as they act in the format of 1 product at a time orders rather than shopping carts which some prefer. Code can however be copied from one to the other like described here.

 

Matt

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated