Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

products listing page addons help


drferrari

Recommended Posts

Posted

I use products related addons, below the first product image you can see e.g. 2 related products images.

 

look to my: products_listing.php page code.

 

I thing the problem is in: <div id='PhotosGallery'></div> and <div id="FirstPhoto"></div>

 

could someone help, I have been stuck.

 

<?php
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

if ($listing_split->number_of_rows > 0) {

echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td bgcolor="#9aa5a7"colspan="8"><img src="images/images-site/spacer.gif" width="10" height="2" /></td></tr>
<tr>';
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
 $product_contents = array();
 $rows++;
 if (($rows/2) == floor($rows/2)) {
 $list_box_contents[] = array('params' => 'class="productListing-even"');
 } else {
 $list_box_contents[] = array('params' => 'class="productListing-odd"');
 }
 $cur_row = sizeof($list_box_contents) - 1;
 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
 $lc_align = '';
 switch ($column_list[$col]) {
	 case 'PRODUCT_LIST_NAME':
	 $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
	 break;
	 case 'PRODUCT_LIST_IMAGE':
	 $lc_text = '<div id="FirstPhoto">';
	 $lc_text .= "<img src='images/".$listing['products_image']."' width=".LISTING_IMAGE_WIDTH." height=".LISTING_IMAGE_HEIGHT." title='".$listing['products_image']."' name='FirstImg'' />";
	 $lc_text .= '</div>';
	 break;
 }
 $list_box_contents[$cur_row][] = array('align' => $lc_align,
										 'params' => 'class="productListing-data"',
										 'text' => $lc_text);
 $product_contents[] = $lc_text;	
 }

echo '
<td width="25%" valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">

<table width="100%" border="0" cellpadding="1" cellspacing="6">
<tr>
<td width="1" valign="top" align="center">'.$product_contents[0].'<br>color: ';

$orderBy = 'ORDER BY ';
$orderBy .= 'pop_order_id ';
$orderBy .= (RELATED_PRODUCTS_MAX_DISP)?' limit ' . RELATED_PRODUCTS_MAX_DISP:'';
$attributes = "
SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image
FROM " . TABLE_PRODUCTS_RELATED_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb
WHERE pop_products_id_slave = pa.products_id AND pa.products_id = pb.products_id AND language_id = '" . (int)$languages_id . "'
AND pop_products_id_master = '". $listing['products_id'] ."' AND products_status = '1' " . $orderBy;
$attribute_query = tep_db_query($attributes);
if (mysql_num_rows($attribute_query)>0) {
$count = 0;
while ($attributes_values = tep_db_fetch_array($attribute_query)) {
 $products_name_slave = ($attributes_values['products_name']);
 $products_id_slave = ($attributes_values['pop_products_id_slave']);

 echo"<div id='PhotosGallery'>";
 echo "<img src='images/". $attributes_values['products_image']."' height='60' width='60' id='".$products_id_slave."' title='' onmousedown=\"imgShow('".$attributes_values['products_image']."','')\" />";
 echo "</div>";

}
}
echo '</td>
</tr>
<tr>
<td>-</td>
</tr>
</table>
</td>
</tr>
</table>
</td>';

}
echo '</tr></table>';
}else{
echo TEXT_NO_PRODUCTS;
}
?>

 

use this on your index.php <head>

 

<script language="javascript" type="text/javascript">

function imgShow(phSrc)

{

document.FirstImg.src="images/"+phSrc;

}

</script>

 

and ccstyle

 

#FirstPhoto img{margin:3px 5px 5px 5px;padding:1px;border:1px solid #666666;text-align:left;float:left;}

#PhotosGallery {margin:0 0 0 3px;text-align:left;float:left;padding:5px 0px 5px 0px;overflow:auto;}

#PhotosGallery img{cursor:pointer;padding:1px;margin:0px 2px 2px 2px; border:1px solid #666666;}

Archived

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

×
×
  • Create New...