Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"New Products" images


Guest

Recommended Posts

Hey can someone make a contrib that would show only products with images , 90% of the products we have don't have images, but it doesn't look as cool when the "new products for the month of..." show a few product names.

Link to comment
Share on other sites

Not difficult. Check to see what is contained in the database for "no image" - it could be "Array", it could be "" (nothing). And then just say (put very simply mind you) onto your SQL statement that builds the list:

 

AND $products_image != ""; // assuming nothing - see above

 

or very similar - rather depends on the sql construct that you are using.

 

Next question: Can you do this yourself ? If yes, great. If no, you need to;

 

- pay someone to do it for you, or

- hope someone needs the same functionality and posts here when they've done it, or

- maybe someone will do it for you and post it here anyway.

 

Hope this helps.

Link to comment
Share on other sites

...your SQL statement that builds the list:

 

AND $products_image != ""; // assuming nothing - see above

 

Hope this helps.

 

My SQL is extremely rusty, but shouldn't it be?:

 

NOT $products_image = ""

Link to comment
Share on other sites

Burt is correct.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

OK here's how it looks (from whats_new.php):

 

if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' AND $products_image != "" order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {

 

I know I did something wrong; it wont work, because I have the ultimate in beginner SQL knowledge.

 

Any suggestions?

Link to comment
Share on other sites

This is on a live-shop that I am admin of, it's in a different place but does much the same job as you are after:

 

$new_products_query = tep_db_query("select p.products_id, pd.products_name, 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, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_image != '' and products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id group by p.products_id order by RAND(), p.products_date_added DESC, pd.products_name limit " . MAX_DISPLAY_NEW_PRODUCTS);

Link to comment
Share on other sites

Now I'm really confused ... it seemed like evertime a made a change, nothing happened. So I really messed up the query so that it wouldn't be able to grab anything on purpose. and It's still doing the same thing.

 

Here's the question:

Is there any other spot than /catalog/includes/boxes/whats_new.php where thequery for new items for the month of XX resides?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...