Forums / Templates, Stylesheets, Page Layout / Traffic Light Units in Stock indicator

Traffic Light Units in Stock indicator

Views: 1,083

Results 1 to 5 of 5
10 Jul 2011, 5:30 PM
#1
digiblood avatar

digiblood

New Zenner

Join Date:
Mar 2011
Posts:
5
Plugin Contributions:
0

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

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

<!--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 :)

10 Jul 2011, 5:42 PM
#3
digiblood avatar

digiblood

New Zenner

Join Date:
Mar 2011
Posts:
5
Plugin Contributions:
0

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 :)

10 Jul 2011, 11:53 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

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.

12 Jul 2011, 8:25 AM
#5
digiblood avatar

digiblood

New Zenner

Join Date:
Mar 2011
Posts:
5
Plugin Contributions:
0

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 :).