Forums / Basic Configuration / Show qty in stock if greater than 0

Show qty in stock if greater than 0

Locked

Started by kbalona on 19 Sep 2008, 2:17 PM · Views: 3,046

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
19 Sep 2008, 2:17 PM
#1
kbalona avatar

kbalona

Zen Follower

Join Date:
Oct 2006
Posts:
213
Plugin Contributions:
0

Show qty in stock if greater than 0

Hi
Would it be really difficult to modify the "Show Quantity In Stock" switch (Catalog>Product Types>Edit Layout) to ONLY show how many of an item is in stock, if the stock count is greater than zero? (On the product info page) Then if the in stock quantity is zero or less, the stock count would disappear from the product info page. Could someone point me in the right direction as to what and where to modify, I'm kind of helpless with PHP.

19 Sep 2008, 3:37 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Show qty in stock if greater than 0

You could customize your template for that with the templates and overrides for whatever product type you need to do this on ...

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!

19 Sep 2008, 4:24 PM
#3
kbalona avatar

kbalona

Zen Follower

Join Date:
Oct 2006
Posts:
213
Plugin Contributions:
0

Re: Show qty in stock if greater than 0

I just need it for the product type General, but I don't know what file(s) to modify, or how the code should look.

19 Sep 2008, 5:09 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Show qty in stock if greater than 0

You would want to customize your template for the products _info page ...

Copy the file:
/includes/templates/templates_default/templates/tpl_product_info_display.php

to your templates and overrides directory, using whatever your template directory is for the your_templates_dir ...
/includes/templates/your_template_dir/templates/tpl_product_info_display.php

and find the line:

<?php   echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>

and change it to:

  <?php
if ($products_quantity < 1) {
  echo 'NOTHING';
} else   {
  echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n";
}
  ?>

Then you can set the
echo 'NOTHING';

once it is working, to read:
//echo 'NOTHING';

for future reference and to block the line ...

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!

19 Sep 2008, 9:14 PM
#5
kbalona avatar

kbalona

Zen Follower

Join Date:
Oct 2006
Posts:
213
Plugin Contributions:
0

Re: Show qty in stock if greater than 0

Linda, thanks so much, worked great, you're amazing like always. Thanks again, tip sent.:cool:

Kyle

19 Sep 2008, 9:16 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Show qty in stock if greater than 0

Thanks for letting us know that this was a solution for you ... :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!