- Posts: 259
- Thank you received: 22
Tax on Custom Price
- rodfarrell
-
Topic Author
- Offline
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Can you explain me exactly how are you using the custom price plugin and how do you expect it to work ?
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
What we need to do is pass the price into the product and have the tax calculated at 20%. I've tried to do this by adding a calculation in the plugin php however the tax amount is then not passed to the total of the checkout as you can see at the link above.
Please Log in or Create an account to join the conversation.
So it's probably that the changes you made in the plugin are not correct.
Did you defined the taxes array of the price with the necessary tax object ?
That is necessary if you have the "show detailed taxes" option of the configuration turned on (which you probably don't need in your case since you only have one tax rate).
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
Should the plugin handle tax calculations or is this something that we need to code ourselves?
Please Log in or Create an account to join the conversation.
If you want to add the taxes support for it, you'll have to modify the code to handle it. But it should be really simple.
Here is the line for the price with taxes in the plugin:
$product->prices[$k]->price_value_with_tax = $product->amount;
If you want to add a 20% tax on it, you can change it to:
$product->prices[$k]->price_value_with_tax = $product->amount*1.2;
But for that change to work properly you will need to turn off the "show detailed taxes option of the configuration as I already said.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
I've moved the test site to test1.trueerp.co.uk
Please Log in or Create an account to join the conversation.
Can you double check it ?
Otherwise, add the line:
if(isset($price->taxes)) unset($product->prices[$k]->taxes);
after the line:
foreach($product->prices as $k => $price){
and that should help force the system to display the tax for the full total.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
Unless I'm missing something this means that unsetting the value of $product->prices[$k]->taxes results in no value in the cart total because it never gets reset.
Please Log in or Create an account to join the conversation.
I don't know what you did but it's working fine for me.
I've made it an option of the plugin so that you can activate the tax handling on the amount.
I've also made it compatible with both tax mode.
Please install that plugin and activate the tax handling and it will work.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
- Posts: 259
- Thank you received: 22
I have a Fabrik form that calculates field values, passing those values to the shopping cart via the custom price plugin where the tax calculations are done.
Live site is www.trueerp.co.uk/licenses
When I get a few minutes I will create and post a tutorial video on how this is achieved for anyone else that wants this kind of functionality. The only downside is that currently Fabrik is not stable on Joomla 3 so I had to use 2.5
Please Log in or Create an account to join the conversation.