Author Topic: Price calculation with custom field and more then 1 quantity  (Read 350 times)

mohtashimj

  • Beginner
  • *
  • Posts: 20
  • A beginner
  • Skype Name: mohtashim.astecksoft
I am also getting issue for my Virtuemart Store LIKE I have product price as $10 and custom field (for Set Up charges) created with price $50 and when user adding this products with quantity 10 then the products total price is calculating as $600 and which should calculate as $150 ($100 + $50) .
Please any one let me know if I can do that with the help of custom fields?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4048
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Price calculation with custom field and more then 1 quantity
« Reply #1 on: June 19, 2019, 13:01:07 pm »
The price is always added for 1 product. So if you need to have same price for 10, you have to create a plugin which divides the price of the fields eg. for your case 50/10 in the plgVmPrepareCartProduct function.
This need to create your own product custom field.(i can do the work and some other devs here)

mohtashimj

  • Beginner
  • *
  • Posts: 20
  • A beginner
  • Skype Name: mohtashim.astecksoft
Re: Price calculation with custom field and more then 1 quantity
« Reply #2 on: June 19, 2019, 21:49:58 pm »
Thank you for your reply.

I am also a developer. Can you please let me know what exactly I need to do with the plugin so that I can work on it and will make as I needed.

In my case for one product I have one custom field which need the price to apply only once if customer have more then 1 quantity ie 20 or 10 and will have one more custom field for which price will apply on all the quantity.

Please let me if that will possible from the way you are suggesting?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4048
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Price calculation with custom field and more then 1 quantity
« Reply #3 on: June 20, 2019, 01:51:21 am »
Check the core vmcustom textinput plugin, you have all the code.
You need to adapt plgVmPrepareCartProduct function ti charge the right price per quantity.