Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to exclude specials?


Juto

Recommended Posts

I have searched and tried to fix it by altering the sql queries like this one, but no success:

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   $new_products_query = tep_db_query(
     "select p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, p.products_tax_class_id, pd.products_name, s.specials_new_products_price, p.products_price, m.manufacturers_name
     from " . TABLE_PRODUCTS . " p
     left join
       " . TABLE_SPECIALS . " s on (p.products_id = s.products_id),
       " . TABLE_PRODUCTS_DESCRIPTION . " pd,
       " . TABLE_MANUFACTURERS . " m
     where p.products_status = '1'
     and p.products_id = pd.products_id
     and pd.language_id = '" . (int)$languages_id . "'
     and p.manufacturers_id = m.manufacturers_id
     order by p.products_date_added desc
     limit " . MAX_DISPLAY_NEW_PRODUCTS
   );
 } else {
   $new_products_query = tep_db_query(
     "select distinct p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, p.products_tax_class_id, pd.products_name, s.specials_new_products_price, p.products_price, m.manufacturers_name
     from " . TABLE_PRODUCTS . " p
     left join 
       " . TABLE_SPECIALS . " s on (p.products_id = s.products_id),
       " . TABLE_PRODUCTS_DESCRIPTION . " pd,
       " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,
       " . TABLE_CATEGORIES . " c,
       " . TABLE_MANUFACTURERS . " m
     where p.products_id = p2c.products_id
     and p2c.categories_id = c.categories_id
     and c.parent_id = '" . (int)$new_products_category_id . "'
     and p.products_status = '1'
     and p.products_id = pd.products_id
     and pd.language_id = '" . (int)$languages_id . "'
     and p.manufacturers_id = m.manufacturers_id
     order by p.products_date_added desc
     limit " . MAX_DISPLAY_NEW_PRODUCTS
   );
 }

 

I do appreciate any help on this. At the moment I have a quick and clumpsy solution, using:

 

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 $the_stuff = 0;
 while ($new_products = tep_db_fetch_array($new_products_query)) {
/* Dont show products with specials price */
         if (tep_not_null($new_products['specials_new_products_price'])) {
//do nothing
         } else {
//start the stuff

 

But then if the number of specials exceeds MAX_DISPLAY_NEW_PRODUCTS then nothing is displayed at all... :(

 

Have a look at my site www.ji-fashion.com

 

Kind regards and many thanks for your support.

 

Sara

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...