Updating Cart in Variant instead of Quantity

  • Posts: 23
  • Thank you received: 0
13 years 9 months ago #9701

Hi everybody,
I'm running hikashop business 1.4.7 and I've searched the forum, hope I don't ask for a solved thread!

I've customized the cart view to show a dropdown with all the variant I've set for a product. Variants are actually duration like 3 months, 6 months ect, but I think it doesn't matters...

Now I would like to run via javascript an UPDATE CART LINK to update the cart with the new variant...

Looking at the DELETE LINK I see it's just a quantity variation to zero calling the update cart more or less like this:

/axonline/index.php/it/component/hikashop/product/updatecart/product_id-27/quantity-0/return_url-
aHR0cDovL2xvY2FsaG9zdC9heG9ubGluZS9pbmRleC5waHAvaXQvY29tcG9uZW50L2hpa2FzaG9wL2NoZWNrb3V0L3N0ZXAvc3RlcC0x

Not considering the return_url I can imagine this link ask to update the cart removing the product with id 27 from the cart

Is there a way I can ask via URL a think like:
/axonline/index.php/it/component/hikashop/product/updatecart/cart_product_id-165/product_id-28/

Where I'm asking the cart to be updated at the "table row" 165 with the new variant selected that is product_id 28 ?!?

If there is no way to do it via URL, can you suggest where should I begin to change the source code...?!?

Thanks a lot
Luciomonter

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

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
13 years 9 months ago #9724

Suppose that you have a product with two variants XX and YY and that you currently have 1 XX in the cart and that the user switches to YY, you could try to use such URL (I post the unSEFed URL so that other users can easily use it):

index.php?option=com_hikashop&ctrl=product&task=updatecart&data[XX]=0&data[YY]=1

Last edit: 13 years 9 months ago by nicolas. Reason: updated code

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

  • Posts: 23
  • Thank you received: 0
13 years 9 months ago #9730

Sorry Nicolas, can't get into it....
I'm trying:


index.php?option=com_hikashop&ctrl=product&task=updatecart&item[18][cart_product_quantity]=4

where 18 is the product_id of the product already in the cart to check if I can at least affect the quantity of this item by setting it to 4... Nothing seems to appen, even on the jos_hikashop_cart_product table in the DB.... what am i doing wrong?

Many Thanks in advance for your help
cheers

Luciomonter

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

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
13 years 9 months ago #9739

Right. I've updated the code. It's actually with data...With item it's for something else :)

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

  • Posts: 23
  • Thank you received: 0
13 years 9 months ago #9749

Beautiful Nicolas!
Works perfectly

Thanks a lot

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

  • Posts: 15
  • Thank you received: 0
10 years 6 months ago #160345

Hello,
I'm trying to update product quantity in the checkout page, and it is not working. It submits when I hit refresh. Kindly help.


:)


fFull-stack

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

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
10 years 6 months ago #160428

Hi,

Please provide a link to the shop so that we can look at that.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum