If this is your first visit, check our documentation. To post, register or login.

Hide price if out of stock

Locked

Started by travlinstranger on 13 Jul 2007, 9:09 PM · Views: 2,509

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
13 Jul 2007, 9:09 PM
#1
travlinstranger avatar

travlinstranger

New Zenner

Join Date:
Jul 2007
Posts:
1
Plugin Contributions:
0

Post #1 by travlinstranger

Hi.
Can anyone tell me how I might be able to hide the price of an item when it's out of stock?
Thanks in advance
Gary

14 Jul 2007, 12:39 AM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

You could customize your template with the templates and overrides od tpl_product_info_display.php based on the variable $products_quantity on that page ...

Look for the section where the price is blocked out and throw an IF around it to not show the price or show your text etc. when the $products_quantity <= 0 ...

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!

6 Jun 2009, 4:28 AM
#3
dougyounkin avatar

dougyounkin

New Zenner

Join Date:
Jun 2009
Location:
Missouri, USA
Posts:
1
Plugin Contributions:
0

Post #3 by dougyounkin

Ajeh:

You could customize your template with the templates and overrides od tpl_product_info_display.php based on the variable $products_quantity on that page ...

Look for the section where the price is blocked out and throw an IF around it to not show the price or show your text etc. when the $products_quantity <= 0 ...

I managed to remove the product price when quantity was 0 or less by editing the file that Linda mentioned. Here is what I did (using ZenCart 1.3.8a):
Copied the file catalog/includes/templates/tpl_product_info_display.php into my
catalog/includes/templates/OVER_RIDE_DIR/templates/ directory.

In the file I copied, I found the Product Price Block section.
Then located the line

  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);

and replaced it with

if ($products_quantity > 0) {
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
} else {
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') ;
 }

I have the options set to show the product when it is still marked "in stock" but the quantity drops to 0 or less. Now the price is not shown when the quantity is <= 0.

I used this because my wife makes baskets and lists each one as a separate product. When one is sold, she moves it to a "sold" category. She still wants the previously available basket to show so others can see her past creations, but no price shows up on the product page. You can see it in action at http://naturalfiberbaskets.com.

Thanks again to the ZenCart team and the support in this forum.

Doug Younkin

Natural Fiber Baskets - One-of-a-kind baskets made with care from locally grown plant materials.

10 Aug 2009, 9:33 PM
#4
deko avatar

deko

New Zenner

Join Date:
Sep 2004
Posts:
34
Plugin Contributions:
0

Post #4 by deko

Is it possible to apply a similar fix to the product listing page?
I'd like to hide the price and display a sold out button instead.
Thanks
d.

5 Sep 2009, 4:48 AM
#5
kashyyyk avatar

kashyyyk

New Zenner

Join Date:
Feb 2009
Posts:
46
Plugin Contributions:
0

Post #5 by kashyyyk

Instead of blanking out the price I put in my sold out button.

if ($products_quantity > 0) {
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
} else {
  echo "<img src=\"http://URL TO SOLD OUT GIF\" title=\"Sold Out\" alt=\"Sold Out\" />"; 
 }