Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Location
    Christchurch, New Zealand
    Posts
    44
    Plugin Contributions
    0

    Idea or Suggestion GIFT and Discount

    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 :-
    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));
    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:
    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;
      }
    is_product_valid, from my search, comes from \includes\functions\functions.general.php, and looks like this:
    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;
        }
    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.

    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....

  2. #2
    Join Date
    Apr 2007
    Posts
    14
    Plugin Contributions
    0

    Default Re: GIFT and Discount

    Was actually looking for something else but the "answer" to this as I see it is to change the text for the defined constant TEXT_INVALID_REDEEM_COUPON_MINIMUM in /includes/languages/english.php to the suggestion you made.

    Hope that helps someone.

 

 

Similar Threads

  1. v150 Buying using both Discount Coupon and Gift Voucher - Disable One?
    By PetleyJ in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 5 May 2012, 02:48 PM
  2. Gift Certificate and Discount Codes Do NOt want applied to shipping
    By nolsowski in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 24 Sep 2011, 06:02 PM
  3. Gift certificate and discount coupon time outs
    By polyestercowboy in forum General Questions
    Replies: 0
    Last Post: 1 Mar 2011, 05:28 PM
  4. Removing Gift Certificate and Discount Coupon links
    By IA7X ShadowsI in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Oct 2010, 11:23 PM
  5. Turning Off Gift Certificate FAQ and Discount Coupons
    By HelenSama in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 12 Feb 2007, 03:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg