Add additional costs at "Upload your image" field

  • Posts: 53
  • Thank you received: 7
  • Hikashop Multisite
1 year 2 months ago #354746

Hi Nicolas,

Okay, I get it (I guess ;-)).

I've come a little step further, but I'm not completely there yet. I'm struggling with the formulas, probably because I don't speak boolval and so on. So, I've simplified the choices.

Situation 1:

  • product has 4 custom fields: kaarsjes + ijsfontein2 + bvs + marsroos
  • {cart_product_quantity}*({price}+{kaarsjes}+{ijsfontein2}+{bvs}+{marsroos})
  • this functions well, at least... almost* well
  • ap.lc/N550n

Situation 2:
  • product has 5 custom fields: kaarsjes + ijsfontein2 + bvs + marsroos + uploadafbeelding
  • {cart_product_quantity}*({price}+{kaarsjes}+{ijsfontein2}+{bvs}+{marsroos}+boolval(strlen({uploadafbeelding}))*8.5)
  • this doesn't add the upload file €8,50. Everything else is almost* correct
  • ap.lc/lSRSB
  • here, not only the custom fields are added without VAT, also the product itself shows without VAT at the "Calculated price"

Situation 3:
  • product has 6 custom fields: personen30 + kaarsjes + ijsfontein2 + bvs + marsroos + uploadafbeelding
  • {cart_product_quantity}*({price}*{personen30}+{kaarsjes}+{ijsfontein2}+{bvs}+{marsroos}+boolval(strlen({uploadafbeelding}))*8.5)
  • this doesn't work at all.*. When for instance 30 persons are selected, only €2,90 is displayed
  • ap.lc/cD12t

*Almost: all of the custom item fields have issues with VAT. It seems that when the product is in the shopping basket, an extra 9% VAT is added to the custom fields. I've tried to search into the settings of the VAT, if I have to switch off/on something, but I can't find it.

Conclusion: I've probably messed up the formulas. I'm really very sorry for that...!

So, I'm/we are almost there, I hope (for you!).

Thanks again for your help!

Regards,

Ans

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
1 year 2 months ago #354754

Hi,

The taxes will indeed apply on all the values.
So for example, if you have a rule like this:
{cart_product_quantity}*({price}+{field})
Suppose that the quantity is 1 the price without taxes is 10 and the field value is 10, the system will calculate the price without taxes to be: 1 * ( 10 + 10) = 20 and then it will add the tax rate on that €20 price.
So the values you enter in your custom fields need to be the values without taxes.
And it's the same for the 8.5 value. It will be the value without taxes and the taxes will be added on top of it. So you might need to adapt this in your formula.

Please Log in or Create an account to join the conversation.

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
1 year 6 days ago #356213

Hi Nicolas,

Ans asked me to have a look at her website so this is what i found in the plugin.
I don't know if this a wrong configuration of the website or a bug in the plugin, but i can't solve it by changing the options.

I have created a simple formula to explain the problem
{cart_product_quantity}*({price}+{kaarsjes})

mitz.westerbos.nl/index.php/webshop/taar...t/slagroomtaart-rond
The cake costs 25.69 (28.- incl.)
A candle in this example costs 0.9174311 (1,- incl)
and must therefore be entered excluding VAT
(see 1.png)

Then I select 1 cake + 1 candle
(see 2.png)

Below that is the (wrong) price because 28 is incl. 9%VAT and 0.92 is excl VAT
This should, of course, be 28 + 1 = 29.
(see 3.png)

When i go to the checkout , i see the right prices and tax calculations because the Cake and the candle is calculated with 9% VAT
(see 4.png)

In the plugin (calculations.php) around line 85 i see the value is used but i don't see any TAX-rules and i don't know how to add it
Can you help us how to fix this?

Thanks in advance

Kind regards,
Jeroen Moolenschot

Attachments:
Last edit: 1 year 6 days ago by Joomill.

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
1 year 6 days ago #356219

Hi,

Thanks for the clear explanation of the issue.

The problem is this:
- the plugin is initially made to use untaxed prices, make the calculation, and then calculate the taxes on the result of the calculation.
- on top of this, we've added the javascript side to take the data from the product page and send it to the server side to get the calculation done so that it can be refreshed dynamically on the page.
- the data on the product page is displayed with taxes (when you configure HikaShop to do so) and so the variants and options, provide their price on the javascript side already taking into account how Hikashop is configured (that's thanks to a patch I made one month ago as before it was using the price without taxes)
- so on the server side, the plugin has the price with options / variants taken into account, which can be taxed. However, the value from the custom fields still isn't taxed even though it should here.
So that why you get a price which is a sum of the taxed base price plus the untaxed extras.

I've worked on a patch to handle this. Basically, the controller called by the javascript will add an extra flag to the product object to tell the area replacing the tags that it wants the values to be taxed.
I've published a new version of the plugin with the patch. Please download it again and install it on your website and it should handle this properly.

Please Log in or Create an account to join the conversation.

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
1 year 6 days ago #356229

Hi Nicolas,

Thanks for your quick reply and fix.
I have installed the new plugin, but i don't see any differences on the website.
The Candles are still ex VAT and the cake incl VAT in the calculated price on the productpage.
Can you have a look at it?
Thanks
Jeroen

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
1 year 5 days ago #356232

Hi,

I can't check anything with just the link of the page as the problem is on the server side.
I'm suspecting that the problem might be that the plugin is trying to use the tax category id of the variant and if empty, it doesn't look for the tax category id of the main product in order to calculate the taxes on the values of the tags.
Could you provide a FTP access so that I could check things out ?
You can use our contact form to provide an access:
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
1 year 5 days ago #356255

Hi,

Thanks for the FTP access.
I was able to make another patch. It seems to work fine now on your website. I've updated the plugin install package on our website too with that new patch.

Please Log in or Create an account to join the conversation.

  • Posts: 53
  • Thank you received: 7
  • Hikashop Multisite
8 months 2 weeks ago #359070

Hi Nicolas,

Unfortunately I'm still having an issue with this. I'll try to keep it as clear as possible:


  1. mitz.westerbos.nl/index.php/webshop/taar...sepeintaart-vierkant has several options, among which the "Tekst op taart €2,95" and the "Foto op taart €8,50" option.

  2. mitz.westerbos.nl/index.php/webshop/taar.../chipolatataart-rond also has options, the same as the product above, except for the "Foto op taart €8,50"

When you select the options "Tekst op taart" and "Foto op taart" on product 1, everything adds up perfectly. The VAT is correct, the price is as it should be.
When you select the option "Tekst op taart" on product 2, something strange happens. Not the €2,95 is added, but only €2,71. And that's weird, because on a product which has another extra option ["Foto op taart"], the calculation is right.

So I've been calculating, when I use €2,706 in the value area of the Field data, then the €2,95 is correct on product 1. FYI, 2,706 is €2,95 minus 9% VAT = €2,706.
When I use €2.483 in the Field data, then the €2,95 on product 2 is correct. €2,483 = €2,95 minus 9% minus 9%. Somewhere down the line there is an error with the VAT, but we just can't figure out where to look any further.

I hope it still is clear to you what I'm writing about. Perhaps it's better to see for yourself. Because of some issues the webhost is heaving with a certificate, the URL's are only accessible with an private-screen of your browser...

Perhaps this has something to do with the information text underneath the formulas area. [Finally, note that you can enter several formulas (for example, if you have different custom fields for different types of products and thus you need different formulas). However, only the first matching formula will be used for a given product price.]

I've got another question, but first let's get this thing working... Please let me know if you need extra information or access to the administrator/FTP.

Looking forward hearing from you.

Regards,

Ans

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
8 months 2 weeks ago #359071

Hi,

Yes, I'll need a backend and a FTP access in order to check your settings and do some debugging as it's a complex issue.
Can you provide these via our contact form ?
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 53
  • Thank you received: 7
  • Hikashop Multisite
8 months 2 weeks ago #359084

Hi Nicolas,

I've just sent you the login information.

Perhaps it's better to ask you about the other issue I have right now, and not to wait.

There are 5 products that are different from the rest. For example: mitz.westerbos.nl/index.php/webshop/taar...nt-vanaf-30-personen .
All 5 have a minimum limit of 30 and a maximum of 200 persons to order. They don't have the same price:

  • 1 cake is €2,90 per person
  • 2 cakes are €3,- per person
  • 2 cakes are €3,10 per person

Is this also been done by the Calculation plugin? Or is there some other way to handle this?

Thank you very much for all the help your giving me!

Regards,

Ans

Please Log in or Create an account to join the conversation.

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
8 months 2 weeks ago #359138

Hi,

Thank you for the access.
I found the issue and fixed it.
The issue was that the tax would be calculated on the value of the custom item field each time a formula would be evaluated for that field and instead of discarding the calculated value for the next formula, it would used that already taxed value as the value of the custom item field for the next formula, and thus tax it again.
On the second product, since it would be using the second formula instead of the first one, and that both had the tag for this "Tekst op taart €2,95" custom item field, the result of the calculation would end up with the value of the field being taxed twice.
I've pushed a new version of the plugin with the patch for this:
www.hikashop.com/marketplace/product/148...ce-calculations.html

Regarding your question on the second message:
I'm not sure I understand what you're trying to do. In your message, you basically wrote that the price per person needs to be higher the more cakes someone purchases. Shouldn't it be the other way around ?
And can't you use the "minimum quantity" setting of the product prices with several prices if you want to have a different base price based on the amount of the product being purchased ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum