Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Red and green buttons


Guest

Recommended Posts

Posted

http://www.vinylwarning.com.au/index.php?cPath=67_68

 

The quantity has been changed into status here, the green light displays products in stock, yellow for one left and red for no stock.

 

I used a contribution for this code:

 

          //bof stock announcement

case 'PRODUCT_LIST_QUANTITY':

  $lc_align = 'right';

  if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1 )) {

    $lc_text = '<span class="markProductOutOfStock"><center><img src="images/icon_status_red.gif"><center></span>';

  }

  } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] > 0 )) {

    $lc_text = '<span class="markProductOutofStock"><center><img src="images/icon_status_green.gif"><center></b></span>';

  } else {

    $lc_text = ' ' . $listing['products_quantity'] . ' ';

  }

  break;

//eof stock announcement

 

this only displays a red for no stock and a green button for stock, but I also want a yellow button for 2 products or less, so I tried this code:

 

        //bof stock announcement

case 'PRODUCT_LIST_QUANTITY':

  $lc_align = 'right';

  if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1 )) {

    $lc_text = '<span class="markProductOutOfStock"><center><img src="images/icon_status_red.gif"><center></span>';

  } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] <3 )) {

    $lc_text = '<span class="markProductOutofStock"><center><img src="images/icon_status_yellow.gif"><center></b></span>';

  } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] > 3 )) {

    $lc_text = '<span class="markProductOutofStock"><center><img src="images/icon_status_green.gif"><center></b></span>';

  } else {

    $lc_text = ' ' . $listing['products_quantity'] . ' ';

  }

  break;

//eof stock announcement

 

But this doesn't work, because when there are 3 products in stock there is no button but just the number 3.

 

Can anyone helo me with this? It must work like this:

 

0 products red button

2 or less yellow button

3 or more green button

 

(I tried this several times, but I can't simply put my hand to it)

Posted
        //bof stock announcement
case 'PRODUCT_LIST_QUANTITY':
 $lc_align = 'right';
 if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1 )) {
   $lc_text = '<span class="markProductOutOfStock"><center><img src="images/icon_status_red.gif"><center></span>';
 } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] <3 )) {
   $lc_text = '<span class="markProductOutofStock"><center><img src="images/icon_status_yellow.gif"><center></b></span>';
 } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] >= 3 )) {
   $lc_text = '<span class="markProductOutofStock"><center><img src="images/icon_status_green.gif"><center></b></span>';
 } else {
   $lc_text = ' ' . $listing['products_quantity'] . ' ';
 }
 break;
//eof stock announcement

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

  • 2 weeks later...

Archived

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

×
×
  • Create New...