Author Topic: Change weight after changing selection from Custom field  (Read 277 times)

VMx

  • Beginner
  • *
  • Posts: 6
  • A beginner
Change weight after changing selection from Custom field
« on: December 04, 2018, 00:24:42 am »
I use product with weight information which is than used for shipping calculation. And the product has "2 versions" which user selects by drop down menu (custom field). Now the problem which I have is that if user selects second option I don't want them to pay for shipping, so I need to somehow set weight to 0 for that product when user selects specific value from custom field drop down. Does anyone know how/where to do that? Is it even possible or maybe if not on product page maybe I can check at checkout if product has custom field X, than change weight to 0...

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8556
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Change weight after changing selection from Custom field
« Reply #1 on: December 04, 2018, 13:59:59 pm »
if u use parent/childs ( multivariant) each selection is an ind. product and can have its own weight
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1348
Re: Change weight after changing selection from Custom field
« Reply #2 on: December 04, 2018, 14:13:15 pm »
Yes child products is the way.
You can also check the stockable custom fields
https://breakdesigns.net/extensions/stockable-custom-fields

VMx

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Change weight after changing selection from Custom field
« Reply #3 on: December 04, 2018, 14:52:15 pm »
Yeah, I could solve this problem with child products, but my shop is very modified and a lot of other things would get broken with that. I must keep those 2 versions on selection box (because a lot of things rely on it - in basket, checkout, administration,...). That's the reason why I am searching for a way to change weight (and I will also need to change tax) for product after user selects another version or at least at checkout.

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1348
Re: Change weight after changing selection from Custom field
« Reply #4 on: December 04, 2018, 16:00:30 pm »
I don't think that you can change weight on the fly. This is a database field and called also in the cart and checkout.

Btw. I don't understand what you mean with " must keep those 2 versions on selection box".
You can use "selection box" with child products as well.

VMx

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Change weight after changing selection from Custom field
« Reply #5 on: December 04, 2018, 16:36:15 pm »
So the best way than is to modify code for checkout, to check which version is selected and there change information. Or would it maybe be possible to pass parameter to add to cart button to change weight/tax?

By " must keep those 2 versions on selection box" I meant as I wrote- this can not be removed and if I use another drop down what's the point in having 2 drop downs with same selections? :) It would be very confusing for users. The only way I could do this is by hiding current drop down and than later change default (selected) value according to the product/child I am at. But that is same if not more work as to do other changes, and also I am not sure how other things (like bundles) would handle child products,...

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9741
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Change weight after changing selection from Custom field
« Reply #6 on: December 06, 2018, 00:08:14 am »
Of course there is a way, for example with the customsizeplugin
https://extensions.virtuemart.net/product/products/custom-size-detail

never hack the core, write plugins. There is a trigger for that. You can change anything in the product, also name, or so
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/