Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Small edit but I can't get my head around it. Any help?

Small edit but I can't get my head around it. Any help?

Locked

Views: 558

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
15 Oct 2010, 11:10 PM
#1
zomex avatar

zomex

New Zenner

Join Date:
Sep 2010
Posts:
13
Plugin Contributions:
0

Small edit but I can't get my head around it. Any help?

Hello everyone,

I'm trying to achieve the following at the moment:

As you can see the top checkout box is what it looks like currently but I'd like to show the product quantity instead of the maximum that can be ordered. I have found the file which I believe is:

tpl_document_product_info_display.php

and I believe this is the correct section that I'll need to edit:

<!--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
              $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->

I know my way around HTML/CSS but haven't started to learn PHP yet. If someone can assist me with this in any way I will be truly grateful!

Thanks,
Jack

16 Oct 2010, 2:31 AM
#3
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Small edit but I can't get my head around it. Any help?

This doesn't answer your question completely, but something that might help.

To get rid of the Max: 198 that appears in the add cart box, simply edit the product in admin under Catalog-> Categories/Products->. Place a 0 in the box labeled: Product Qty Maximum:

When you locate the file where you can edit the displayed info in the add to cart box, keep in mind you need to display the actual remaining inventory, not necessarily the number (198) you put in earlier as the maximum.

The source of this data is in the products_quantity field of products table of the database. This will provide continuously updated remaining stock information for that product.

www.aspenshopsonline.com - ZenCart 1.3.9h
www.wilkssupply.com - ZenCart 1.3.9h
www.un-du.net - ZenCart 1.3.8a