Forums / Templates, Stylesheets, Page Layout / Turn Off Max Quantity Display In Product Listing

Turn Off Max Quantity Display In Product Listing

Results 1 to 3 of 3
15 Mar 2012, 00:39
#1
suntower avatar

suntower

New Zenner

Join Date:
Nov 2010
Posts:
68
Plugin Contributions:
0

Turn Off Max Quantity Display In Product Listing

I posted this in the Products subforum and got no replies:

Is there a way to turn off the Max: 1 display in the products listing?

Our items don't allow for an Add button on the Products List so visitors see just the price @ right.

I want to use the Max Qty field as a 'flag' for certain items to display a msg, but when I set it to anything but zero it displays on the Products List.

How do I turn it off?

I looked in product_listing.php and durned if I can see where it is.

TIA,

---JC
15 Mar 2012, 13:41
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: Turn Off Max Quantity Display In Product Listing

The stock version of Zen Cart does not provide for styling (or not displaying) the min/max/unit/mix values in the "cartAdd" block. Here's an update to the function zen_get_products_quantity_min_units_display (present in /includes/functions/functions_prices.php) to add spans around each type of value so that they can be separately styled.

Note that this will result in a CORE FILE OVERWRITE, so make a backup copy of the functions_prices.php and then edit the file to fully replace the function.


////
// Return a products quantity minimum and units display
  function zen_get_products_quantity_min_units_display($product_id, $include_break = true, $shopping_cart_msg = false) {
    $check_min = zen_get_products_quantity_order_min($product_id);
    $check_units = zen_get_products_quantity_order_units($product_id);

    $the_min_units='';

    if ($check_min != 1 or $check_units != 1) {
      if ($check_min != 1) {
        $the_min_units .= '<span class="qmin">' . PRODUCTS_QUANTITY_MIN_TEXT_LISTING . ' ' . $check_min . '</span>';
      }
      if ($check_units != 1) {
        $the_min_units .= '<span class="qunit">' . ($the_min_units ? ' ' : '' ) . PRODUCTS_QUANTITY_UNIT_TEXT_LISTING . ' ' . $check_units . '</span>';
      }

// don't check for mixed if not attributes
      $chk_mix = zen_get_products_quantity_mixed((int)$product_id);
      if ($chk_mix != 'none') {
	    $the_min_units .= '<span class="qmix">';
        if (($check_min > 0 or $check_units > 0)) {
          if ($include_break == true) {
            $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
          } else {
            $the_min_units .= '  ' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
          }
        } else {
          if ($include_break == true) {
            $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
          } else {
            $the_min_units .= '  ' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
          }
        }
		$the_min_units .= '</span>';
      }
    }

    // quantity max
    $check_max = zen_get_products_quantity_order_max($product_id);

    if ($check_max != 0) {
	  $the_min_units .= '<span class="qmax">';
      if ($include_break == true) {
        $the_min_units .= ($the_min_units != '' ? '<br />' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
      } else {
        $the_min_units .= ($the_min_units != '' ? '  ' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
      }
	  $the_min_units .= '</span>';
    }

    return $the_min_units;
  }
15 Mar 2012, 19:03
#3
suntower avatar

suntower

New Zenner

Join Date:
Nov 2010
Posts:
68
Plugin Contributions:
0

Re: Turn Off Max Quantity Display In Product Listing

Perfect. Thanks!

---JC