Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 40
  1. #21
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    I also tried to add to the code...

    Example:

    <?php echo (($flag_show_product_info_quantity == 1 && $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>';
    } else {
    if ($products_quantity == 4) {
    echo '<li>' . TEXT_FOUR_LEFT . '</li>';
    } else {
    if ($products_quantity == 5 {
    echo '<li>' . TEXT_FIVE_LEFT . '</li>';
    } else {
    if ($products_quantity == 6) {
    echo '<li>' . TEXT_SIX_LEFT . '</li>';
    } else {
    if ($products_quantity == 7) {
    echo '<li>' . TEXT_SEVEN_LEFT . '</li>';
    } else {
    if ($products_quantity == 8) {
    echo '<li>' . TEXT_EIGHT_LEFT . '</li>';
    } else {
    if ($products_quantity == 9) {
    echo '<li>' . TEXT_NINE_LEFT . '</li>';
    } else {
    if ($products_quantity == 10) {
    echo '<li>' . TEXT_TEN_LEFT . '</li>';
    } else {
    if ($products_quantity == 11) {
    echo '<li>' . TEXT_ELEVEN_LEFT . '</li>';
    } else {
    if ($products_quantity == 12) {
    echo '<li>' . TEXT_TWELVE_LEFT . '</li>';
    } else {
    if ($products_quantity == 13) {
    echo '<li>' . TEXT_THIRTEEN_LEFT . '</li>';
    } else {
    if ($products_quantity == 14) {
    echo '<li>' . TEXT_FOURTEEN_LEFT . '</li>';
    } else {
    if ($products_quantity == 15) {
    echo '<li>' . TEXT_FIFTEEN_LEFT . '</li>';
    }}}
    ?>

    And...


    <?php

    define('TEXT_ONE_LEFT', 'ONLY ONE COPY LEFT!');
    define('TEXT_TWO_LEFT', 'LOW STOCK');
    define('TEXT_THREE_LEFT', 'In stock');
    define('TEXT_FOUR_LEFT', 'In stock');
    define('TEXT_FIVE_LEFT', 'In stock');
    define('TEXT_SIX_LEFT', 'In stock');
    define('TEXT_SEVEN_LEFT', 'In stock');
    define('TEXT_EIGHT_LEFT', 'In stock');
    define('TEXT_NINE_LEFT', 'In stock');
    define('TEXT_TEN_LEFT', 'In stock');
    define('TEXT_ELEVEN_LEFT', 'In stock');
    define('TEXT_TWELVE_LEFT', 'In stock');
    define('TEXT_THIRTEEN_LEFT', 'In stock');
    define('TEXT_FOURTEEN_LEFT', 'In stock');
    define('TEXT_FIFTEEN_LEFT', 'In stock');

    ?>

    Still produces blank page...

  2. #22
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Anyone? Help please!

  3. #23
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    I am also getting this error message "syntax error, unexpected $end" from tpl_product_info_display.php on line 319. Line 319 is the last line of code and only has </div> on it

  4. #24
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Wow! No one on this?

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

    Default Re: Show one left in stock message?

    try changing

    PHP Code:
    if ($products_quantity == 15) {
    echo 
    '<li>' TEXT_FIFTEEN_LEFT '</li>';
    }}}
    ?> 
    to

    PHP Code:
    if ($products_quantity == 15) {
    echo 
    '<li>' TEXT_FIFTEEN_LEFT '</li>';
    }}}}}}}}}}}}}}}
    ?> 

  6. #26
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Hi rbarbour! Thank you for the reply. I made the suggested changes and I still get a blank page. I should elaborate on what I mean by blank page. When I say blank page, I still get the header and banner and all that, but I lose the actual product listing... picture, description, price, etc. Any idea? Thanks!!!

  7. #27
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    By the way this does work for me if I leave the code the way you originally had it.

  8. #28
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Show one left in stock message?

    Quote Originally Posted by rbarbour View Post
    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!
    Quote Originally Posted by doooomed View Post
    Hello,

    I am trying to alter this a little and am having some trouble. All I want to do is eliminate the "define('TEXT_THREE_LEFT', 'Hurry, while supplies last!');" part of this.
    Your code example posted above suggests that you're doing nothing special for 3 or greater, so following that pattern, you would just do this:
    The following ...
    Code:
    <?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>';
    }}}
    ?>
    becomes:
    Code:
      <?php
    if ($products_quantity == 1) {
    echo '<li>' . TEXT_ONE_LEFT . '</li>';
    } else {
    if ($products_quantity == 2) {
    echo '<li>' . TEXT_TWO_LEFT . '</li>';
    } else { echo 'In Stock';}}
    ?>
    The nesting of { and } braces is really odd in there. More complicated than it needs to be, but I fear that if I posted tidier code then you might miss the correct cleanup, so I only edited the very tiny bit shown.
    .

    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.

  9. #29
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Show one left in stock message?

    Works Awesome! Thank you Doc! I just sent you guys a few bucks

    I was wondering how I would go about putting one of those "bullet" dots like the others have into this? Also, would it be possible to make the fonts different colors? Green: In Stock, Yellow: Low Stock, Red: One left

  10. #30
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Show one left in stock message?

    Those "bullet dots" are created by the <li> ... </li> tags wrapped around it.

    So you could do this:
    Code:
    } else { echo '<li>In Stock</li>';}}

    or for consistency with the other defined phrases, maybe do this:
    Code:
    } else { echo '<li>' . TEXT_IN_STOCK . '</li>';}}
    And then that would allow you to add styling to those various phrases all in one place:
    Code:
    define('TEXT_ONE_LEFT', '<span style="color:red">ONLY ONE COPY LEFT!</span>');
    define('TEXT_TWO_LEFT', '<span style="color:yellow">LOW STOCK</span>');
    define('TEXT_IN_STOCK', '<span style="color: green">In stock</span>');
    .

    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.

 

 
Page 3 of 4 FirstFirst 1234 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