News:

Support the VirtueMart project and become a member

Main Menu

How are prices calculated with Custom Fields? (code)

Started by EvanGR, August 12, 2022, 10:23:59 AM

Previous topic - Next topic

EvanGR

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


EvanGR

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

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

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

Thank you!

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

Thanks

Studio 42

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

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!