Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40
  1. #1
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Show one left in stock message?

    Is there a way to have a message automatically come up on the product page saying "only 1 left in stock" when the stock level reaches 1, instead of showing how many is in stock otherwise? I hope this makes sense lol. Any help is greatly appreciated!!!

  2. #2
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Show one left in stock message?

    I did something similar before, I will post that code so you get the idea. My PHP skills aren't that great but it works.

    in:
    /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

    find:
    PHP Code:
    <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' $products_quantity TEXT_PRODUCT_QUANTITY '</li>'  '') . "\n"?>
    change to:
    PHP Code:
      <?php echo (($flag_show_product_info_quantity == && $products_quantity >3) ? '<li>' $products_quantity TEXT_PRODUCT_QUANTITY '</li>'  '') . "\n"?>
      <?php
    if ($products_quantity == 1) {
    echo 
    '<li>' TEXT_ONE_LEFT '</li>';
    } else {
    if (
    $products_quantity == 2) {
    echo 
    '<li>' TEXT_TWO_LEFT '</li>';
    } else {
    if (
    $products_quantity == 3) {
    echo 
    '<li>' TEXT_THREE_LEFT '</li>';
    }}}
    ?>
    then in:
    /includes/languages/english/YOUR_TEMPLATE/product_info.php

    Add:
    PHP Code:
    define('TEXT_ONE_LEFT''Are you feeling lucky, only 1 available!');
    define('TEXT_TWO_LEFT''Don\'t miss out, only 2 left.');
    define('TEXT_THREE_LEFT''Hurry, while supplies last!'); 
    if the languages file product_info.php doesn't exist, create it.

    Hope this helps!

  3. #3
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Show one left in stock message?

    Nice one rbarbour ! It may be a good idea to put the defines in a separate file

    Will certainly keep this piece of code on file for future reference - thanks.
    Last edited by frank18; 16 Apr 2012 at 12:45 PM.

  4. #4
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Show one left in stock message?

    thanks for the update that this works for you!

  5. #5
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Show one left in stock message?

    Quote Originally Posted by frank18 View Post
    It may be a good idea to put the defines either in a separate file.
    I thought it was!

    Quote Originally Posted by rbarbour View Post
    then in:
    /includes/languages/english/YOUR_TEMPLATE/product_info.php

    Add:
    PHP Code:
    PHP Code:
    define('TEXT_ONE_LEFT''Are you feeling lucky, only 1 available!');
    define('TEXT_TWO_LEFT''Don\'t miss out, only 2 left.');
    define('TEXT_THREE_LEFT''Hurry, while supplies last!'); 

  6. #6
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Show one left in stock message?

    Something like this:

    includes/languages/english/extra_definitions/YOUR_TEMPLATE/one_left_defines.php

  7. #7
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Show one left in stock message?

    Gotcha -

  8. #8
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Thanks to everyone who replied! I have been trying different things to get this to work but am having no luck. The following seems to be the problem... (I think)


    Quote Originally Posted by rbarbour View Post

    then in:
    /includes/languages/english/YOUR_TEMPLATE/product_info.php

    Add:
    PHP Code:
    define('TEXT_ONE_LEFT''Are you feeling lucky, only 1 available!');
    define('TEXT_TWO_LEFT''Don\'t miss out, only 2 left.');
    define('TEXT_THREE_LEFT''Hurry, while supplies last!'); 
    if the languages file product_info.php doesn't exist, create it.

    Hope this helps!
    I follow everything up to /includes/languages/english but after that I don't have a your_template folder. I tried adding one and then creating a product_info.php file but still no luck. Anyone know what I'm doing wrong? I am using the Mostly Grey template and zencart version 1.3.9h

    Thanks!

  9. #9
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Show one left in stock message?

    your_template = the Mostly Grey template name ( i think it is mostlygrey )

    go to admin > tools > template selection

    What does it say under Template Directory?

  10. #10
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Thanks for the reply. You are correct, it is mostlygrey, but as I said I go to /includes/languages/english and there is no mostlygrey folder or any other template folder. I created one and the product_info.php but had no luck getting it to work.

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. v151 how to show one product if its different colors's size are out of stock?
    By kidultlearner in forum General Questions
    Replies: 6
    Last Post: 13 Aug 2016, 01:46 PM
  2. Stock by Attribute - Out of Stock Error Message
    By genxian in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 27 May 2011, 06:37 PM
  3. Want items to show out of stock after 5 items left
    By rickiesdiscount in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 21 Oct 2008, 02:54 AM
  4. Stock by attributes show stock levels placement error
    By fradesigns in forum General Questions
    Replies: 0
    Last Post: 17 Oct 2007, 01:14 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR