Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Prevent Items with NO images


Arto

Recommended Posts

Posted

Hi Everyone,

 

I have about 80 items (without images) I need to add to the shop.

 

What I would like to do, is to prevent any of this items without images from appearing on "New Products For January" on the main page and from What's New box on the roght Column.

 

Please help with all your suggesions

 

Many thanks in advance

 

Arto

Posted

Well, I would replace the "New Products For January" with the "Featured Products" contribution so that you can easily control what products appear in there.

 

As for the "Whats New" column, one way to solve this is to add a section to the where clause of the query. Probably as easy as

 

Open /includes/boxes/whats_new.php

Find

where products_status='1'

 

Replace with

where products_status='1' AND products_image IS NOT NULL

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

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.

Posted

Hi wizardsandwars,

 

Thanks for your kind help, all works fine.

 

Now one more Q, say after I add an item with no image to a cataogry then when you list products under that catagory you will see a missing picture, have you got any idea how to make this item listed with only text?

 

 

Many thanks in advance

 

Arto

Posted

Can't say that I do. Sorry.

 

Over my head.

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

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.

Posted
Now one more Q, say after I add an item with no image to a cataogry then when you list products under that catagory you will see a missing picture, have you got any idea how to make this item listed with only text?

 

here is a quick code I came up with for the product listings (in broswing categories, searches, etc...)...

 

in /includes/modules/product_listing.php find the code:

          case 'PRODUCT_LIST_IMAGE':

           $lc_align = 'center';

           if ($HTTP_GET_VARS['manufacturers_id']) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

           } else {

             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

           }

           break;

about 3/4 the way down and replace with:

          case 'PRODUCT_LIST_IMAGE':

           $lc_align = 'center';

           if ($HTTP_GET_VARS['manufacturers_id']) {

      if ($listing_values['products_image']) != "" { // There is an image... SHOW IT!

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

      } else { // No IMAGE... Fill with a placeholder

             $lc_text = tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '' , SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);

      }

           } else {

      if ($listing_values['products_image']) != "" { // There is an image... SHOW IT!

             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

      } else { // No IMAGE... Fill with a placeholder

             $lc_text = tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '' , SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);

      }

           }

           break;

 

this will (or should) place a transparent "placeholder" if there is not an image, so the page keeps the same layout... I haven't tested it, but it looks ok to me.

 

you will need to do something with product_info.php too... give me a minute and I can write up something for that too.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Posted

wow... major error on my part... the correct code for the above is:

          case 'PRODUCT_LIST_IMAGE':

           $lc_align = 'center';

           if ($HTTP_GET_VARS['manufacturers_id']) {

      if ($listing_values['products_image'] != "") { // There is an image... SHOW IT!

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

      } else { // No IMAGE... Fill with a placeholder

             $lc_text = tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '' , SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);

      }

           } else {

      if ($listing_values['products_image'] != "") { // There is an image... SHOW IT!

             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

      } else { // No IMAGE... Fill with a placeholder

             $lc_text = tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '' , SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);

      }

           }

           break;

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Archived

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

×
×
  • Create New...