Creating delete link

  • Posts: 23
  • Thank you received: 0
10 years 1 week ago #213397

-- 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.

Please Log in or Create an account to join the conversation.

  • Posts: 84306
  • Thank you received: 13700
  • MODERATOR
10 years 1 week ago #213400

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.

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
10 years 1 week ago #213616

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

Last edit: 10 years 1 week ago by Mikemike.

Please Log in or Create an account to join the conversation.

  • Posts: 84306
  • Thank you received: 13700
  • MODERATOR
10 years 1 week ago #213624

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

Please Log in or Create an account to join the conversation.

  • Posts: 23
  • Thank you received: 0
9 years 11 months ago #216299

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!

Last edit: 9 years 11 months ago by Mikemike.

Please Log in or Create an account to join the conversation.

  • Posts: 84306
  • Thank you received: 13700
  • MODERATOR
9 years 11 months ago #216314

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

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum