CalcBuilder Forum

Price difference on Product Page and hikashop Product

User Silvio De Boni 2025-09-23 15:12:39

Hi
I'm using Calcbuilder to create dynamic products here: www.blechladen.ch
We send the price to hikashop using this variable: $hk_pricehikaproduct=$resultprice;
This works well but the price calculated and shown with the product is not exactly the same as after in the cart.
We calculate the price already inclunding tax and haf the shop configured accordingly.
I can not see where that change is coming from as it is a rather small amount. For example calculated CHF 37.36, and in the cart it shows CHF 36.75 (so minus 0.61).
Do you have any idea where that price change could come from?
I have a test server set up at staging.blechladen.ch You should still have the login data.
I did several tests and could clearly isolate that problem is with the calcbuilder (and maybe excel) and not hiksahop.
To find the error I set up this debug file:
$debug_msg = date('Y-m-d H:i:s') . " - Result: " . $resultprice . " - HikaShop: " . $hk_pricehikaproduct . " - URL: " . $_SERVER . " - POST data: " . json_encode($_POST) . "\n";
file_put_contents('/home/rommetal/www/staging.blechladen.ch/logs/calcbuilder_price_debug.txt', $debug_msg, FILE_APPEND);

Maybe that helps

Best regards
Silvio

Moonsoft support 2025-09-24 13:17:26

Hi,
we have been testing your page and here our findings. From php version 8.x, there are some differences in terms of handling operations with strings, and for your specific case this happens to apply slight differences to the calculations, because of the different ways/format the excel functions recover the results when inline calculations are launched or when the final result is sent to the cart, because at your final result cell, there is a 'visual' number format, so you see at the cell 36,60 while the real value inside is 36.59661532 for ex.
We have unified the calculator functions so they will always use the same 'final' output, if you upgrade to latest version (already updated at staging) you should see same results.
Now, if you want to also ensure those formatted strings don't cause weird behaviors for further operations you may want to apply to the results at the php section, we suggest to also remove the excel format from that cell, return just a number, unformatted text, or maybe apply function =ROUND(....;2) if you want to round the number before sending the results, but without any other transfomation.

Please try from your side in order to confirm it works as expected.

Thanks, best regards
Guillermo V.
Moonsoft Team

User Silvio De Boni 2025-09-24 13:32:04

Hi
Thanks for you reply.
The page is not working anymore. I can not put the configured product into the shopping cart.
Best regards
Silvio

Moonsoft support 2025-09-24 14:53:23

Hi,
solved, sorry, there was a conflict with the new function of google recaptcha included in latest version.

Best regards
Guillermo V.
Moonsoft Team

User Silvio De Boni 2025-09-24 15:42:25

Great, thanks.
Now the price is the same.
Did you mean to format the cell I61 differently in the Excel?
We would like to round the price that is shown on the product page after the tax is calculated (as we display the prices with tax).
$resultprice = round($resultprice * 20) / 20;
$resultprice="CHF ".number_format($resultprice,2,".","'");
Is there anything that speaks against this solution?
Best regards
Silvio

Moonsoft support 2025-09-24 15:59:20

Hi,
yes, that's correct, you can round the result that way, no problem, only suggested to use a spreadsheet without formats applied to the result if you're going to use it for further operations at php section (as you do with result extracted from I61 cell). That way you will prevent unwanted behavior in case you use any specific format that the php math operators are not able to handle properly, but you can keep it if it doesn't cause issues to your output.

Best regards
Guillermo V.
Moonsoft Team

...
List Manager

Build different lists for your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!