Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New products image


nandobr

Recommended Posts

Hello People,

 

I have more than 3000 products registreds, but some products have pictures.

I would like to know as I make to appear in the main page(new products) only the products with pictures.

 

thanks and sorry my bad english...

 

Fernando.

Link to comment
Share on other sites

I have more than 3000 products registreds, but some products have pictures.

I would like to know as I make to appear in the main page(new products) only the products with pictures.

 

great question.

 

Inside this loop :

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

in /includes/modules/new_products.php

 

Change the first $new_products_query in /includes/modules/new_products.php from this :

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

 

to this :

   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p.products_image <> 'NULL'	order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

 

then in the else statement, change the code from this :

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c 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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

to this :

 $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c 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_image <> 'NULL'  order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

All you are adding is a check in the image column :

and p.products_image <> 'NULL'

 

david

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...