- Posts: 23
- Thank you received: 0
Creating delete link
11 years 1 month ago #213397
by Mikemike
Creating delete link was created by Mikemike
-- HikaShop version -- : 2.4
Hey guys,
just quick. I need to create a delete like so: index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1
but when I send this link via Ajax, it doesnt delete the product from the cart, any hints?
Thanks guys.
Hey guys,
just quick. I need to create a delete like so: index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1
but when I send this link via Ajax, it doesnt delete the product from the cart, any hints?
Thanks guys.
Please Log in or Create an account to join the conversation.
11 years 1 month ago #213400
by nicolas
Replied by nicolas on topic Creating delete link
Hi,
Use such link instead:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1&add=0
Otherwise, the system will add a product with a quantity of 0 instead of replacing the product quantity in the cart with the quantity 0.
Use such link instead:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1&add=0
Otherwise, the system will add a product with a quantity of 0 instead of replacing the product quantity in the cart with the quantity 0.
Please Log in or Create an account to join the conversation.
11 years 4 weeks ago - 11 years 4 weeks ago #213616
by Mikemike
Replied by Mikemike on topic Creating delete link
Hey Nic,
thanks, that did the trick! Just another short one :blush: :
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&product_id=744&hikashop_product_option[0]=7&hikashop_product_option[5]=12&hikashop_product_custom_item_value[42]=testtext
any idea, why the product_custom_item_value doenst work in this example?
Thanks :DD
thanks, that did the trick! Just another short one :blush: :
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&product_id=744&hikashop_product_option[0]=7&hikashop_product_option[5]=12&hikashop_product_custom_item_value[42]=testtext
any idea, why the product_custom_item_value doenst work in this example?
Thanks :DD
Last edit: 11 years 4 weeks ago by Mikemike.
Please Log in or Create an account to join the conversation.
11 years 4 weeks ago #213624
by nicolas
Replied by nicolas on topic Creating delete link
Hi,
That's because there is no product_custom_item_value parameter for the add to cart URL.
Here is a thread explaining how to fill in custom item fields for the add to cart URL:
www.hikashop.com/forum/2-general-talk-ab...-product-fields.html
That's because there is no product_custom_item_value parameter for the add to cart URL.
Here is a thread explaining how to fill in custom item fields for the add to cart URL:
www.hikashop.com/forum/2-general-talk-ab...-product-fields.html
Please Log in or Create an account to join the conversation.
11 years 1 day ago - 11 years 1 day ago #216299
by Mikemike
Replied by Mikemike on topic Creating delete link
Hey Nic,
another thing about the delete link:
when I use: index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1&add=0
it works for the first product in the cart.
But for example:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=3&add=0
it doenst delete the 3 product in the cart.
I saw on the delte button generated by HikaShop, that sometimes there are total different cart ids, for example:
<a title="Löschen" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_203768'); if(qty_field){qty_field.value=0; document.getElementById('product_option_203769').value=qty_field.value;document.getElementById('product_option_203770').value=qty_field.value; qty_field.form.submit();} return false;" href="/checkout/product/updatecart/quantity-0/return_url-aHR0cDovL3d3dy5yb2FkYnVyZ2VyLmF0L2NoZWNrb3V0/cid-744" class="hikashop_no_print">
so I tried to use this:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=744&add=0
But also no luck with that kind of cart ids.
Any ideas about that?
Thanks!
another thing about the delete link:
when I use: index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=1&add=0
it works for the first product in the cart.
But for example:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=3&add=0
it doenst delete the 3 product in the cart.
I saw on the delte button generated by HikaShop, that sometimes there are total different cart ids, for example:
<a title="Löschen" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_203768'); if(qty_field){qty_field.value=0; document.getElementById('product_option_203769').value=qty_field.value;document.getElementById('product_option_203770').value=qty_field.value; qty_field.form.submit();} return false;" href="/checkout/product/updatecart/quantity-0/return_url-aHR0cDovL3d3dy5yb2FkYnVyZ2VyLmF0L2NoZWNrb3V0/cid-744" class="hikashop_no_print">
so I tried to use this:
index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=0&cid=744&add=0
But also no luck with that kind of cart ids.
Any ideas about that?
Thanks!
Last edit: 11 years 1 day ago by Mikemike.
Please Log in or Create an account to join the conversation.
11 years 1 day ago #216314
by nicolas
Replied by nicolas on topic Creating delete link
Hi,
You should give the id of the product in the cid parameter and not the position of the product in the cart.
Also, if you have several lines for that product in the cart, it will only remove one of them.
I'm not sure what you're trying to do. If you want to clear the whole cart, you can simply call:
index.php?option=com_hikashop&ctrl=product&task=cleancart
You should give the id of the product in the cid parameter and not the position of the product in the cart.
Also, if you have several lines for that product in the cart, it will only remove one of them.
I'm not sure what you're trying to do. If you want to clear the whole cart, you can simply call:
index.php?option=com_hikashop&ctrl=product&task=cleancart
Please Log in or Create an account to join the conversation.
Time to create page: 0.281 seconds