VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: emil_dumitrache on January 11, 2016, 14:49:01 PM

Title: Automaticaly add default custom field price.
Post by: emil_dumitrache on January 11, 2016, 14:49:01 PM
Hello,
I have an issue with custom fields that i cannot resolve.
I have a website that sells computers and i want the buyers to customize wich graphics card or motherboar they want.
The problem is, i set the baseprice at 100 euro and put, let's say, 2 motherboards, 1 at 100 euros the second at 150 euros. The one at 100 euros is the one that shows by default in the options. The price of the product remains at 100 euros untill i make a selection. I want the price to automatically adjust with the first motherboard that is preselected in the product page. So the price of the product will be 200 euros from start.
Virtuemart 3.0.12 Joomla 3.4.8

Please help me!!!
thx
Title: Re: Automaticaly add default custom field price.
Post by: jenkinhill on January 12, 2016, 12:14:48 PM
See http://demo.breakdesigns.net/index.php/product-builder2
Title: Re: Automaticaly add default custom field price.
Post by: emil_dumitrache on January 12, 2016, 13:39:45 PM
It is good but not quite what i was lookong for.
I just want something like the default variant choosen to be added automaticaly in the price.
Title: Re: Automaticaly add default custom field price.
Post by: PRO on January 12, 2016, 15:02:45 PM
if the CPU comes with a basic motherboard, why is that price not in the base price?

Title: Re: Automaticaly add default custom field price.
Post by: emil_dumitrache on January 12, 2016, 15:20:42 PM
It does not come with a basic motherboard, there are 1 or two or three motherboards, and 7-8 cpus to choose from.
Here is the website where you can see the products and that i meen:

http://custom-computer.ro/

Title: Re: Automaticaly add default custom field price.
Post by: emil_dumitrache on January 12, 2016, 19:05:46 PM
It seems i have done something wright :)
In vmprices.js I uncomented the last function:
jQuery.noConflict();

jQuery(document).ready(function($) {

Virtuemart.product(jQuery("form.product"));



$("form.js-recalculate").each(function(){

if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) {

var id= $(this).find('input[name="virtuemart_product_id[]"]').val();

Virtuemart.setproducttype($(this),id);



}

});

});


Now in the product page it loads all the prices from the default chosen variants. So the price is updated on the fly. I hope it does not interfere with something else dough...  For now i tested if the prices are modified in any way in the back-end and if the cart prices are ok. So far so good.
Now i need to show this recalculated price in the category view also. Anyone has a clue on how to do that?
Please help  :)

Mod edit:  impatient bump message removed. Please read http://forum.virtuemart.net/index.php?topic=104795.0
Title: Re: Automaticaly add default custom field price.
Post by: GJC Web Design on January 13, 2016, 22:44:35 PM
for this sort of thing on cats you need to provide a unique id for each holder container then do a loop in your js to find these ids (so u know each prod on the page)

form them into an array then loop thru them and target the ind. ids updating the price with your original code