Added helper to chek if number of uses is reached
This commit is contained in:
@@ -41,6 +41,9 @@ use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
|||||||
class Coupon extends BaseCoupon
|
class Coupon extends BaseCoupon
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Define the value of an unlimited coupon usage.
|
||||||
|
const UNLIMITED_COUPON_USE = -1;
|
||||||
|
|
||||||
use ModelEventDispatcherTrait;
|
use ModelEventDispatcherTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -265,6 +268,9 @@ class Coupon extends BaseCoupon
|
|||||||
return CouponModuleQuery::create()->filterByCouponId($this->getId())->find();
|
return CouponModuleQuery::create()->filterByCouponId($this->getId())->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isUsageUnlimited() {
|
||||||
|
return $this->getMaxUsage() == self::UNLIMITED_COUPON_USE;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get coupon usage left, either overall, or per customer.
|
* Get coupon usage left, either overall, or per customer.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user