Zen Cart Logo
Forums / Basic Configuration / Show Quantity in Stock

Show Quantity in Stock

Locked

Views: 8,972

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
12 May 2006, 9:22 AM
#1
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Show Quantity in Stock

Hey all!

I'm in need of assistance tweaking my store.

What I'm trying to do is changing how Quantity in stock is shown. I wan't it to say how many there is available, and if out of stock it should say 2-3 days dispatch..

My guess is that I need to insert an if in tpl_product_info_display.php and this is out of my league..

Thanks in advance!

BR
Svanis

12 May 2006, 10:49 AM
#2
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Show Quantity in Stock

Ooops.. I obviously posted in the wrong forum. Maybe this should be moved elsewhere..

14 May 2006, 5:18 AM
#3
jeffdm avatar

jeffdm

New Zenner

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

Re: Show Quantity in Stock

Svanis:

Ooops.. I obviously posted in the wrong forum. Maybe this should be moved elsewhere..

I would like to know the answer to your question as well. I set it to not show stock quantities, and re-checked the setting, but it does so anyway.

14 May 2006, 5:58 AM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Show Quantity in Stock

You posted in the right place - all of this can be set in Admin.

Go to Configuration > Stock, and you can set Check stock level, Subtract stock, Allow Checkout and Show Sold Out Image in place of Add to Cart as desired. Edit "Mark product out of stock" to your desired text.

If you want to not show stock levels, you can turn it off in Catalog > Product Types > Product - General > Edit Layout > Show Quantity in Stock > 0.

There is a tremendous number of things you can do in Admin. You will benefit from looking at every item in every menu on the panel - even if you don't see a need for a setting now, you may remember that you saw it later when you want a function.

14 May 2006, 10:23 PM
#5
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Show Quantity in Stock

Well.. Isn't that only showing in the actual cart? I need it to be listed in the product info page instead of saying "0 in stock"

Thx for the reply..

14 May 2006, 10:31 PM
#6
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Show Quantity in Stock

A clarification.. (Sorry about doubleposting, my 5 minutes of editability expired, not a bump.. :P)

I wan't it to show "X in stock" but if out of stock it should say anything but "0 in stock" For example, avail. @ distr...

15 May 2006, 1:05 AM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Show Quantity in Stock

"Mark product out of stock" is where the out of stock message goes, to show up in the product info page. You can edit it to show your desired text.

15 May 2006, 1:27 AM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Show Quantity in Stock

Well that's annoying...
I have had the show stock quantity function turned off, so just turned it back on to test it and find that when I make a test purchase it shows the quantity as 0 in stock, but no oos message. Sorry! The oos message does show in the cart when ordering more than are in stock, now that I think about it.

15 May 2006, 3:48 AM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: Show Quantity in Stock

Here's the setup for this function:

In tpl_product_info_display.php, around line 99, duplicate this line

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

and modify both similar to the product model line.

<!--bof Product details list -->

...

<?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_quantity == 1 and $products_quantity >0) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?> <?php echo (($flag_show_product_info_quantity == 1 and $products_quantity <=0) ? '<li>' . TEXT_MORE_INFORMATION . '</li>' : '') . "\n"; ?>

...

<!--eof Product details list -->

I haven't yet found the variable that holds the out of stock marker text, so I redefined the TEXT_MORE_INFORMATION constant (in /includes/languages/english/my_template/product_info.php) which I don't need, as a temporary measure for testing. You could also add a new define there for TEXT_PRODUCT_O_O_S or something.

I don't plan to show quantity in stock, but may want to note that the item will be made to order if out of stock. For that, I can modify the second line to:

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

so the oos text will show if appropriate regardless of the flag setting.

15 May 2006, 4:16 PM
#10
jeffdm avatar

jeffdm

New Zenner

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

Re: Show Quantity in Stock

gjh42:

There is a tremendous number of things you can do in Admin. You will benefit from looking at every item in every menu on the panel - even if you don't see a need for a setting now, you may remember that you saw it later when you want a function.

Thank you for the tips, I did find it. The problem is that there are so many settings, it is hard to remember where they are, and many times I don't see a consistent pattern on where they are, it seems counterintuitive sometimes.

16 May 2006, 9:02 PM
#11
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Show Quantity in Stock

Thanks for the replies mate, but unfortunately they don't do the trick for me.. Seems like we're running different versions since the closest I get to your description is: ```

<td class="main" align="center"><?php echo ((SHOW_PRODUCT_INFO_QUANTITY == '1') ? $products_quantity . TEXT_PRODUCT_QUANTITY : ' '); ?></td> ```on line 128. I've tried modifying that line in approx. a million different ways, there have been a lot of errors and the closest I get is when there is no errorbut the "stock message" is totally gone as well.. :(

Running on 1.2.7..

17 May 2006, 8:49 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Show Quantity in Stock

I found the command at line 203 in my old test install of v1.2.7 (downloaded in March 2006). I can't run it to test, but try this:

[OLD:]

<tr> <td > </td> <td class="main" align="center"><?php echo ((SHOW_PRODUCT_INFO_QUANTITY == '1') ? $products_quantity . TEXT_PRODUCT_QUANTITY : ' '); ?></td> </tr>

[CHANGE TO:]

<tr> <td > </td>
<td class="main" align="center">
<?php echo ((SHOW_PRODUCT_INFO_QUANTITY == '1' and $products_quantity >0) ? $products_quantity . TEXT_PRODUCT_QUANTITY : ' '); ?> <?php echo ((SHOW_PRODUCT_INFO_QUANTITY == '1' and $products_quantity <=0) ? TEXT_PRODUCT_O_O_S : ' '); ?> </td> </tr>
  • Add a new line in /includes/languages/english/your_template/product_info.php:

define ('TEXT_PRODUCT_O_O_S', 'Your OOS message');

Let me know how it works - there are a couple of possible tweaks I can think of if it doesn't work this way.

17 May 2006, 9:42 AM
#13
svanis avatar

svanis

Zen Follower

Join Date:
May 2005
Location:
Sweden
Posts:
145
Plugin Contributions:
0

Re: Show Quantity in Stock

Thank you soooo much for putting in some effort in helping out!
It did the trick!