I wanted to confirm before I posted a 'bug'. It's more a semantic issue...
Since Gift Certificates must have a Model code starting with GIFT (the string must be tested in the Order Total modules, and be used in all the gift certificate sharing and sending code) then it can be said that Zen Cart 'knows'about Gift Certificates through this Model code, GIFTwhatever...
Now when there is a discount Coupon being redeemed against an order, there is some code run which assesses the order value, to see if it meets any minimums set on the Coupon and if it fails, a standard message is punted back to the browser.
In \includes\modules\order_total\ot_coupon.php :-
In this call to the local function get_order_total, the value of each line is added to the order_total if it is 'valid'Code:if ($this->get_order_total() < $coupon_result->fields['coupon_minimum_order']) { zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(sprintf(TEXT_INVALID_REDEEM_COUPON_MINIMUM, $currencies->format($coupon_result->fields['coupon_minimum_order']))), 'SSL',true, false));
is_product_valid, from my search, comes from \includes\functions\functions.general.php, and looks like this:Code:function get_order_total() { global $order; $products = $_SESSION['cart']->get_products(); $order_total = 0; for ($i=0; $i<sizeof($products); $i++) { if (is_product_valid($products[$i]['id'], $_SESSION['cc_id'])) { $order_total += $products[$i]['final_price'] * $products[$i]['quantity']; if ($this->include_tax == 'true') { $products_tax = zen_get_tax_rate($products[$i]['tax_class_id']); $order_total += (zen_calculate_tax($products[$i]['final_price'], $products_tax)) * $products[$i]['quantity']; } } } if ($this->include_shipping == 'true') $order_total += $order->info['shipping_cost']; return $order_total; }
So the standard text, TEXT_INVALID_REDEEM_COUPON_MINIMUM, (from english.php) which in my case is "You must spend at least %s to redeem this coupon" is misleading to those who try (despite the notices) to get a discount on a gift voucher, and do not have enough non-gift, otherwise valid products in their cart. As well as an insufficient mix, I also tried this for testing purposes with ONLY gift certificates in the cart, above and below the minimum order value for the discount Coupon and I got the same message each time.Code:function is_product_valid($product_id, $coupon_id) { global $db; $coupons_query = "SELECT * FROM " . TABLE_COUPON_RESTRICT . " WHERE coupon_id = '" . (int)$coupon_id . "' ORDER BY coupon_restrict ASC"; $coupons = $db->Execute($coupons_query); $product_query = "SELECT products_model FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . (int)$product_id . "'"; $product = $db->Execute($product_query); if (ereg('^GIFT', $product->fields['products_model'])) { return false; }
I think Zen Cart could be a bit more specific, but for now I have changed my TEXT_INVALID_REDEEM_COUPON_MINIMUM text to:
You must spend at least %s (excluding Gift Vouchers) to redeem this coupon
Either the standard text TEXT_INVALID_REDEEM_COUPON_MINIMUM should be changed so that it makes sense for shopkeepers and customers who can't pick these things over too much; or, for more usability, the message could indicate the qualifying value or even link to a pop-up showing why some goods are not included in the total for discount Coupon purposes.
Sorry, not volunteering, in the middle of final testing for go-live and no PHP experience until now... and, probably about to post on Gift Voucher problem with rounding of the Gift Voucher account balance....



