In
Corals/modules/Ecommerce/Classes/Coupons/Advanced.php
is this code - which makes no sense at this point:
if ($this->settings->products->count() > 0) {
$productlimited = true;
$cartitems = ShoppingCart::getItems();
foreach ($cartitems as $cartitem) {
if ($this->settings->users->contains($cartitem->id->product->id)) {
$productstotalprice += ($cartitem->qty $cartitem->price);
$productlimited += $cartitem->qty;
}
}
} It should be:
if ($this->settings->users->count() > 0) {
$product_limited = true;
$cart_items = \ShoppingCart::getItems();
foreach ($cart_items as $cart_item) {
if ($this->settings->users->contains($user->id)) {
$products_total_price += ($cart_item->qty * $cart_item->price);
$product_limited += $cart_item->qty;
}
}
}
Hello,
User Validation validation is in the validate function
public function validate($throwErrors = false, $user = null)
{
.
.
.
if (!$user) {
$user = user();
}
if ($this->settings->users->count() > 0) {
if ($this->settings->users->contains($user->id)) {
return true;
} else {
if ($throwErrors) {
throw new CouponException(trans('Ecommerce::exception.coupon.not_eligible_use_coupon'));
} else {
return false;
}
}
}
Hello,
Thanks for Pointing out the issue above, howeve I think instead of
if ($this->settings->users->contains($user->id)) {
it should be
if ($this->settings->products->contains($cart_item->id->product->id)) {
we just pushed a fix to the ecmmerce module
Should it be to check if only certain users are allowed to use the code or if the code is allowed only for certain products?
If not the first where is it checked that only certain users are allowed to use the code?
Thanks
ok – I guess it’s already checked in the validate function
Please login or Register to submit your answer