UPDATES EasyBlog 6.0.11 Released! Update to the latest version now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is online
Our support specialists is available now. We will attend to you as soon as we can.
  Support is online
Normal
We have a setup where we sell cupon codes with a amount of time. You can buy 1 year or 3 months. Payment is made with cash at conferences and at a webshop. (This is manual done and we will continue with this.)

I have setup a fixed plan with the price: 0, expiration time: 1 day.

I made a cupon code, type: "Subscription Extension", extend time: 1 year.

When I try to purchase this plan with the cupon code, i get the following error: "Maximum allowed discount crossed, so only allowable discount applied"

The troubles is in the last if statement, because: $existingDiscounts = "0.00" and $allowedAmount = float(0).

public function checkForUpperLimit(&$newModifier, $invoice)
{
$subTotal = $invoice->getSubtotal();
$discountable = $invoice->getDiscountable();
$actualTotal = $subTotal + $discountable;

$maxDiscount = (float) $this->config->get('allowedMaxPercentDiscount');
$allowedAmount = ($maxDiscount * $actualTotal) / 100;

$existingDiscounts = $invoice->getDiscount();

// If existing discount is already greater or equal to max allowed
if ($existingDiscounts >= $allowedAmount) {
return false;
}
[...]


Discount is set to 100% in the global settings.

Is my approach wrong or could we make a fix?

Thanks in advance!
The replies under this section are restricted to logged in users or users with an active subscription with us