var zoomy = "\n\

Hiding inventory numbers

\n\
\n\ \n\

\n\ You can simplify your inventory display so that over a certain qty, the cart just says "In Stock"\n\

\n\ \n\

\n\ \"\" \n\

\n\ \n\

\n\ In this example, we use 100 as the limit under which we display the quantity but of course you can change that pretty easily in the define to whatever you wish\n\

\n\ \n\
\n\ \n\

New Files

\n\
\n\ \n\

\n\ Create a defines page, call it anything (we called it products_quantities_mods.php) and put it in /includes/extra_datafiles/\n\

\n\
<?php\n\
define (STOCK_SHOW_LIMIT, 100);\n\
define (STOCK_OFFSET, 3);\n\
define (STOCK_TEXT_IN_STOCK, \'IN STOCK\');\n\
define (STOCK_TEXT_QUANTITY_IN_STOCK, \'IN STOCK\');\n\
define (STOCK_TEXT_OUT_OF_STOCK, \'OUT OF STOCK\');\n\
?>
\n\ \n\

\n\ This should be the entire file. \n\

\n\ \n\

\n\ NB: Make sure there isnt any white space before the '<?php' or after the '?>'. Any whitespace output there will cause php to send headers, which you don't want to do yet. \n\

\n\ \n\
\n\ \n\

Change Settings

\n\
\n\ \n\

\n\ Make sure that the normal method for displaying products quantity is disabled.\n\

\n\ \n\

\n\ Go to Admin>Catalog>Product Types>Products( General )>Edit Layout\n\

\n\ \n\

\n\ and set Show Quantity in Stock to false. (Do this for Products (General), and any other types of products you use in the store)\n\

\n\ \n\

\n\ This will remove the quantity display from everywhere on the site. This tutorial will cover adding it back into the individual products page and the products listing page. If you'd like to keep this feature enabled, please see the optional instructions at the bottom. \n\

\n\ \n\
\n\ \n\

Show Quantity up to 100

\n\
\n\ \n\

\n\ Files to modify:\n\

\n\ \n\

\n\ /includes/templates/YOUR_TEMPLATE/tpl_product_info_display.php
\n\ \n\ /includes/modules/product_listing.php
\n\ \n\ includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_all_listing.php
\n\

\n\ \n\

\n\ Paste this new code into tpl_product_info_display.php anywhere you'd like – we recommend right below the price (line 75)\n\

\n\
<div class="availability">\n\
<?php\n\
if($products_quantity > STOCK_SHOW_LIMIT)	\n\
  echo STOCK_TEXT_IN_STOCK;\n\
elseif($products_quantity > 0)	\n\
  echo $products_quantity . \' \' . STOCK_TEXT_QUANTITY_IN_STOCK;\n\
else	\n\
  echo STOCK_TEXT_OUT_OF_STOCK;\n\
?>      \n\
</div>
\n\ \n\

\n\ in includes/modules/product_listing.php\n\

\n\ \n\

\n\ find (lines 148-151)\n\

\n\
case \'PRODUCT_LIST_QUANTITY\':\n\
        $lc_align = \'right\';\n\
        $lc_text = $listing->fields[\'products_quantity\'];
\n\ \n\

\n\ and replace them with \n\

\n\
case \'PRODUCT_LIST_QUANTITY\':\n\
        $lc_align = \'right\';\n\
	if($listing->fields[\'products_quantity\'] > STOCK_SHOW_LIMIT)\n\
          $lc_text = STOCK_TEXT_IN_STOCK;\n\
	elseif($listing->fields[\'products_quantity\'] > 0)\n\
          $lc_text = $listing->fields[\'products_quantity\'] . \' \' . STOCK_TEXT_QUANTITY_IN_STOCK;\n\
        else\n\
          $lc_text = STOCK_TEXT_OUT_OF_STOCK;
\n\ \n\

\n\ in includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_all_listing.php\n\

\n\ \n\

\n\ find (line 59)\n\

\n\
$display_products_quantity = TEXT_PRODUCTS_QUANTITY . $products_all->fields[\'products_quantity\'] . str_repeat (\'<br clear="all" />\', substr (PRODUCT_ALL_LIST_QUANTITY, 3, 1));
\n\ \n\

\n\ and replace with \n\

\n\
          if ($products_all->fields[\'products_quantity\'] > STOCK_SHOW_LIMIT)\n\
            $display_products_quantity = STOCK_TEXT_IN_STOCK;\n\
          elseif($products_all->fields[\'products_quantity\'] > 0)\n\
            $display_products_quantity = $products_all->fields[\'products_quantity\'] . \' \' . STOCK_TEXT_IN_STOCK;\n\
          else\n\
            $display_products_quantity = STOCK_TEXT_OUT_OF_STOCK;\n\
          $display_products_quantity .=	str_repeat (\'<br clear="all" />\', substr (PRODUCT_ALL_LIST_QUANTITY, 3, 1));
\n\ \n\
\n\ \n\

Optional Stuff

\n\
\n\ \n\

\n\ If you would rather not set the "Show Products Quantity" option to false then you'll need to make the following mods as well to each of the following files:\n\

\n\ \n\

\n\ Modified Files:
\n\ \n\ includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_all_listing.php
\n\ \n\ includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_featured_listing.php
\n\ \n\ includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_new_listing.php

\n\ \n\

\n\ \n\

\n\ For the Stock Limit:\n\

\n\ \n\

\n\ in includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_all_listing.php\n\

\n\ \n\

\n\ find (line59)\n\

\n\
$display_products_quantity = TEXT_PRODUCTS_QUANTITY . $products_all->fields[\'products_quantity\'] . str_repeat (\'<br clear="all" />\', substr (PRODUCT_ALL_LIST_QUANTITY, 3, 1));
\n\ \n\

\n\ and replace with \n\

\n\
          if ($products_all->fields[\'products_quantity\'] > STOCK_SHOW_LIMIT)\n\
            $display_products_quantity = STOCK_TEXT_IN_STOCK;\n\
          elseif($products_all->fields[\'products_quantity\'] > 0)\n\
            $display_products_quantity = $products_all->fields[\'products_quantity\'] . \' \' . STOCK_TEXT_IN_STOCK;\n\
          else\n\
            $display_products_quantity = STOCK_TEXT_OUT_OF_STOCK;\n\
          $display_products_quantity .=	str_repeat (\'<br clear="all" />\', substr (PRODUCT_ALL_LIST_QUANTITY, 3, 1));
\n\ \n\

\n\ The changes for tpl_modules_products_featured_listing.php and tpl_modules_products_new_listing.php are identical except that the variable $products_all should be replaced with $featured_products and $products_new respectively.\n\

\n\ \n\
\n\ ";document.write(zoomy);document.write("

This page was autogenerated from http://www.ladyada.net/wiki/tutorials/zencartmods/hideqty.html
Please edit the wiki to contribute any updates or corrections.
")