- Posts: 240
- Thank you received: 17
Events Booking version 2.6.0 released
- Donal
- Offline
- Elite Member
Less
More
8 years 3 months ago #86655
by Donal
In short, I have a working solution now using percentage discounts. So that I don't get discounts of 10.01, I needed to put in a floor function into the calculateCartRegistrationFee method. This is required because the structure of coupons.discount is Decimal(10,2). Can you change this structure to allow for more decimal points? This would then give the correct discount without needing customisations, I think.
To give a €10 discount off an amount of €264, the percent should be 3.787879. Event booking truncates this to 3.79, which gives a discount of 10.0056, which when rounded to 2 decimal places is €10.01.
Do you think the structure of coupons.discount can be changed in an official release?
Regards,
D
Replied by Donal on topic Events Booking version 2.6.0 released
I wrote a long email, but included my code edits, and Sucuri blocked my post.Tuan Pham Ngoc wrote: Hi Donal
The file which is used to calculate discount is components/com_eventbooking/helper/helper.php. The method is calculateCartRegistrationFee
Please try to look at it to see whether you can customize/fix this issue? If you want to store the data into database, too, then you might want to look at components/com_eventbooking/model/cart.php, method processCheckout
In short, I have a working solution now using percentage discounts. So that I don't get discounts of 10.01, I needed to put in a floor function into the calculateCartRegistrationFee method. This is required because the structure of coupons.discount is Decimal(10,2). Can you change this structure to allow for more decimal points? This would then give the correct discount without needing customisations, I think.
To give a €10 discount off an amount of €264, the percent should be 3.787879. Event booking truncates this to 3.79, which gives a discount of 10.0056, which when rounded to 2 decimal places is €10.01.
Do you think the structure of coupons.discount can be changed in an official release?
Regards,
D
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Topic Author
- Offline
- Administrator
8 years 3 months ago #86665
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Events Booking version 2.6.0 released
Hi
For now, I won't change it (but I agree that change it won't cause any issue), I just have to check it carefully before making the changes to offical package
However, you can make the change directly to the table on your site database. It won't be lost when you update to future releases of the extension, so there is nothing prevent you from doing the change
Regards,
Tuan
For now, I won't change it (but I agree that change it won't cause any issue), I just have to check it carefully before making the changes to offical package
However, you can make the change directly to the table on your site database. It won't be lost when you update to future releases of the extension, so there is nothing prevent you from doing the change
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Donal
- Offline
- Elite Member
Less
More
- Posts: 240
- Thank you received: 17
8 years 3 months ago #86731
by Donal
Replied by Donal on topic Events Booking version 2.6.0 released
Hi Tuan,
thanks for the confirmation that nothing would break. I changed the structure to Decimal(13,10) and now my discount is right, without any need for code modification.
thanks for the confirmation that nothing would break. I changed the structure to Decimal(13,10) and now my discount is right, without any need for code modification.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Topic Author
- Offline
- Administrator
8 years 3 months ago #86748
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Events Booking version 2.6.0 released
Great. Very happy to hear that it works
Tuan
Tuan
Please Log in or Create an account to join the conversation.
- Donal
- Offline
- Elite Member
Less
More
- Posts: 240
- Thank you received: 17
8 years 3 months ago #86868
by Donal
Replied by Donal on topic Events Booking version 2.6.0 released
I spoke too soon, Tuan.
Stripe refused the transaction, reason: Amount precision is too high for currency.
I'm back to using the floor function.
Regards,
Donal
Stripe refused the transaction, reason: Amount precision is too high for currency.
I'm back to using the floor function.
Regards,
Donal
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.