VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Payment Modules => Topic started by: Kurosaki on December 17, 2007, 18:25:30 PM

Title: Add a tax only to an especific payment method
Post by: Kurosaki on December 17, 2007, 18:25:30 PM
Hello.. I know there is an option to add a discount value (or charge) if the buyer uses an especific payment method, but what if I want to add a discount (or charge) but in percentaje, as a tax for using this specific payment method.

Thanks for your answers.
Title: Re: Add a tax only to an especific payment method
Post by: Kurosaki on December 19, 2007, 18:35:10 PM
So, I only put an IF clause in the add() method of ps_checkout class, at the beggining asking if the current order's payment method is the ID that I want.

Not an ellegant solution indeed.
Title: Re: Add a tax only to an especific payment method
Post by: Josué (Yosu) Cadilla Andrés on December 20, 2007, 02:16:16 AM
Why change the code? It could lead to problems in the future.

Make a new paymen method and set rules accordingly. Guess I didn´t understand your problem.

Can you elaborate please?
Title: Re: Add a tax only to an especific payment method
Post by: Kurosaki on December 20, 2007, 02:33:12 AM
Do you remember when you are in the page of the add/modify payment method in the backend? Well.. there is an option to add a discount right? That means when anyone uses this method to pay he'll get that discount.

But the discount is a fixed value, not a percentaje of the order subtotal, which is what I need. For example, is anyone uses worldpay, he will have to pay 2% of tax. I repeat: ONLY IF HE USES THIS PAYMENT METHOD.
Title: Re: Add a tax only to an especific payment method
Post by: Josué (Yosu) Cadilla Andrés on December 20, 2007, 02:50:46 AM

Post a new feature request, in the mean time you could:

Create a nex tax or a new shiping cost and let users add it when using this payment method.
Standar shiping 3%
Shiping for payments with worldpay 5%

Title: Re: Add a tax only to an especific payment method
Post by: Kurosaki on December 20, 2007, 02:54:06 AM
Thats something similar what I did, but I didn't have any option to control that, so thats why in the code I ask if the payment method stored in the SESSION is the same ID that I previously know,, if that I apply the tax from the tax table. Crappy but I doesn't affect the rest.
Title: Re: Add a tax only to an especific payment method
Post by: Josué (Yosu) Cadilla Andrés on December 20, 2007, 03:00:37 AM
request a quote from http://www.vm-expert.com/
it is as easy as to modify the "add" operation for a "multiply" operation rigth where the final calculation is made, so you would imput a factor instead of a fixed value. but sorry I don´t know where to make that change.
Title: Re: Add a tax only to an especific payment method
Post by: Kurosaki on December 20, 2007, 16:45:38 PM
By the way, that feature is new in the virtuemart 1.1 beta 2
Title: Re: Add a tax only to an especific payment method
Post by: Josué (Yosu) Cadilla Andrés on December 20, 2007, 17:05:46 PM
Are you testing or working on a live site?