Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2017
    Location
    USA
    Posts
    1
    Plugin Contributions
    0

    Default Min / Max Order Amounts not displaying correctly on product info page

    Hi -

    Inherited a 1.5.1. site with some customizations done to it. Trying to get the product order minimum and order maximum to display correctly on the product page. Regardless of whether I enter a number in the order minimum field or order maximum field for any given product, the text that appears on the product info pages is "This product has a minimum order amount of X."

    My assumption (which could be wrong) is that the text should change depending on which field has data in it, minimum order qty or maximum order qty. End result being "This product has an order minimum of X." or "This product has an order maximum of X."

    Code is below if anyone sees anything that is clearly wrong. Any help would be appreciated!

    Thanks!

    Code:
    <!--bof Add to Cart Box -->
            <?php
            if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
              // do nothing
            } else {
            ?>
                        <?php
                $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
                        if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
                          // hide the quantity box and default to 1
                          $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
                        } else {
                          // show the quantity box
               // joe edit original $the_button = '<div class="qty-box m-input-prepend"><span class="add-on">'. PRODUCTS_ORDER_QTY_TEXT . '</span><input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" class="m-wrap"/></div>' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<input type="submit" class="button large add-cart" value="'.BUTTON_IN_CART_ALT.'" />';
        
    // joe edit begin adding if statement below to look to see if there is a minimum order number
            if (zen_get_products_quantity_min_units_display((int)$_GET['products_id']) == '') {
              $the_button = '<div class="qty-box m-input-prepend"><span class="add-on">'. PRODUCTS_ORDER_QTY_TEXT . '</span><input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" class="m-wrap"/></div>' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<input type="submit" class="button large add-cart" value="'.BUTTON_IN_CART_ALT.'" />';
            } else {
                $the_button = '<div class="qty-box m-input-prepend"><span class="add-on">'. PRODUCTS_ORDER_QTY_TEXT . '</span><input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" class="m-wrap"/></div><div class="">Note: This product has a minimuum order amount of' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '</div><input type="submit" class="button large add-cart" value="'.BUTTON_IN_CART_ALT.'" />';
            }
    // joe edit end
                        }
                $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
              ?>
              <?php if ($display_qty != '' or $display_button != '') { ?>
                <div id="cartAdd">
    <!--bof Custom Text -->
    <?php echo (($flag_show_product_info_customtext == 1 && $products_custom_text !='') ? '<strong>' . $products_custom_text . '</strong>' : '') . "\n"; ?>
    <!--eof Custom Text -->
                <br class="clearBoth" />
                <?php
                  echo $display_qty;
                  echo $display_button;
                        ?>
    				
    				<!-- remove Checkout Now Button that appears when cart has something in it 
    				
    <?  if (($_SESSION['cart']->count_contents()) <>'') {
    ?>
    <br class="clearBoth" />
    <br class="clearBoth" />
    <a href="index.php?main_page=checkout_shipping" title="checkout now" class="button large add-cart" style="background-color:#ff6600;">Checkout Now</a> 
    <br class="clearBoth" /> 
    <?  
        }
    ?> 
    
    end remove Checkout Now button -->
    				
                      </div>
              <?php } // display qty and button ?>
            <?php } // CUSTOMERS_APPROVAL == 3 ?>
            <!--eof Add to Cart Box-->

  2. #2
    Join Date
    Jul 2012
    Posts
    14,804
    Plugin Contributions
    17

    Default Re: Min / Max Order Amounts not displaying correctly on product info page

    I have had this tabbed for a bit to look at but hadn't really dug in properly to try to address what is going on, what is expected from the software and possibly what is trying to be done. Even with that "little" I don't think I've looked at it all.

    I did figure out why it seems that the else is likely always executed. Short of it is: the only time that zen_get_products_quantity_min_units_display returns '' is if the min order is 1, the units are 1 and the max is set to 0... any other combination of those will cause the function to return text that includes the characteristic and what is allowed for that characteristic. I.e. The text about a maximum quantity and the value allowed, that units are affected and the actual units permitted/required, that a minimum is in effect and what that minimum is.

    Further I notice in the description of the perceived logic that it seems like a minimum and a maximum are thought to be two separate items where only one or the other can exist. They are not mutually exclusive but the maximum does if for no other reason than logic need to equal or exceed the minimum. :) I don't know off the top of my head if there is such a check, but it would not surprise me either way if there was or was not. In the end it comes down to what can be purchased on the store front and a product having a maximum that is less than the minimum generally would be expected to be rejected in some way from being purchased.

    Anyways, it is possible that a product could be purchased that has a minimum of 4 items, with a maximum of 6 and units of 2... All three of those would be expected to be reported in the text around the add-to-cart button based on default software.

    If you want to evaluate results available through the ZC software, may I suggest reviewing how the function zen_get_products_quantity_min_units_display makes its results available? That function can be found in includes/functions/functions_prices.php. It calls a few other things to then take action and build the data to be displayed. You may find that one or more of those sub-functions give you the data you seek.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

 

 

Similar Threads

  1. Min/Max under product photo on product listing page
    By indigo-island in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 11 Jan 2010, 09:25 PM
  2. Product Info page not parsing correctly
    By apt3studios in forum General Questions
    Replies: 3
    Last Post: 6 Feb 2009, 09:54 PM
  3. Tax not Displaying Correctly on Order Slips/Invoices
    By gregoryjameswood in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 28 Feb 2007, 10:37 AM
  4. Lining up info correctly on the My Account / Order Info Page
    By eist1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Sep 2006, 09:34 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR