Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Posts
    5
    Plugin Contributions
    0

    Default Traffic Light Units in Stock indicator

    Hi

    I have done some searching around the zen cart page and other pages and have partially found an answer to my question. What i want is an traffic light like units in stock indicator on my product_info page. I have found the following code here on the forum

    Code:
    <?php
    if (zen_get_products_stock((int)$_GET['products_id']) >1) {
    $zc_stock_level_image = '' . zen_image(DIR_WS_TEMPLATE_ICONS . 'icon_status_green.gif', '', 10, 10) . '';
    }
    
    elseif (zen_get_products_stock((int)$_GET['products_id']) <1) {
    $zc_stock_level_image = '' . zen_image(DIR_WS_TEMPLATE_ICONS . 'icon_status_red.gif', '', 10, 10) . '';
    }
    
    else {
    $zc_stock_level_image = '' . zen_image(DIR_WS_TEMPLATE_ICONS . 'icon_status_yellow.gif', '', 10, 10) . '';
    }
    echo 'I SEE ' . $zc_stock_level_image;
    ?>
    witten by Ajeh in the follwing thread http://www.zen-cart.com/forum/showthread.php?t=64634

    This code does just what i want, but it kinda breaks the zencart code. I would still like to be able to disable this through the admin page and have it in the same css style as productinfo model and weight.

    Code:
    <!--bof Product details list  -->
    <?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
    <ul id="productDetailsList" class="floatingBox back">
      <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li><span class="product-info-label">' . TEXT_PRODUCT_MODEL . '</span>' . $products_model . '</li>' : '') . "\n"; ?>
      <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li><span class="product-info-label">' . TEXT_PRODUCT_WEIGHT . '</span>' .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
    <?php echo (($flag_show_product_info_quantity == 1) ? '<li><span class="product-info-label">'. TEXT_PRODUCT_QUANTITY . '</span>'  . $products_quantity  . '</li>'  : '') . "\n"; ?>
    <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li><span class="product-info-label">' . TEXT_PRODUCT_MANUFACTURER . '</span>' . $manufacturers_name . '</li>' : '') . "\n"; ?>
    </ul>
    <br class="clearBoth" />
    <?php
      }
    ?>
    <!--eof Product details list -->
    My PHP skills is not that good and and have tried different things, but everything seems to break things in one way or another ;) i would really appreciate if someone could help with an solution, I am pretty sure this would also be appreciated by allot of other people too.

    Thanks in advance for any help :)

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Traffic Light Units in Stock indicator


  3. #3
    Join Date
    Mar 2011
    Posts
    5
    Plugin Contributions
    0

    Default Re: Traffic Light Units in Stock indicator

    Yes and all i end up with is a blank product_info page no matter where i try to put that code. And that's after i copied all the files, and did what the text file said that needed to be added/changed in the two files.

    Thanks though :)

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,511
    Plugin Contributions
    126

    Default Re: Traffic Light Units in Stock indicator

    If you're getting a blank page, you can debug it by looking at the logs in the cache folder.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Mar 2011
    Posts
    5
    Plugin Contributions
    0

    Default Re: Traffic Light Units in Stock indicator

    Thanks for the tip swguy :) That gave me some hints so i was able to get it working. I rewrote some of the code, and changed the traffic light icons so fits better to rest of my layout :).

 

 

Similar Threads

  1. Display - units amount purchased instead of units in stock
    By evok20 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Aug 2011, 05:15 PM
  2. traffic light stock level indicator
    By modchipfitters.co.uk in forum Templates, Stylesheets, Page Layout
    Replies: 32
    Last Post: 13 Nov 2009, 11:11 PM
  3. Stock level indicator, for stock by attributes controller
    By vandiermen in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 13 Nov 2008, 09:49 AM
  4. would like a traffic light type quatity in stock status
    By modchipfitters.co.uk in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 14 Oct 2006, 12:33 AM

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