Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

stand in image for no product image


tec

Recommended Posts

Good day, I was looking through the contributions to find one that will put a default image in place if there is no product image,i had found one, it had a file called Array in it, but the code was all jumbled.

 

Does anyone know where i can find a contribution that will put a default prod image in if there isnt one assigned?

Link to comment
Share on other sites

I was looking for the same thing.

 

ALl im gonna do here is replace some code in includes/modules/product_listin.php

 

replace lines 125 - 132

		  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($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['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['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['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>?';
		}
		break;

with

 

		  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if( $listing['products_image'] != "" && file_exists(DIR_WS_IMAGES . $listing['products_image'])) {
			if (isset($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['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['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['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['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['products_id']) . '">' . tep_image(DIR_WS_IMAGES . "notavail.gif", $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>?';
		}
		break;

 

where notavail.gif can be any image you placed in the images directory.

 

THis will fix images within the product listing pages

Link to comment
Share on other sites

  • 1 month later...

Archived

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

×
×
  • Create New...