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 41 to 60 of 70
24 Jul 2010, 11:50 AM
#41
nintendoparts avatar

nintendoparts

New Zenner

Join Date:
Jul 2010
Posts:
49
Plugin Contributions:
0

Show "in stock" instead of showing units in stock

Ok it's working now! :smile:

I downloaded the /includes/templates/mytemplate/templates/tpl_product_info_display.php and had another look at it and for some reason all the breaks in the code had disappeared and the entire code was just one really long line with no spaces. Weird!

I swear I checked it like twice already before though, and the code looked fine the other two times I checked it. I'm thinking the files were getting corrupted during ftp maybe?

clydejones & gjh42, thanks so much for all your help with this issue! I'd give you guys a big hug if I could :P

21 Aug 2010, 6:07 PM
#42
nikstoun avatar

nikstoun

New Zenner

Join Date:
Jun 2009
Posts:
16
Plugin Contributions:
0

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

gustafr:

This worked perfectly, thank you for all your help.

I added to my product_info but what need change that work :(
that show out of stock :blush:

26 Aug 2010, 1:42 PM
#43
tweedle avatar

tweedle

New Zenner

Join Date:
Jul 2010
Posts:
4
Plugin Contributions:
0

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

Hi all you zenners. As this is my first post, i just want to say THANK YOU to all those who are contributing to this great living proof of man's genius and generosity.

Well this little mod (for some a major mod) was just what I was looking for. And thank you all again. It works very well in zen-cart v 1.3.9e (and in German as well as English). I was actually looking for this possibility in the admin (or at least the means of not showing whether stock is available or not) which, when I think about it, is not very professional. Dut this is better!

@nicstoun,

if you study page one of this thread very closely, you will find all the information you need.

Good luck!

& Regards
Jack

27 Aug 2010, 2:31 PM
#44
tweedle avatar

tweedle

New Zenner

Join Date:
Jul 2010
Posts:
4
Plugin Contributions:
0

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

Hi again,

just correct my mistakes, there is the possibility to not show (or to hide) the stock in hand. This is controlled by:

 admin > catalog > product types > eg.  Product General > Edit Layout

then edit -show quantity in stock (change to 0).

Sorry if I confused anyone. Zen-Cart is vast!

and @nikstoun

am also sorry I got your name wrong - I also forgot to mention that the code changes referred to by clydejones and DrByte take place in :

tpl_product_info_display.php

and the two extra lines of code go into:

languages/your_language/product_info.php

all in the appropriate CUSTOM templates of course.

And don't forget: if the setting in catalog > product types > etc. is set to zero, then the TEXT settings in the two lines mentioned above will not appear.

Regards

Jack

21 Oct 2011, 6:44 AM
#45
zadris avatar

zadris

New Zenner

Join Date:
Oct 2011
Posts:
68
Plugin Contributions:
0

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

seamus:

Hi,
I'v found this thread very useful, but could I ask another question?

regarding the "new products" and "all products" lists, how do I remove the "In Stock: 5" from these lists?

I'v used the info in this thread to remove the stock information on the main product display, but I dont know how to remove it from the new and all products lists,

could any one point me in the right direction as to what files to alter and what code to change?

any help would be really appreciated

hello, i am having the same problem.

there are two files products._all.php & products_new.php to remove or adjust the display of in stock...but what are the other two corresponding files to remove the display of quantity?

just for all products & new products.

thanks

23 Mar 2012, 2:00 AM
#46
stizzed avatar

stizzed

New Zenner

Join Date:
Jan 2012
Location:
Northern Indiana
Posts:
42
Plugin Contributions:
0

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

Sorry to open such an old tread but, How do you get this MOD to display in "All Products"?

Thanx in advance!

Michael (Zen Greenhorn)
Remember: Every expert started out as a beginner!

21 Aug 2013, 9:36 AM
#47
tinderbox avatar

tinderbox

New Zenner

Join Date:
Jun 2013
Location:
Perth Western Australia
Posts:
20
Plugin Contributions:
0

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

Hi All,
For some reason my store only shows the 'number' of items in stock instead of it reading '5 units in stock' it only displays the number '5' and that's it, I would like it to display the text as well, is there a setting for this? Thanks.

Steve.

21 Aug 2013, 9:00 PM
#48
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

See post #2 in this thread. You probably need to reverse Clyde's directions, and restore

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

as it occurs by default.

If that doesn't do it, we need to see your store and know what template you have. Some templates, especially commercial ones, may disable the display of this instead of just setting it to blank.

22 Aug 2013, 7:28 AM
#49
tinderbox avatar

tinderbox

New Zenner

Join Date:
Jun 2013
Location:
Perth Western Australia
Posts:
20
Plugin Contributions:
0

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

Hi gjh42,

I have checked the code and this is what is there

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

I am using Yorkshire Clean template by Picafor... hi Anne :)

22 Aug 2013, 8:32 AM
#50
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

Well then, try searching tpl_product_info_display.php for any instances of TEXT_PRODUCT_QUANTITY. If it is not there, check /includes/templates/template_default/templates/tpl_product_info_display.php to see what your custom template copy should include.

23 Aug 2013, 12:22 AM
#51
tinderbox avatar

tinderbox

New Zenner

Join Date:
Jun 2013
Location:
Perth Western Australia
Posts:
20
Plugin Contributions:
0

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

Hi gjh42,

Thank you for your reply, I have checked both TEXT_PRODUCT_QUANTITY values in the PHP files mentioned and they are identical?

Thanks again.
Steve

23 Aug 2013, 12:34 AM
#52
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

Then something is very peculiar... let's see your site and see if that gives any clues. Also, exactly what is the code you have in the vicinity of that constant name, in various files? (Give a couple lines before & after for context.)

31 Oct 2013, 8:51 PM
#53
liamv avatar

liamv

New Zenner

Join Date:
Feb 2010
Posts:
73
Plugin Contributions:
0

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

DrByte:

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');


DrByte many thanks for this. It workd perfectly for me. If I wanted to modify this to show the the number of units in stock when the item is in stock and display Out of Stock when not in stock what would I need to do to the above code?

Many thank in advance for your help.
31 Oct 2013, 9:35 PM
#54
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

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

Heres how i added an image: Copied image from source paseted it in product info.php

31 Oct 2013, 9:52 PM
#55
liamv avatar

liamv

New Zenner

Join Date:
Feb 2010
Posts:
73
Plugin Contributions:
0

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

I managed to work it out. This works fine. Now shows number of items in stock (if items in stock) and displays On order, contact us for ETA (if out of stock).

includes -> templates -> tpl_product_info_display.php

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

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

found this line of code
define('TEXT_PRODUCT_QUANTITY', ' Units in Stock');

and added this line below it:

define('TEXT_PRODUCT_NOT_IN_STOCK', ' On order, contact us for ETA'); 
31 Oct 2013, 9:57 PM
#56
liamv avatar

liamv

New Zenner

Join Date:
Feb 2010
Posts:
73
Plugin Contributions:
0

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

Now I would like to modify this so that I can have a different message from "On order, contact us for ETA" for products supplied by different manufacturers.

Anyone got any clues how I might achieve this?

31 Oct 2013, 10:45 PM
#57
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

Would all products of any one manufacturer have the same message? Or is it more complicated than that? How many different messages would you want?

19 Jan 2014, 9:04 PM
#58
isotank avatar

isotank

New Zenner

Join Date:
Jan 2014
Location:
Philadelphia, PA
Posts:
9
Plugin Contributions:
0

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

Gjh42, I am having the same issues that Tinderbox was having in August 2013 and I am using the same template (yorkshire clean) that they were using. Basically, I am entering in the code to the two files as previously suggested but nothing appears to happen. No errors, no changes, etc... I am assuming this has something to do with the template but am not sure how to fix it. The site is: https://www.dancingferret.com/isotank/

Here is some of the code from the tpl_product_info_display.php file.

<!--eof Add to Cart Box-->
</div>
</div>
<br class="clearBoth" /> 
<hr id="product-divider" />


<!--bof Product details list  -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
  <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<br class="clearBoth" />
<?php
  }
?>
<!--eof Product details list -->

Any thoughts?

-Joe

19 Jan 2014, 10:55 PM
#59
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

Which copy of the file are you editing? (file/folder path) Are you sure the edited copy is actually saved on the server?
This is the original code:```php

<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
What custom code are you using? Post your code with a few lines before and after for context.
20 Jan 2014, 10:38 PM
#60
isotank avatar

isotank

New Zenner

Join Date:
Jan 2014
Location:
Philadelphia, PA
Posts:
9
Plugin Contributions:
0

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

Hi, the file/folder path is
/includes/templates/yorkshire_clean/templates/tpl_product_info_display.php

Here is the section of code as it appears in the above file:

<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
  <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>