Round Number

Permalink Browser Info Environment
Hi,

I'm using the giftcard plug-in for my e-shop but I've a question. When I use a discount with percent. I've got a discount like 27.36.- or 14.19.-, how or in wich file and line can I round those number to have something like 27.35.- or 14.20.- ?

Thank your for your answer and sorry for my terrible english.

Type: Discussion
Status: New
Rmg
View Replies:
Mainio replied on at Permalink Reply
Mainio
Hi!

And thanks for the message. Your English is perfect as I can completely understand you (which is the most important thing).

The file you need to override is:
/packages/core_commerce_gift_cards/models/core_commerce/payment/coupon/transaction/queue.php

So copy that file into your root-level directories, so it will be in:
/models/core_commerce/payment/coupon/transaction/queue.php

Then in that file you can see this comment:
// Check how much to be paid from this coupon


And under that you see the if-clause that checks whether it's a percentage gift card.

So the line you need to change in that file is:
$amt = round($orderCanBePaid * ($coupon->getValue()/100), 2);


Hopefully this answers your question!

Best,
Antti / Mainio
Rmg replied on at Permalink Reply
Rmg
Thank you for the fast answer !

I Just Change the round function to 0.1, 0.2 … 

So I turn this
$amt = round($orderCanBePaid * ($coupon->getValue()/100), 2);

to
$amt = round($orderCanBePaid * ($coupon->getValue()/100), 1);


Thank you !

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.