News:

Support the VirtueMart project and become a member

Main Menu

Automaticaly add default custom field price.

Started by emil_dumitrache, January 11, 2016, 14:49:01 PM

Previous topic - Next topic

emil_dumitrache

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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

emil_dumitrache

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.

PRO

if the CPU comes with a basic motherboard, why is that price not in the base price?


emil_dumitrache

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/


emil_dumitrache

#5
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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation