Jump to content

Archived

This topic is now archived and is closed to further replies.

Eyals

Help with qty stock display.

Recommended Posts

Hi,

 

Few years ago I've installed a contribution that show red/yellow/green icons based on stock level on products display page:

 

					    $prod_quantity = $listing['products_quantity'];
					    $minus = ($prod_quantity < 0);
					    $red = ($prod_quantity == NULL);
					    $yellow = ($prod_quantity == 0);
					    $green =  ($prod_quantity > 0);
					    switch ($prod_quantity) {
			    case $minus:
				  $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
				  break;
				  case $red:
				  $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
				  break;
				  case $yellow :
				  $img = tep_image(DIR_WS_ICONS . 'icon_status_yellow.gif', TEXT_FEW_QTY).'<br>'.TEXT_FEW_QTY ;
				  break;
			    case $green :
				  $img = tep_image(DIR_WS_ICONS . 'icon_status_green.gif', TEXT_BIG_QTY).'<br>'.TEXT_BIG_QTY ;
				  break;

 

I'm trying to alter the code that it'll show the red status icon whenever products price is set to 0 with no luck, I tried:

 

if $products_price == 0 
{
$img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
{

 

No luck as mentioned, I know it's simple for those who are into PHP and oscommerce, would appreciate any help here.

 

Thanks.

Share this post


Link to post
Share on other sites

I suspect you might do better with valid php

 

:-)

 

if ($products_price == 0) {

$img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;

}

HTH

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Thanks Geoffery, I tried this as well but this results all my products to show red status, here's the entire "PRODUCT_LIST_QUANTITY" part after modified:

 

	  case 'PRODUCT_LIST_QUANTITY':
	    $lc_align = 'center';
   $prod_quantity = $listing['products_quantity'];
	    $minus = ($prod_quantity == 0);
   $red = ($prod_quantity == NULL);
   $yellow = ($prod_quantity < 0);
   $green =  ($prod_quantity > 0);
   switch ($prod_quantity) {
 case $minus:
	  $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
	  break;
	  case $red:
	  $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
	  break;
	  case $yellow :
	  $img = tep_image(DIR_WS_ICONS . 'icon_status_yellow.gif', TEXT_FEW_QTY).'<br>'.TEXT_FEW_QTY ;
	  break;
 case $green :
	  $img = tep_image(DIR_WS_ICONS . 'icon_status_green.gif', TEXT_BIG_QTY).'<br>'.TEXT_BIG_QTY ;
	  break;
    }
if ($products_price == 0) {
   $img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;
}
  $lc_text =  $img ;
	    break;

 

Where did I go wrong? <_<

Share this post


Link to post
Share on other sites

is $products_price actually set to a value?

 

$lc_text = $products_price . ":" .$img ;

 

Should show the value

 

HTH

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

is $products_price actually set to a value?

 

$lc_text = $products_price . ":" .$img ;

 

Should show the value

 

 

Good question... it was not... I fixed it now (with a little help from you of course)

 

if ($listing['products_price'] == 0) {

$img = tep_image(DIR_WS_ICONS . 'icon_status_red.gif', TEXT_NOT_AVAIBLE).'<br>'.TEXT_NOT_AVAIBLE ;

 

Works great now! many thanks!

Share this post


Link to post
Share on other sites

Glad to be of help

 

Cheers

 

G

 

@@Eyals


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

×