Question

I have a landing page. I'm showing some product in this landing page..

When users select product in this page must go my virtuemart page..

Virtuemart direct add to cart link like that:

http://www.mysite.com/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2762&quantity[]=5&virtuemart_product_id[]=792&quantity[]=2

When selecting a product reading rel value with jquery (it is virtuemart product id) quantity is not important it is must be 1.. and adding that value end of link checkout button

&virtuemart_product_id[]=2762&quantity[]=1

My jsfiddle demo: 274 line starting cart jquery code

it is working but when delete a product in checkout list not remove products value in checkout button link.

if delete a product must delete product id to in checkout button link &virtuemart_product_id[]=2762&quantity[]=1

I don't know very good jQuery.. How can i fix it?

Regards

Était-ce utile?

La solution

I've looked at your code and you only add query string to your link and you dont do nothing to clear the string when you trash the items u even not need to use jQuery and only html when you remove item:

$(".remove").click(function(){
   var stringToClear= $(this).parent(".someDivWithItemInfo");//->&virtuemart_product_id[]=2762&quantity[]=1
   var currentHrefLink= $("#linkId").attr("href");
   currentHrefLink = currentHrefLink.replace(stringToClear, "");
   $("#linkId").attr("href",currentHrefLink);
});

jsfiddle demo: http://jsfiddle.net/C59Qk/2/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top