News:

Support the VirtueMart project and become a member

Main Menu

Custom field with standard price (Same price with or without tax)

Started by chimairax, January 24, 2018, 17:00:34 PM

Previous topic - Next topic

chimairax

I have 2 shopper groups :
One with VAT 24% and one without VAT.

My custom field calculates the VAT automatically.

Let me help you:

Example

TV 32 inches

Price: 300€

Warranty 2 years from manufacturer

Do you want 1 year extra warranty?
✓ Yes (+40,00€) ☐ Νο

My shop is configured now like this:
If a company (without VAT) buy the TV and the extra warranty, they will pay:
241,94€ for the TV (the same price without VAT) and 40.00€ for the extra warranty.

On the other hand if a regular shopper (he is in 24% VAT shopper group) buy the TV and the extra warranty he will pay:
300€ for the TV and 49.60€ for the extra warranty

But I don't want the regular shopper to pay 49.60€, I want him to pay 40€ like the company because the extra warranty is tax free.

How can I configure it to be the same price for both of the shopper groups?
Joomla 3.8.13
Virtuemart 3.4.2

chimairax

A mod moved this post and turned it into thread.

I edited my first post for better explanation of what I need.
Joomla 3.8.13
Virtuemart 3.4.2

chimairax

I thought something like this:

at calculationh.php
line 369
$basePriceShopCurrency = $basePriceShopCurrency + $variant;

First create a table in DB
let's name it CustomVAT

Here we will add a field "VAT24" with value 1.24.

After this:

If shoppergroup with 24% VAT (ID=2)
then
$basePriceShopCurrency = $basePriceShopCurrency + $variant / *CustomVAT Table & VAT24 Field*;

(Asterisks is the code will fetch the 1.24 value from database - I don't know how to write it though, I am not a programmer)

Then the same

If shoppergroup with 0% VAT (ID=13)
We will add a field "VAT0" with value 1.

Then again
$basePriceShopCurrency = $basePriceShopCurrency + $variant / *CustomVAT Table & VAT0 Field*;

This will give us the desired result. Can anyone help me achieve this?
Hope I helped here.
Joomla 3.8.13
Virtuemart 3.4.2

Studio 42

You can achieve this on doing a custom field plugin and recalculate the warranty dynamically (and remove tax if this is set in custom field warranty).
Eg. something simillar to http://pro.st42.fr/en/shortcodes/checkboxes-insurances.html(i don't modifed it for your case)

chimairax

Quote from: Studio 42 on January 29, 2018, 16:16:02 PM
You can achieve this on doing a custom field plugin and recalculate the warranty dynamically (and remove tax if this is set in custom field warranty).
Eg. something simillar to http://pro.st42.fr/en/shortcodes/checkboxes-insurances.html(i don't modifed it for your case)
I'm sorry but I didn't understand your example

----

I thought another solution:
Via shoppergroup description

At line 369:

Default: $basePriceShopCurrency = $basePriceShopCurrency + $variant;
Desired fix: $basePriceShopCurrency = $basePriceShopCurrency + $variant / *shopper group description*;

I don't know how to call my shopper's shopper group description though..
Joomla 3.8.13
Virtuemart 3.4.2

Studio 42

Your solution is to hack core.
My solution is to use a customfield plugin, so you can customize the render to display :
Do you want 1 year extra warranty?
✓ Yes (+40,00€) ☐ Νο
If you prefer hack the code, i don't agree and this is not safe and your changes get removed on update Vm.

My plugin have not the changes you want, it was only a similar example for the render, not changes for shopper groups, this is specific and code do not exist but i know i can do it.