VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: TaDrik on April 10, 2021, 18:30:09 PM

Title: Price modifacation with installments
Post by: TaDrik on April 10, 2021, 18:30:09 PM
Hello to all.

I am developing an eshop and I have the below issue.
I am using the "SalesPrice" in the productdetails page, and I have a custom field that modifies the price. Below the "SalesPrice" I need to have 4 more prices, that will display the price with installments (SalesPrice multiplied by 1.3%, 1.7% etc) I have managed to show the prices by adding some php rows in the default.php in the productdetails directory, but in this way the prices are not modified when I use the custom field. What can I do for that?
Thank you in advance
Title: Re: Price modifacation with installments
Post by: Jörgen on April 10, 2021, 21:06:20 PM
This is probably wrong approach. The price You modify will not show in checkout right ?

either You buy a custom plugin or make one yourself. The vmcustom text plugin is a good start to make some changes.

Jörgen @ Kreativ Fotografi
Title: Re: Price modifacation with installments
Post by: GJC Web Design on April 10, 2021, 21:30:06 PM
https://forum.virtuemart.net/index.php?topic=127362.0 ?

and keep your displays just as information
Title: Re: Price modifacation with installments
Post by: TaDrik on April 11, 2021, 09:13:38 AM
Thank you all for your answers. Maybe I didn't describe the issue well.
I am using the plugin that GJC Web Design posted. With this plugin I have a custom field that adds a 15.5% fee if the customer choose it. Everything works fine there. Below the price I have 4 more prices that are for the price modification when installments are chossen. (6, 12, 18, 24 installments) These prices are not changed, when the custom field is choosen, because are calculated in the default.php file of the productdetails directory with php that make the calculation of the salesprice * 1.079 . I beleieve that the calculation of the installments must be done somewhere else. Thats where I need help.
See screenshots below.
Screen1 is with the custom field to "no"
Screen2 is with the custom field to "yes"
Thank you again
Title: Re: Price modifacation with installments
Post by: pinochico on April 11, 2021, 14:52:39 PM
Ok,
then change your calculation from Sales price to Value of customfield (plugin from GJC) * value of your TAX (not 1.079)
If I'm correct, then if you change pieces on product details or TAX in admin, result from calulation will be changed dynamic nad right.
Title: Re: Price modifacation with installments
Post by: AH on April 12, 2021, 11:14:10 AM
Do you have to show the price of the spread payment on the product details - before it is selected

If not then just do it using the plugin

The variable for the plugin will be something like

Pay all now,6 months@*1.17,12 months@*1.2 


The price would then be displayed when a drop is chosen - the default being the price without and deferred payment term
etc

You could show the options as radio buttons - for better display - along with the final price for that option
Title: Re: Price modifacation with installments
Post by: AH on April 12, 2021, 12:15:35 PM
If you are using the * modifier - you can easily change the default.php display to show the prices calculated for each radio button  as shown in my included image

I have just enhanced the plugin to cater for the display of a calculated value when a multiplier is used - it is the full value of the sales price - but you can modify that if you desire.  The option to display this is a new configuration in the customfield setting at customfield and product/customfield level

https://forum.virtuemart.net/index.php?topic=127362.0 (https://forum.virtuemart.net/index.php?topic=127362.0)
Title: Re: Price modifacation with installments
Post by: TaDrik on April 14, 2021, 09:41:26 AM
Quote from: AH on April 12, 2021, 12:15:35 PM
If you are using the * modifier - you can easily change the default.php display to show the prices calculated for each radio button  as shown in my included image

I have just enhanced the plugin to cater for the display of a calculated value when a multiplier is used - it is the full value of the sales price - but you can modify that if you desire.  The option to display this is a new configuration in the customfield setting at customfield and product/customfield level

https://forum.virtuemart.net/index.php?topic=127362.0 (https://forum.virtuemart.net/index.php?topic=127362.0)

Thnak you for your answer. That did the trick.
I have a problem with the prices when checking the option "Show price when using a Multiply modifier" whitch are not incuding TAX, but I will post it to the plugin's topic. 
Title: Re: Price modifacation with installments
Post by: AH on April 14, 2021, 10:11:03 AM
If you look in the template code tmpl/default.php

I have included the option for you to use the vat inclusive price


// new config option to allow price to be shown for multiplier 2021
if(isset( $params->custom_qvariant_multiplier_showprice ) && $params->custom_qvariant_multiplier_showprice === "1"){
if($modifier == "*" and !empty( $price )) {
// Decide what you want to show - may not be right for you all
$net_multiplied_price = $product->prices["priceWithoutTax"] * $price;
$vat_inclusive_multiplied_price = $product->prices["salesPrice"] * $price;
$variantselect = $variantselect .' ('.$currency->priceDisplay( $net_multiplied_price ).')';
}
}


You just need to change this line:

$variantselect = $variantselect .' ('.$currency->priceDisplay( $net_multiplied_price ).')';

to

$variantselect = $variantselect .' ('.$currency->priceDisplay( $vat_inclusive_multiplied_price ).')';