Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help Product Image Display


tamarvw

Recommended Posts

Hi All,

 

I've come across an intersting problem in my OS Commerce 2.3.1 site.

 

I am getting an error with my product image displays, both in product_listings and in products_new

 

On the home page, the new products display the images but give the "SMALL_IMG_WIDTH" as the alt tag. On my products listing pages, I get the full alt tags, but the images don't display...

 

Coding for Products_New looks like:

<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>

 

with the HTML (from "View Source") looking like:

<a href="http://www.supreme-health.co.za/product_info.php/products_id/198"><img src="images/artichoke_leaf_extract.png" alt="80" title=" 80 " /></a>

 

Coding for Products_Listing looks like:

<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name']) . '</a>

 

with the HTML (from "View Source") looking like:

<a href="http://www.supreme-health.co.za/product_info.php/products_id/198"><img src="images/" alt="Artichoke Leaf Extract" title=" Artichoke Leaf Extract " /></a>

 

Then, interestingly enough, the products_info page seems to be perfect - coding is:

'<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'

 

HTML View Source is:

<a href="http://www.supreme-health.co.za/images/artichoke_leaf_extract.png" target="_blank" rel="fancybox"><img src="images/artichoke_leaf_extract.png" alt="Artichoke Leaf Extract" title=" Artichoke Leaf Extract " hspace="5" vspace="5" /></a>

 

Does anybody have any idea as to why the site would be reading (what seems to be) only part of the string on the products_new & products_listing pages???

 

Please help, this is driving me a bit nuts!!

Link to comment
Share on other sites

tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'])

 

change that to this, should work:

 

tep_image(DIR_WS_IMAGES . $listing['products_image'], listing['products_name'], '', '', '')

Link to comment
Share on other sites

Thanks for the help, but still not getting images to display on products listing pages...

It's like the page cannot find the correct directory in order to access the images or something... very frustrating.

Link to comment
Share on other sites

I checked my code and I have:

 

new_products.php

tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

 

Your using $products_new - I think it should be - $new_products

 

In product_listing.php - I have:

 

tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

 

If you still can't get it, then post the full page code here. It code be something small like you forgot to close off a quote or something.

Link to comment
Share on other sites

I have also tried replacing this page with a template page from various other free templates (most with grid layouts) and i still get the same problem..!

Could the problem actually lie with a different page, or on the database side perhaps?

 

These images on the product listing pages did originally display, then I removed the <td></td> as images werent correct, updated images to new images through Admin & put back in <td></td> etc to display images... Images have not displayed since..!

Link to comment
Share on other sites

Hi, Thanks for all the help. Have already tried that string of coding... Here is full page:

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License


*/
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {?>

<table border="0" width="100%" cellspacing="0" cellpadding="2"> 
<tr>	   
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>	   
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> 
</tr>
</table>

<?php 
}   

$row = 0; 
$col = 0; 
$info_box_contents = array();
 echo '<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td>';

	    $listing_query = tep_db_query($listing_split->sql_query);	   
  while ($listing = tep_db_fetch_array($listing_query))
  {   
  $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$listing['products_id'].' && language_id='.(int)$languages_id;	   
  $description_query = tep_db_query($sql);	   
  $description = mysql_fetch_array($description_query, MYSQL_ASSOC);					 
  $description['products_description'];		

  if (tep_not_null($listing['specials_new_products_price'])) {						
  $lc_text = '<br><strong>Regular Price: </strong><s>' . 
  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s><br><strong>Sale Price:        </strong><span class="productSpecialPrice">'
   . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';					   
   } else {						 
   $lc_text = '<br><br><strong>Our Price: ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])). '</strong>';					  
 }		
  $info_box_contents[$row][$col] = array('text' =>

'<!-- one TBL Product -->			   
 <table border="0" width="100%" cellspacing="0" cellpadding="2">				 
  <tr>
  <td width="25%" align="left" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], null, null, 'hspace="1" vspace="1"') . '</a></td>
  <td width="50%" align="left" valign="top">
  <table width="100%" align="left" valign="top">
  <tr>
  <td><span class="productTitle"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></span>
   </td></tr>									  
 <tr><td>'. $description['products_description'] .'</td></tr></table>
   </td>
 <td valign="top" align="right">
 <table><tr><td align="right">' . $lc_text . '</td></tr>
 <tr><td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td></tr></table>
 </td> </tr>
 <tr>
 <td align="center" colspan="3"><hr /></td>							 
  </tr>							  
  </table>				  
   </td>				 
  </tr>			   
 </table>			  
<!-- one TBL Product -->');	   

$col ++;	   
if ($col > 0) {		 
$col = 0;		 
$row ++;	   
}}		 
 new contentBox($info_box_contents);
?>

<?php

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
   <br />
  <table border="0" width="100%" cellspacing="0" cellpadding="2"> 
 <tr>	   
	 <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>	  
	    <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> 
    </tr>
   </table>
<?php
 }
?>

 

Thanks again :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...