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 21 to 40 of 70
26 Jun 2008, 4:19 PM
#21
rugbythug avatar

rugbythug

New Zenner

Join Date:
Feb 2008
Posts:
25
Plugin Contributions:
0

Show "in stock" instead of showing units in stock

Thanks to all of you who did this made my site better:clap:

15 Jan 2009, 9:34 PM
#22
time111 avatar

time111

New Zenner

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

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

Hi,

I want to know is there any way in place of In Stock or Out of Stock, we can add image?

version 1.3.8a

thanking you in advance

~ Time

22 Jan 2009, 10:47 AM
#23
zhouyi avatar

zhouyi

New Zenner

Join Date:
Jan 2009
Location:
China
Posts:
25
Plugin Contributions:
0

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

Wow, finally find this useful post, it's also what I need. Thank you. :hug:

23 Jan 2009, 3:07 AM
#24
seamus avatar

seamus

New Zenner

Join Date:
Jan 2009
Posts:
7
Plugin Contributions:
0

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

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

23 Jan 2009, 3:13 AM
#25
seamus avatar

seamus

New Zenner

Join Date:
Jan 2009
Posts:
7
Plugin Contributions:
0

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

sorry, stupid question, my first post and I post a question I didnt need to ask,

I apologise :blush:

problem sorted :blush:

23 May 2009, 9:59 PM
#26
phxchiefs avatar

phxchiefs

New Zenner

Join Date:
May 2009
Posts:
1
Plugin Contributions:
0

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

Hi,

Could anyone help me with this functionality in the all products and new products page? I don't want to get rid of the quantity, I just want the same exact functionality as here where it shows in stock or out of stock. I believe one of the file is tpl_modules_products_new_listing but I have no idea what I need to change to get this same functionality as on the products info page. Thank you in advance for any help.

21 Jan 2010, 11:53 PM
#27
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

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

How about a minor change to this by adding in a LOW stock warning. So in other words if inventory dropped below 10 units instead of saying instock it would say "Limited Availability"

Hopefully this is just a bit more code any direction would be fantastic as usual.

23 Jan 2010, 4:34 PM
#28
gaffettape avatar

gaffettape

Zen Follower

Join Date:
May 2009
Posts:
433
Plugin Contributions:
0

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

Can anyone verify if DrByte's mod in post #9 works on v1.38a As it was over 3 years ago LOL. I'm asking as I tried to apply it to my zen cart today but have so far failed :blush: Nothing seems to change at all?

Thanks.

23 Jan 2010, 5:12 PM
#29
drbyte avatar

drbyte

Sensei

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

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

Which files did you edit? Do you have any addons or override versions of those file in custom template folders which are maybe overruling your changes?

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

23 Jan 2010, 5:31 PM
#30
gaffettape avatar

gaffettape

Zen Follower

Join Date:
May 2009
Posts:
433
Plugin Contributions:
0

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

Heres what I've done:

In File (override): includes/templates/mytemplate/templates/tpl_product_info_display.php

Replaced

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

With

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

In File (override): includes/languages/english/product_info.php

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

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

But still no change?

23 Jan 2010, 5:47 PM
#31
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

@version $Id: tpl_product_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
The latest revision of this file was in 2006, and it reportedly worked perfectly on someone's site in 2008.

23 Jan 2010, 5:56 PM
#32
gaffettape avatar

gaffettape

Zen Follower

Join Date:
May 2009
Posts:
433
Plugin Contributions:
0

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

DrByte:

So, what exactly is the change you were expecting? What's it showing now?
Also, are your FTP uploads actually completing properly when trying to upload your edits?

I forgot to add the rather crucial detail that I'm using the Tabbed Products Pro Module. I just viewed the page with Java script disabled, and guess what... it worked :blush: Sorry for wasting your time.

I'll contact the TPP author about trying to implement this mod.

Thanks.

27 Jan 2010, 3:56 PM
#33
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

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

This worked perfectly for me on 1.3.8.a.

Any clues on the limited stock code? That would be great if possible.

27 Jan 2010, 4:18 PM
#34
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

There is another thread where people have worked out the code for red/yellow/green light markers on products, using tests for stock level.

23 Jul 2010, 9:08 AM
#35
nintendoparts avatar

nintendoparts

New Zenner

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

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

This seems like a very straight forward mod, but every time I try it it breaks my site.

In my includes/templates/mytemplate/tpl_product_info_display.php I have changed the line:

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

to

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

and in my includes/languages/english/mytemplate/product_info.php file under the line:
define('TEXT_PRODUCT_QUANTITY', ' Units in Stock');
I have added
define('TEXT_PRODUCT_IN_STOCK', 'In Stock');
define('TEXT_PRODUCT_NOT_IN_STOCK', 'Out of Stock');

Now when I view a product all I see is the header, and column 1 (on the left). It seems to have broken the main column, column 2 (on the right) and the footer.

I am running zencart 1.39d, with simple SEO URLs, Imagehandler and Zen Light Box.

I really want this mod, and it seems so basic to apply, it's very frustrating. Any help would be greatly appreciated!

23 Jul 2010, 12:44 PM
#36
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

Is this the first mod you have tried to do? How are you making the edits? What you posted looks right, but what really matters is what the file on your server looks like. Can we see your site to look at the error directly?

23 Jul 2010, 6:01 PM
#37
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

Nintendoparts:

This seems like a very straight forward mod, but every time I try it it breaks my site.

In my includes/templates/mytemplate/tpl_product_info_display.php I have changed the line:

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

to

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

I am running zencart 1.39d, with simple SEO URLs, Imagehandler and Zen Light Box.

I really want this mod, and it seems so basic to apply, it's very frustrating. Any help would be greatly appreciated!

I think you have a misplaced )

Try this and see if it helps:

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

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

24 Jul 2010, 7:02 AM
#38
nintendoparts avatar

nintendoparts

New Zenner

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

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

Thanks for the speedy replies!

gjh42:

Is this the first mod you have tried to do? How are you making the edits? What you posted looks right, but what really matters is what the file on your server looks like. Can we see your site to look at the error directly?

I installed simple SEO URL's myself which was considerably more involved than this mod to install and I have done all the customizations to my site myself. I've been using notepad++ and filezilla to ftp the edited files. My site isn't functional yet so I'll upload the edited tpl_product_info_display.php and product_info.php and you can see the error for yourself. My site is Nintendoparts.com.au.
,

clydejones:

I think you have a misplaced )

Try this and see if it helps:

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

I directly copied and pasted this line, same thing.... header, and column 1, but no main column, no column2 and no footer on product pages.

Thanks for the help.
24 Jul 2010, 9:07 AM
#39
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

Nintendoparts:

Thanks for the speedy replies!

I installed simple SEO URL's myself which was considerably more involved than this mod to install and I have done all the customizations to my site myself. I've been using notepad++ and filezilla to ftp the edited files. My site isn't functional yet so I'll upload the edited tpl_product_info_display.php and product_info.php and you can see the error for yourself. My site is Nintendoparts.com.au.
,

I directly copied and pasted this line, same thing.... header, and column 1, but no main column, no column2 and no footer on product pages.

Thanks for the help.

check your cache folder and see what your MyDEBUG log files are telling you.

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

24 Jul 2010, 11:30 AM
#40
nintendoparts avatar

nintendoparts

New Zenner

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

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

clydejones:

check your cache folder and see what your MyDEBUG log files are telling you.

I checked the latest MyDEBUG file. It says:

[24-Jul-2010 04:05:31] PHP Parse error: syntax error, unexpected T_REQUIRE in /public_html/includes/templates/mytemplate/templates/tpl_product_info_display.php on line 1

I had a look at line 1 in the edited tpl_product_info_display.php it has a " <?php " (without the quotes) just like the original tpl_product_info_display.php file. I haven't made any changes near line 1, the code I've been replacing is located on line 241. Any ideas?

Thanks again for all your help with this.