Post by sandi » Fri Feb 26, 2010 4:55 am

is it possible to make a small button, or something, which will delete/remove item from cart window?
Last edited by i2Paq on Sat Feb 27, 2010 9:35 pm, edited 1 time in total.
Reason: Topic title adjusted + moved

New member

Posts

Joined
Sat Jan 16, 2010 5:46 am

Post by SXGuy » Sat Feb 27, 2010 8:28 am

Just an idea, off the top of my head, havent tested this though.

BTW this is for 1.3.2 so other revs may vary

template/checkout/cart.tpl line 23

Code: Select all

<td align="center"><input type="checkbox" name="remove[<?php echo $product['key']; ?>]" /></td>
Replace with

Code: Select all

<td align="center"><a onclick="$('#cart').submit();" name="remove[<?php echo $product['key']; ?>]"  class="button"><span>Remove</span></a></td>
Make a copy of your old cart.tpl file first before you try this as i am only guessing to whether it will work.
Last edited by i2Paq on Sat Feb 27, 2010 9:21 pm, edited 1 time in total.
Reason: code-tags added

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by sandi » Sat Feb 27, 2010 2:00 pm

SXGuy wrote:Just an idea, off the top of my head, havent tested this though.

BTW this is for 1.3.2 so other revs may vary

template/checkout/cart.tpl line 23

Code: Select all

<td align="center"><input type="checkbox" name="remove[<?php echo $product['key']; ?>]" /></td>
Replace with

Code: Select all

<td align="center"><a onclick="$('#cart').submit();" name="remove[<?php echo $product['key']; ?>]"  class="button"><span>Remove</span></a></td>
Make a copy of your old cart.tpl file first before you try this as i am only guessing to whether it will work.
Thx man it works..much appreciated :)
Last edited by i2Paq on Sat Feb 27, 2010 9:33 pm, edited 1 time in total.
Reason: code-tags added

New member

Posts

Joined
Sat Jan 16, 2010 5:46 am

Post by SXGuy » Sat Feb 27, 2010 7:59 pm

No probs :) glad i could help!

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by alexkor » Wed Mar 03, 2010 11:58 pm

SXGuy, How to do this on opencart 1.4. I have added the code, but it can't work.
Can you help me?

Newbie

Posts

Joined
Wed Mar 03, 2010 11:45 pm

Post by SXGuy » Thu Mar 04, 2010 7:34 am

Ill try and help you, if im honest, ive only just gotten into 1.40 myself, so im a newbie with that

Lets see...


catalog/view/theme/default/template/checkout/cart.tpl line 32

Code: Select all

<td align="center"><input type="checkbox" name="remove[<?php echo $product['key']; ?>]" /></td>
replace with

Code: Select all

<td align="center"><a onclick="$('#cart').submit();" name="remove[<?php echo $product['key']; ?>]"  class="button"><span>Remove</span></a></td>

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by imadam » Thu Mar 04, 2010 8:20 am

didn't seem to work for me, though i have modified the cart page a tad i don't think that's why it's not working. i think it's because the form would be looking for a checked input box and then remove the item based on thats key, which isn't happening here. any idea on a fix? also would be nice if JavaScript wasn't required to remove the item as if a user had js disabled there'd be no way to remove the item

my opencart carpet cleaning woking guildford and Office Cleaning Services in Guildford


Active Member

Posts

Joined
Sun Jan 10, 2010 10:47 pm
Location - Surrey

Post by SXGuy » Thu Mar 04, 2010 6:58 pm

Your right it doesnt work, just tried it myself.

I think the only way it would work is to replace the onclick with a JS function that removes the item.

I dont know how it could be done without JS to be honest.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by imadam » Fri Mar 05, 2010 8:24 am

SXGuy wrote:Your right it doesnt work, just tried it myself.

I think the only way it would work is to replace the onclick with a JS function that removes the item.

I dont know how it could be done without JS to be honest.
well a link to a page that simple removes the item based on key which then redirects back to cart will do fine without the need for js. js should only be used imo for when you want to remove without page refresh, but atm one is needed for it to disappear.

thinking about it i quite like the old standard method of a checkbox as then you can remove more then one item at a time. much quicker then a page refresh every time.

my opencart carpet cleaning woking guildford and Office Cleaning Services in Guildford


Active Member

Posts

Joined
Sun Jan 10, 2010 10:47 pm
Location - Surrey

Post by benisv » Fri Jun 11, 2010 4:20 am

SXGuy wrote:Ill try and help you, if im honest, ive only just gotten into 1.40 myself, so im a newbie with that

Lets see...


catalog/view/theme/default/template/checkout/cart.tpl line 32

Code: Select all

<td align="center"><input type="checkbox" name="remove[<?php echo $product['key']; ?>]" /></td>
replace with

Code: Select all

<td align="center"><a onclick="$('#cart').submit();" name="remove[<?php echo $product['key']; ?>]"  class="button"><span>Remove</span></a></td>
1. I tried this on 1.4.7 and i got the buttons on but if i click it nothing hapend , i mean that product still remain on cart ,any idea why? ???

2. Also can any one help me out to do the same but on right side on cart ,side cart :) something like this ,let say i made a button call "list_remove_btn" and i uploud it it \catalog\view\theme\default\image ???

Image

New member

Posts

Joined
Mon May 31, 2010 3:59 pm

Post by Xsecrets » Fri Jun 11, 2010 4:49 am

you could upgrade to 1.4.8 which has this out of the box.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by benisv » Fri Jun 11, 2010 5:01 am

Yes i know i could but i got some old modules that i can't run without ,but until i got updates for those i try to make it as useful as I can ,thanks

New member

Posts

Joined
Mon May 31, 2010 3:59 pm

Post by SXGuy » Fri Jun 11, 2010 3:22 pm

Best advice would be to download 1.4.8 and compare the changes between your version and that version, and port them over so you have what you want

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by borrie » Sat Jan 15, 2011 12:03 am

Ok i got it working.

For those in need:

<a onclick="$('#cart').submit();" class="delete">
<input type="checkbox" name="remove[<?php echo $product['key']; ?>]" class="checkbox" checked="checked" />
<img src="catalog/view/theme/default/image/redcross.jpg" />
</a>


and than in your css:

.delete .checkbox{
display:none;
}

New member

Posts

Joined
Mon Jan 10, 2011 7:59 pm

Post by philbydevil » Mon Jan 17, 2011 7:33 pm

Almost there borrie. Using the code to replace the checkbox works, but if I change the quantity of an item and click "Update", it removes the item from my cart instead.

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Mon Jan 17, 2011 7:46 pm

<td align="center"><a onclick="$('#cart').submit();" name="remove[<?php echo $product['key']; ?>]" class="button"><span>Remove</span></a></td>
This seems to do the opposite to borrie's code. I can update the quantity, but the new "Remove" button doesn't delete the item.

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by dpanov » Mon Jan 02, 2012 12:29 am

Any ideas how this can be implemented for 1.5.1.3?

Newbie

Posts

Joined
Sun Jan 01, 2012 11:31 pm

Post by Spacer » Sat Feb 11, 2012 7:44 am

Ok ive done it!,

<a onclick="$('#cart').submit();" class="delete" />
<input type="checkbox" id="<?php echo $product['key']; ?>" name="remove[<?php echo $product['key']; ?>]" class="checkbox"/>
<img src="catalog/view/theme/default/image/image.png" onclick="remove('<?php echo $product['key']; ?>');"/>
</a>

---END OF THE DOCUMENT BEFORE <FOOTER>
<script language="javascript" type="text/javascript">
function remove(id)
{
document.getElementById(id).checked=true;
}
</script>


CSS
----
.delete .checkbox{
display:none;
}

Newbie

Posts

Joined
Sun Jan 01, 2012 4:18 am

Post by jackson » Mon Feb 13, 2012 4:40 am

a slight mod for 1.5.1.3 worked for me

<a onclick="$('#basket').submit();" class="delete" />
<input type="checkbox" id="<?php echo $product['key']; ?>" name="remove[]" value="<?php echo $product['key']; ?>" style="display:none;"/>
<img src="catalog/view/theme/default/image/close.png" onclick="remove('<?php echo $product['key']; ?>');"/>
</a>

Newbie

Posts

Joined
Sat Jan 14, 2012 8:07 am

Post by iomedesimo » Fri Jan 25, 2013 3:01 am

Please help me....
i have the 1.5.1.3 version and don't work...

I'd really like this but do not know how

New member

Posts

Joined
Thu Dec 08, 2011 6:33 pm
Who is online

Users browsing this forum: No registered users and 5 guests