VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Kuubs on September 27, 2023, 16:11:02 PM

Title: array intersect error when using coupon code allowed category
Post by: Kuubs on September 27, 2023, 16:11:02 PM
for( $i = 0; $i<$sizeof_cartitems_by_product; $i++ ) {

if( (!empty($allowed_product_ids) and in_array( $this->cartPrices[$i]['virtuemart_product_id'], $allowed_product_ids )) || (!empty($allowed_productcat_ids) and array_intersect( $this->products[$i]->categories, $allowed_productcat_ids )) ) {
$allow_coupon_byproduct = 1;
break;
}
}


This piece of code in the helper of the cart in /components/virtuemart/helpers/cart.php

sometimes gives an error because the array of products start at 1 instead of 0, which makes it error, because the first intersect is null instead of an array...