Forums / Templates, Stylesheets, Page Layout / Quantity in stock only on checkout (if not enough)

Quantity in stock only on checkout (if not enough)

Locked

Views: 2,188

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Jul 2008, 10:23 AM
#1
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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!

12 Jul 2008, 6:56 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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 ... :smile:

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!]
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!

12 Jul 2008, 7:31 PM
#3
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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...!

12 Jul 2008, 7:58 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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!]
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!

13 Jul 2008, 10:37 AM
#5
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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!

13 Jul 2008, 3:26 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

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

Something like this should work for you:

<?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!]
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!

13 Jul 2008, 6:18 PM
#7
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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

Worked like a charm... Thanks :)

13 Jul 2008, 9:31 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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 ... :smile:

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!]
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!

14 Jul 2008, 7:43 PM
#9
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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) :)

29 Oct 2008, 10:26 PM
#10
smashbeat avatar

smashbeat

New Zenner

Join Date:
Sep 2008
Posts:
4
Plugin Contributions:
0

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