Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Quantity in stock only on checkout (if not enough)

    I am currently going through final testing of a site and I have noticed that if you do not allow checkout when there isn't enough stock that zencart displays a warning at the top of the cart asking the customer to change the quantity - great but it doesn't tell them how many are actually in stock so it's trial and error!

    i don't want to display the quantity in stock on the product into pages or the product listing - just on the cart when stock levels are too low...

    Any ideas on where to call the quantity from and how to display it under the quantity box on the checkout?

    Thanks muchly!

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Quantity in stock only on checkout (if not enough)

    You could use the function zen_get_products_stock to look up the current products_quantity for display on any page ...

    The function is in the functions_lookups.php function file ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Re: Quantity in stock only on checkout (if not enough)

    That's great - I didn't realise there was a zen function for this - what about a switch so that the amount in stock only shows when there is not enough stock to fulfill the order?

    Thanks again...!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Quantity in stock only on checkout (if not enough)

    Perhaps look to when the low stock is showing and use the same method ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Re: Quantity in stock only on checkout (if not enough)

    That's the problem - I can't seem to find where to low stock warning is displayed below the quantity box in the cart?

    I have found the main error message at the top of the cart in tpl_shopping_cart_default.php

    <?php if ($flagAnyOutOfStock) { ?>

    <?php if (STOCK_ALLOW_CHECKOUT == 'true') { ?>

    <div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>

    <?php } else { ?>
    <div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>

    But the only reference I can find other than that is here:

    </td>
    <td class="cartProductDisplay">
    <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
    <br class="clearBoth" />

    Which is just below the update button code...

    All I need is some code to check the stock level and display the quantity in stock if there isn't enough... I think I need spoon feeding this one!

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Quantity in stock only on checkout (if not enough)

    The $product['flagStockCheck'] is the *** when low ...

    Something like this should work for you:
    Code:
    <?php
      if ($product['flagShowFixedQuantity']) {
        echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'] . ($product['flagStockCheck'] ? ' left ' . zen_get_products_stock($product['id']) : '');
      } else {
        echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'] . ($product['flagStockCheck'] ? ' left ' . zen_get_products_stock($product['id']) : '');
      }
    ?>
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Re: Quantity in stock only on checkout (if not enough)

    Worked like a charm... Thanks :)

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Quantity in stock only on checkout (if not enough)

    You are most welcome ... thanks for letting us know that this solution worked for you to display the current instock quantity on the shopping cart so when the shopping_cart page is displayed you will see the products_quantity only when the stock is less what the customer is trying to order ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    Mar 2005
    Posts
    123
    Plugin Contributions
    0

    Default Re: Quantity in stock only on checkout (if not enough)

    It might be a small and useful addition to the next zencart version (wink wink) :)

  10. #10
    Join Date
    Sep 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Quantity in stock only on checkout (if not enough)

    I got the same problem and this modification works.
    I was wondering if there is a way to do the same after Stock With attributes installed.
    Thanks

 

 

Similar Threads

  1. How can I dispaly stock quantities only if quantity in stock is greater than zero?
    By Liamv in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 22 Feb 2013, 12:39 AM
  2. Quantity products remove add only in stock
    By mambo75 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Nov 2009, 06:44 PM
  3. Show Product out of stock in checkout - not only in shopping cart.
    By Gomlers in forum Managing Customers and Orders
    Replies: 5
    Last Post: 13 Jul 2009, 03:01 PM
  4. My Zen Cart is allowing checkout even when stock not enough
    By ebaobao in forum General Questions
    Replies: 7
    Last Post: 22 Aug 2008, 11:15 PM
  5. Not enough stock but still able to check out?
    By weflorencekoh in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 20 Mar 2007, 07:57 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