Author Topic: How are prices calculated with Custom Fields? (code)  (Read 670 times)

EvanGR

  • Jr. Member
  • **
  • Posts: 491
How are prices calculated with Custom Fields? (code)
« on: August 12, 2022, 10:23:59 am »
Hello,

In the "add to cart" section, custom fields can have an effect on product price.

I know this section contains a <form> with html inputs, selects etc....

How can I create my own custom select element that will affect the product price, directly within the template?
(without going through VM's custom fields system)

e.g. I want to create a select box, with an option that will increase the product price by 10 euros.

Thanks

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10437
  • VirtueMart Version: 3+
Re: How are prices calculated with Custom Fields? (code)
« Reply #1 on: August 14, 2022, 01:28:13 am »
why?


what do you want to accomplish?

EvanGR

  • Jr. Member
  • **
  • Posts: 491
Re: How are prices calculated with Custom Fields? (code)
« Reply #2 on: August 15, 2022, 11:30:58 am »
I am trying to add a custom JS app, which inserts its own fields in the addtocart section.
It works fine so far, but I cannot add fields that affect product pricing.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1599
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: How are prices calculated with Custom Fields? (code)
« Reply #3 on: August 15, 2022, 14:33:46 pm »
It's sound like custom developping, maybe custom custom field?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4663
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: How are prices calculated with Custom Fields? (code)
« Reply #4 on: August 15, 2022, 18:08:21 pm »
You can use this custom field plugin https://shop.st42.fr/en/products/shortcodes.htm and implement your own system.
Of course the logic is the same as other plugin but it's more flexible
See the logic here https://shop.st42.fr/en/shorcodes-english-doc#cart_color

EvanGR

  • Jr. Member
  • **
  • Posts: 491
Re: How are prices calculated with Custom Fields? (code)
« Reply #5 on: August 17, 2022, 09:02:32 am »
Thank you!

Is there a starting point to develop a VM plugin for the product page/add to cart section?

Thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4663
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: How are prices calculated with Custom Fields? (code)
« Reply #6 on: August 17, 2022, 12:21:36 pm »
EvanGr, i do not how you want set the options and price
I read : I am trying to add a custom JS app, which inserts its own fields in the addtocart section.
This is hard to do because you need to find a way to convert the options to real VM values to calculate the price.
My plugin can simplify this part but in any case you have to create your own code to do the rendering > conversion to make it compatible with Virtuemart because price calc, so if you do not have PHP skills, i do not mean you can achieve this

EvanGR

  • Jr. Member
  • **
  • Posts: 491
Re: How are prices calculated with Custom Fields? (code)
« Reply #7 on: August 18, 2022, 08:28:27 am »
Thank you Studio for your help.

We do have PHP and JS skills, but little experience with the VM architecture.
I checked your plugin, and it may be helpful (do not know yet).

However we are exploring ways to do it as simple as possible without extra layers of complexity.
Integrating directly with VM would be ideal.

Thanks!