Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help Please - quantity display


Davee

Recommended Posts

I've installed the quantity display contribution for new products, products_info & product_listing.

 

I have tried for the last 3 months of searching these forums, changing the code but still all I can't get it to work - just displays out of stock:(

 

I'm desperate to get this up & running, please any advise, help would be greatly appreciated

 

Here's the code

 

featured.php

<?php 
/* 
 osCommerce, Open Source E-Commerce Solutions 
 http://www.oscommerce.com 

 Copyright (c) 2002 osCommerce 

 Released under the GNU General Public License 
 
 cieto Featured Products 2.1
 [email protected]
 
*/ 

$configuration_query = tep_db_query("select configuration_key as cfgKey, configuration_value as cfgValue from " . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
}

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED); 

if(FEATURED_PRODUCTS_DISPLAY == true) 
   { 
?> 

<!-- body //--> 
<?php 

 $featured_products_category_id = $new_products_category_id; 
 
  if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { // We are not in category depth; we are on the main page 
   $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_description, pd.products_shortdescription, p.products_quantity, p.products_quantity_display_allowed, p.products_status, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join featured f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; 
  
 } else { // We are in category depth 
   $featured_products_query_raw = "select distinct p.products_id, pd.products_name, p.products_image, p.products_tax_class_id, pd.products_description, pd.products_shortdescription, p.products_quantity, p.products_quantity_display_allowed, p.products_status,  s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_REVIEWS . " r left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join featured f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; // Cambiar featured con TABLE_FEATURED
    
} 

 $featured_products_query = tep_db_query($featured_products_query_raw); 
 while ($featured_products = tep_db_fetch_array($featured_products_query)) { 

   $featured_products_array[] = array('id' => $featured_products['products_id'], 
   'name' => $featured_products['products_name'], 
   'description' => $featured_products['products_description'], 
   'shortdescription' => $featured_products['products_shortdescription'], 
 'products_quantity' => $featured_products['products_quantity'],
   'products_quantity_display_allowed' => $featured_products['products_quantity_display_allowed'],
 'status' => $featured_products['products_status'],
   'image' => $featured_products['products_image'], 
   'price' => $featured_products['products_price'], 
   'specials_price' => $featured_products['specials_new_products_price'], 
   'tax_class_id' => $featured_products['products_tax_class_id'], 
   'manufacturer' => $featured_products['manufacturers_id'],
 'reviews' => $featured_products['reviews_id']); 
 } 

 require(DIR_WS_MODULES  . FILENAME_FEATURED_PRODUCTS); 

} else // If it's disabled, then include the original New Products box 
   { 
     include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); 
   } 
?>

 

This is part of the featured_products.php

 

<?php  //Added elari Qty display Allowed
         $lc_text = '';
         if ( PRODUCT_LIST_QUANTITY ) {
              if (PRODUCT_LIST_PRODUCTS_STATUS == 1 ) {
                switch ($featured_products['products_quantity_display_allowed']) {
                  case '0':
                     if (PRODUCTS_QUANTITY_FORCE_OOS == 1 ) {
                    $lc_text = '<span style="color: #ff0000"> ' . tep_get_products_status_name(0) . '</span> ';
                    } else {
                    $lc_text = '';
                    }
                    break;
                  case '1':
                      if ($featured_products['products_quantity'] < PRODUCTS_QUANTITY_BREAKOUT) {
                      if ($featured_products['products_quantity'] == 0) {
                        $lc_text = '<span style="color: #ff0000"> ' . tep_get_products_status_name(0) . '</span> ';
                      } else {
                     
                        $lc_text = ' ';
                       
                      }
                    } else {
                        $lc_text = '-';
                    }
                    break;
                  case '2':
                        $lc_text = '<span style="color: #ffaa00"> ' . tep_get_products_status_name($featured_products['products_quantity_display_allowed']) . '</span> ';
                     break;
                  case '3':
                        $lc_text = '<span style="color: #0000ff"> ' . tep_get_products_status_name($featured_products['products_quantity_display_allowed']) . '</span> ';
                     break;
                  default:
                        $lc_text = '<span style="color: #000000"> ' . tep_get_products_status_name($featured_products['products_quantity_display_allowed']) . '</span> ';
                }
             }
         }// End Added elari Qty display Allowed. 
echo tep_get_products_status_name($featured_products['products_quantity_display_allowed'])?>

 

Works great on all the other files but not with the featured contribution

 

I know this can be done but not sure how

Help please

Dave

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...