VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: bjornwebdesign on January 29, 2015, 19:41:48 PM

Title: adding custom price, similar to 'Cart variant'
Post by: bjornwebdesign on January 29, 2015, 19:41:48 PM
Hi All,

I'm running VM3 with the latest version of Joomla.

I want to recalculate the product price, adding my own custom price data.
Using jQuery I added the following:


formProduct = jQuery(".productdetails-view").find(".product");
Virtuemart.setproducttype(formProduct, virtuemart_product_id);


The 'formProduct' contains all the product data, how do I edit the product price?
For example i want to add 20,-. Can I update 1 price var, or do I need to update all the price vars (basePriceVariant, salesPrice, etc)?

I think I have do something like this:

formProduct.innerHTML=vmPrice.replace(strPrice(strNum(vmPrice)), strPrice(price));


The VM custom fields don't offer what i want, because the price i want to add is calculated by my own php.
I can't provide an URL, because it's running on a local webserver.

Any help is very much appreciated.

Regards,
Bjorn
Title: Re: adding custom price, similar to 'Cart variant'
Post by: Milbo on February 17, 2015, 13:09:26 PM
Take a look on the textinput plugin. I would not mess around with the function working for anyone else. that means, do not call the js yourself, it is better to change the data, which is used by the js, => textinput plugin.