Forums / Templates, Stylesheets, Page Layout / Show "in stock" instead of showing units in stock

Show "in stock" instead of showing units in stock

Started by gustafr on 10 Jul 2006, 11:13 AM · Views: 20,147

Results 1 to 20 of 70
10 Jul 2006, 11:13 AM
#1
gustafr avatar

gustafr

New Zenner

Join Date:
May 2006
Posts:
26
Plugin Contributions:
0

Show "in stock" instead of showing units in stock

Hi,

I would like to remove the units in stock on the product info page and instead only show "In stock" or "not in stock".
I have found out that the file that controls this is: tpl_products_info_display.php
and that i probaly should edit the line:

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

Can anyone instruct me on what is should change the code to?

Best Regards
Gustaf

10 Jul 2006, 1:46 PM
#2
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Show "in stock" instead of showing units in stock

Nope!

You need to edit:

includes -> languages -> english -> product_info.php

find this line of code

define('TEXT_PRODUCT_QUANTITY', ' Units in Stock');

change the portion in red to whatever you want.

Save the edited file to your CUSTOM folder and upload to your server.

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

10 Jul 2006, 4:49 PM
#3
Join Date:
Jul 2006
Location:
Ohio
Posts:
35
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

Yep sir...
One thing with Zen-cart, it is so easy to find out how to change things... Remember with code.. when ever you want to change something that says "change me" There is "change me" somewhere in the code somewhere.. so easy its not even funny:thumbsup:

Its all about pleasure ***** SIGNATURE EDITED -- inappropriate content ******

10 Jul 2006, 8:31 PM
#4
cfe avatar

cfe

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

Just a newcomer, and I know nothing, but wouldn't that just change the plain-text "Units in stock" message and not effect the amount displayed? So if he were to change it from "Units in stock" to "In Stock," it would then read:

1000 In Stock

When (I believe) he just wants it to say:

In Stock

Just curious...

11 Jul 2006, 6:27 AM
#5
gustafr avatar

gustafr

New Zenner

Join Date:
May 2006
Posts:
26
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

You are correct Cfe, that is not what i'm looking for. I want to remove the number that shows the quantity on stock. Any other ideas?

11 Jul 2006, 6:28 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Show "in stock" instead of showing units in stock

I think cfe is right.

Thus, it requires two steps:

  1. clydejones suggestion above
  2. change the code to this:```php
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Jul 2006, 7:13 AM
#7
gustafr avatar

gustafr

New Zenner

Join Date:
May 2006
Posts:
26
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

DrByte:

I think cfe is right.

Thus, it requires two steps:

  1. clydejones suggestion above
  2. change the code to this:```php
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>

Thank you, that removed the quantity. But here comes the tricky part: I want the In stock text to change to not in stock when stock is 0. How would i do this?

Thanks for helping out!
/Gustaf
11 Jul 2006, 7:32 AM
#8
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Show "in stock" instead of showing units in stock

Look in admin -> configuration -> stock -> Mark product out of stock

replace *** with Not in Stock

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

11 Jul 2006, 7:38 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Show "in stock" instead of showing units in stock

gustafr:

Thank you, that removed the quantity. But here comes the tricky part: I want the In stock text to change to not in stock when stock is 0. How would i do this?
Use this instead:```php

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


Then use a variation on clydejones earlier post, like this:

includes -> languages -> english -> product_info.php

find this line of code
```php
define('TEXT_PRODUCT_QUANTITY', ' Units in Stock');

and add these below it:

define('TEXT_PRODUCT_IN_STOCK', 'In Stock');
define('TEXT_PRODUCT_NOT_IN_STOCK', 'Out of Stock');

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Jul 2006, 11:59 AM
#10
gustafr avatar

gustafr

New Zenner

Join Date:
May 2006
Posts:
26
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

This worked perfectly, thank you for all your help.

31 Jan 2007, 6:44 PM
#11
sc0rpiongirl avatar

sc0rpiongirl

New Zenner

Join Date:
Jan 2007
Posts:
29
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

Thanks a lot...I found it profoundly helpful when a PHP expert write the code for someone who's not so familiar with PHP to follow. I saved a lot of time trying and testing on something I just couldn't code properly.

Sc0rpionGirL
www.scarlettshop.com
www.kaccidesign.com
"Our greatest glory is not in never falling, but in rising every time we fall." - Confucius (551-479 BCE), Chinese philosopher and educator

31 Jan 2007, 7:42 PM
#12
jayson_gurney avatar

jayson_gurney

Zen Follower

Join Date:
May 2006
Location:
UK
Posts:
101
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

How do you alter this so that instead of displaying words it shows an image instead?

1 Feb 2007, 1:17 AM
#13
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

I implemented thid mod and its fine except for one issue. The In Stock text is now prefixed by a bullet point (thats OK) but also an extra space. I cant seem to get rid of the space. Can you help out?

here is an example:

http://www.theribbondiva.com/zen-cart/index.php?main_page=product_info&cPath=65&products_id=187

Thanks

4 Oct 2007, 2:39 PM
#14
sc0rpiongirl avatar

sc0rpiongirl

New Zenner

Join Date:
Jan 2007
Posts:
29
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

studeo:

I implemented thid mod and its fine except for one issue. The In Stock text is now prefixed by a bullet point (thats OK) but also an extra space. I cant seem to get rid of the space. Can you help out?

here is an example:

http://www.theribbondiva.com/zen-cart/index.php?main_page=product_info&cPath=65&products_id=187

Thanks

Have you figured out how to fix it? I am thinking it's the CSS that's getting you the bullet .

Sc0rpionGirL
www.scarlettshop.com
www.kaccidesign.com
"Our greatest glory is not in never falling, but in rising every time we fall." - Confucius (551-479 BCE), Chinese philosopher and educator

4 Oct 2007, 4:29 PM
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Show "in stock" instead of showing units in stock

You're right.
Add this to your stylesheet (or modify #productDetailsList li if it exists already) ```
#productDetailsList li {
list-style: none;
margin-left: -3em; /adjust to taste/
}

16 Jan 2008, 9:30 PM
#16
guitarslinger avatar

guitarslinger

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

[QUOTE=DrByte;228928]Use this instead:```php
?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . ($products_quantity > 0 ? TEXT_PRODUCT_IN_STOCK : TEXT_PRODUCT_NOT_IN_STOCK) . '</li>' : '') . "\n"; ?>



Hi Guys

Sorry to revive this old thread but this is exactly what i'm wanting to do in my current web site. I understand most of this but have no clue about the bit above. Where does this need to go exactly? When putting it into productinfo.php it results in a parse error on the product page.

Thanks for any help.

Rich
17 Jan 2008, 11:57 PM
#17
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Show "in stock" instead of showing units in stock

This was the file mentioned in post #1:

/includes/templates/your_template/templates/tpl_product_info_display.php.

18 Jan 2008, 10:17 AM
#18
guitarslinger avatar

guitarslinger

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

ahhhhhhhhhhhhhhhhhhhhhhh :blush:

works a treat. Bit of formatting and i'm away!! :clap:

25 Jun 2008, 5:46 PM
#19
enriko avatar

enriko

New Zenner

Join Date:
Jun 2008
Posts:
7
Plugin Contributions:
0

Re: Show "in stock" instead of showing units in stock

I got it 2 work, but on my webpage it now says: text_product_in_stock

If I try 2 remove the '_' from the php code it won't work. I see gjh42 mentions something about spacing, but I cant figure out exactly where that code should entered. Any help would be much appreciated.

26 Jun 2008, 5:16 AM
#20
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Show "in stock" instead of showing units in stock

The text_product_in_stock means it isn't working. You should be using capitals exactly as the example shows in all locations; lower case will not match. So:
TEXT_PRODUCT_IN_STOCK

The _ has nothing to do with spacing, and the code I mentioned would go in /includes/templates/your_template/css/stylesheet.css.