Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Replace Product quantity by something like stock level

Replace Product quantity by something like stock level

Locked

Views: 3,035

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
8 Nov 2007, 11:05 AM
#1
lume96 avatar

lume96

New Zenner

Join Date:
Aug 2007
Posts:
6
Plugin Contributions:
0

Replace Product quantity by something like stock level

Hi all,

I'm new to Zencart a do have to set up my first e-commerce website.

What I would like to (have to) do is replace the product quantity by something like an stock level indicator. E.g.: Rather than showing the quantity, I would like to indicate :

  • "on stock" for a qty > 2
  • "limited stock" for a qty between 1 and 2
  • "on order" for a qty < 1.

Ideally this should be shown on the different product listings (new products, prods by cat listing, etc...) as well as on the product info page.

I tried to search the forum, but haven't found anything related.

Is there an mod or could some kind person give me some hints as to what files to modify ?

Thank's a lot in advance for your help.
Bye.

9 Nov 2007, 1:11 PM
#2
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Replace Product quantity by something like stock level

The file you are looking to edit is tpl_product_info_display.php which is found in includes/templates/YOUR_CUSTOM_FOLDER/templates- If it's not there copy it from the template_default/templates folder into includes/templates/YOUR_CUSTOM_FOLDER/templates. The line you need to change looks like:

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

replace it with:

<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . ($products_quantity>=2?'In stock':($products_quantity>=1?'Limited stock':'On order')). '</li>'  : '') . "\n"; ?>

Let me know if you want to do the same for product listings.

9 Nov 2007, 1:26 PM
#3
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Replace Product quantity by something like stock level

Actually, a smarter version (and in keeping with the override ethos) is to use the following instead.

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

and copy/paste the following into includes/languages/english/YOUR_CUSTOM_FOLDER/product_info.php

define('TEXT_PRODUCT_IN_STOCK', 'In stock');
define('TEXT_PRODUCT_LIMITED_STOCK', 'Limited stock');
define('TEXT_PRODUCT_ON_ORDER', 'On order');

(I pasted it into line 22). Otherwise I've attached the file so you can just store it to includes/languages/english/YOUR_CUSTOM_FOLDER/

13 Nov 2007, 4:44 PM
#4
lume96 avatar

lume96

New Zenner

Join Date:
Aug 2007
Posts:
6
Plugin Contributions:
0

Re: Replace Product quantity by something like stock level

Hi,

I've been absent these last days, that's why I haved answered before. Got it working with your indications. Just what I needed.

Thank's again.

Bye.

16 Nov 2008, 12:44 PM
#5
soki avatar

soki

New Zenner

Join Date:
Apr 2008
Location:
Athens
Posts:
85
Plugin Contributions:
0

Re: Replace Product quantity by something like stock level

hem:

Actually, a smarter version (and in keeping with the override ethos) is to use the following instead.

<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . ($products_quantity>=2?TEXT_PRODUCT_IN_STOCK:($products_quantity>=1?TEXT_PRODUCT_LIMITED_STOCK:TEXT_PRODUCT_ON_ORDER)). '</li>' : '') . "\n"; ?>
> 
> and copy/paste the following into includes/languages/english/YOUR_CUSTOM_FOLDER/product_info.php
> 
> ```php
define('TEXT_PRODUCT_IN_STOCK', 'In stock');
define('TEXT_PRODUCT_LIMITED_STOCK', 'Limited stock');
define('TEXT_PRODUCT_ON_ORDER', 'On order');

(I pasted it into line 22). Otherwise I've attached the file so you can just store it to includes/languages/english/YOUR_CUSTOM_FOLDER/

Very helpful, thank you sir.

Also not forget to add the defines,

define('TEXT_PRODUCT_IN_STOCK', 'In stock');
define('TEXT_PRODUCT_LIMITED_STOCK', 'Limited stock');
define('TEXT_PRODUCT_ON_ORDER', 'On order');

in all language folders and translated if you have more than one language installed in your cart.

:clap:

31 Aug 2009, 5:45 PM
#6
thenax avatar

thenax

New Zenner

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

Re: Replace Product quantity by something like stock level

soki:

Very helpful, thank you sir.

Also not forget to add the defines,

define('TEXT_PRODUCT_IN_STOCK', 'In stock');
define('TEXT_PRODUCT_LIMITED_STOCK', 'Limited stock');
define('TEXT_PRODUCT_ON_ORDER', 'On order');

in all language folders and translated if you have more than one language installed in your cart.

:clap:

could this function be applied also to attribute by stock mods? it would be very interesting