Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2007
    Posts
    6
    Plugin Contributions
    0

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

  2. #2
    Join Date
    Sep 2007
    Location
    Dublin, Ireland
    Posts
    1,288
    Plugin Contributions
    8

    Default 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 Code:
    <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' $products_quantity TEXT_PRODUCT_QUANTITY '</li>'  '') . "\n"?>
    replace it with:

    PHP Code:
    <?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.
    Andrew

    Andrew Moore
    Omnicia Agile Development
    www.omnicia.com

  3. #3
    Join Date
    Sep 2007
    Location
    Dublin, Ireland
    Posts
    1,288
    Plugin Contributions
    8

    Default 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 Code:
    <?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 Code:
    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/
    Last edited by hem; 5 May 2009 at 10:32 AM.
    Andrew

    Andrew Moore
    Omnicia Agile Development
    www.omnicia.com

  4. #4
    Join Date
    Aug 2007
    Posts
    6
    Plugin Contributions
    0

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

  5. #5
    Join Date
    Apr 2008
    Location
    Athens
    Posts
    84
    Plugin Contributions
    0

    Default Re: Replace Product quantity by something like stock level

    Quote Originally Posted by hem View Post
    Actually, a smarter version (and in keeping with the override ethos) is to use the following instead.

    PHP Code:
    <?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 Code:
    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.


  6. #6
    Join Date
    Jun 2009
    Posts
    66
    Plugin Contributions
    0

    Default Re: Replace Product quantity by something like stock level

    Quote Originally Posted by soki View Post
    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.

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

 

 

Similar Threads

  1. v151 Replace Sold out with text & qty with "in stock at suppliers" or something similar
    By Axeman in forum Managing Customers and Orders
    Replies: 9
    Last Post: 5 Feb 2015, 05:30 PM
  2. Product's description: Is it possible to have something like that...?
    By alepia in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Dec 2009, 08:39 PM
  3. Set stock level / quantity to a product
    By vik007 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 28 Jul 2009, 08:04 PM
  4. Show stock quantity at top level
    By wyzman in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 10 Apr 2008, 05:00 PM
  5. Replies: 3
    Last Post: 16 Jan 2007, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg