Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem popup image in product_listing, please help.


Eusebio100

Recommended Posts

Hello,

I believe that this forum is right for my query.

I want this contribution in my product_listing, but it is still not functioning well:

http://addons.oscommerce.com/info/4594

 

I have a template TM9792 and product_listing in columns, but I only works well on the first row, after all evil.

Someone can help me?

 

You can see how it is in my shop: http://www.mazintshop.com/shop/index.php?c...de-pulsera-fila

 

Sorry, my English is very bad.

I appreciate your help

Thank.

 

this is my file product_listing:

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 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
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'PRODUCT_LIST_MODEL':
	$lc_text = TABLE_HEADING_MODEL;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_MANUFACTURER':
	$lc_text = TABLE_HEADING_MANUFACTURER;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_PRICE':
	$lc_text = TABLE_HEADING_PRICE;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_QUANTITY':
	$lc_text = TABLE_HEADING_QUANTITY;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_WEIGHT':
	$lc_text = TABLE_HEADING_WEIGHT;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'PRODUCT_LIST_BUY_NOW':
	$lc_text = TABLE_HEADING_BUY_NOW;
	$lc_align = 'center';
	break;
}

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {
$rows = 0;
$column = 0;
$listing_query = tep_db_query($listing_split->sql_query);  
$pop_up = 0;

?>
<script language="javascript" type="text/javascript">
	<!--

	/*
	Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
	Copyright 2002 by Sharon Paine
	Visit http://www.dynamicdrive.com for this script
	*/

	/* IMPORTANT: Put script after tooltip div or
		 put tooltip div just before </BODY>. */

	var dom = (document.getElementById) ? true : false;
	var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
	var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
	var ns4 = (document.layers && !dom) ? true : false;
	var ie4 = (document.all && !dom) ? true : false;
	var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

	// resize fix for ns4
	var origWidth, origHeight;
	if (ns4) {
		origWidth = window.innerWidth; origHeight = window.innerHeight;
		window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
	}

	// avoid error of passing event object in older browsers
	if (nodyn) { event = "nope" }

	///////////////////////  CUSTOMIZE HERE   ////////////////////
	// settings for tooltip
	// Do you want tip to move when mouse moves over link?
	var tipFollowMouse= true;
	// Be sure to set tipWidth wide enough for widest image
	var tipWidth= 0;
	var offX= 20;	// how far from mouse to show tip
	var offY= 12;
	var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
	var tipFontSize= "8pt";
	// set default text color and background color for tooltip here
	// individual tooltips can have their own (set in messages arrays)
	// but don't have to
	var tipFontColor= "#000000";
	var tipBgColor= "";
	var tipBorderColor= "";
	var tipBorderWidth= 0;
	var tipBorderStyle= "none";
	var tipPadding= 0;

	// tooltip content goes here (image, description, optional bgColor, optional textcolor)
	var messages = new Array();
	// multi-dimensional arrays containing:
	// image and text for tooltip
	// optional: bgColor and color to be sent to tooltip
<?
$listing_query2 = tep_db_query($listing_split->sql_query);
while ($listings = tep_db_fetch_array($listing_query2)) {
$wer=explode('"',tep_image(DIR_WS_IMAGES . $listings['products_image'], $listings['products_name']));
?>
	messages[<?=$pop_up?>] = new Array('<?=$wer[1]?>','<?=addslashes($listings['products_name'])?>',"#FFFFFF");
<?
$pop_up++;
}
?>
////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

	// preload images that are to appear in tooltip
	// from arrays above
	if (document.images) {
		var theImgs = new Array();
		for (var i=0; i<messages.length; i++) {
		theImgs[i] = new Image();
			theImgs[i].src = messages[i][0];
	  }
	}

	// to layout image and text, 2-row table, image centered in top cell
	// these go in var tip in doTooltip function
	// startStr goes before image, midStr goes between image and text
	var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
	var midStr = '" border="1"></td></tr><tr><td valign="top">';
	var endStr = '</td></tr></table>';

	////////////////////////////////////////////////////////////
	//  initTip	- initialization for tooltip.
	//		Global variables for tooltip.
	//		Set styles for all but ns4.
	//		Set up mousemove capture if tipFollowMouse set true.
	////////////////////////////////////////////////////////////
	var tooltip, tipcss;
	function initTip() {
		if (nodyn) return;
		tooltip = (ns4)? document.tipDiv.document: (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
		tipcss = (ns4)? document.tipDiv: tooltip.style;
		if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
			tipcss.width = tipWidth+"px";
			tipcss.fontFamily = tipFontFamily;
			tipcss.fontSize = tipFontSize;
			tipcss.color = tipFontColor;
			tipcss.backgroundColor = tipBgColor;
			tipcss.borderColor = tipBorderColor;
			tipcss.borderWidth = tipBorderWidth+"px";
			tipcss.padding = tipPadding+"px";
			tipcss.borderStyle = tipBorderStyle;
		}
		if (tooltip&&tipFollowMouse) {
			if (ns4) document.captureEvents(Event.MOUSEMOVE);
			document.onmousemove = trackMouse;
		}
	}

	window.onload = initTip;

	/////////////////////////////////////////////////
	//  doTooltip function
	//			Assembles content for tooltip and writes
	//			it to tipDiv
	/////////////////////////////////////////////////
	var t1,t2;	// for setTimeouts
	var tipOn = false;	// check if over tooltip link
	function doTooltip(evt,num) {
		if (!tooltip) return;
		if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
		tipOn = true;
		// set colors if included in messages array
		if (messages[num][2])	var curBgColor = messages[num][2];
		else curBgColor = tipBgColor;
		if (messages[num][3])	var curFontColor = messages[num][3];
		else curFontColor = tipFontColor;
		if (ns4) {
			var tip = '<table bgcolor="' + tipBorderColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0"><tr><td><table bgcolor="' + curBgColor + '" width="100%" cellspacing="0" cellpadding="' + tipPadding + '" border="0"><tr><td>'+ startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; background:#FFFFFF; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr + '</td></tr></table></td></tr></table>';

			tooltip.write(tip);
			tooltip.close();
		} else if (ie4||ie5||ns5) {
			var tip = '<table bgcolor="0" bgcolor="#FFFFFF"><tr><td>' + startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; background:#000000; font-size:' + tipFontSize + '; color:#FFFFFF;">' + messages[num][1] + '</span>' + endStr + '</tr></td></table>';
			tipcss.backgroundColor = curBgColor;
			tooltip.innerHTML = tip;
		}
		if (!tipFollowMouse) positionTip(evt);
		else t1=setTimeout("tipcss.visibility='visible'",100);
	}

	var mouseX, mouseY;
	function trackMouse(evt) {
		mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
		mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
		if (tipOn) positionTip(evt);
	}

	/////////////////////////////////////////////////////////////
	//  positionTip function
	//		If tipFollowMouse set false, so trackMouse function
	//		not being used, get position of mouseover event.
	//		Calculations use mouseover event position,
	//		offset amounts and tooltip width to position
	//		tooltip within window.
	/////////////////////////////////////////////////////////////
	function positionTip(evt) {
		if (!tipFollowMouse) {
			mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
			mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
		}
		// tooltip width and height
		var tpWd = (ns4)? tooltip.width: (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
		var tpHt = (ns4)? tooltip.height: (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
		// document area in view (subtract scrollbar width for ns)
		var winWd = (ns4||ns5)? window.innerWidth-20+window.pageXOffset: document.body.clientWidth+document.body.scrollLeft;
		var winHt = (ns4||ns5)? window.innerHeight-20+window.pageYOffset: document.body.clientHeight+document.body.scrollTop;
		// check mouse position against tip and window dimensions
		// and position the tooltip
		if ((mouseX+offX+tpWd)>winWd)
			tipcss.left = (ns4)? mouseX-(tpWd+offX): mouseX-(tpWd+offX)+"px";
		else tipcss.left = (ns4)? mouseX+offX: mouseX+offX+"px";
		if ((mouseY+offY+tpHt)>winHt)
			tipcss.top = (ns4)? winHt-(tpHt+offY): winHt-(tpHt+offY)+"px";
		else tipcss.top = (ns4)? mouseY+offY: mouseY+offY+"px";
		if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
	}

	function hideTip() {
		if (!tooltip) return;
		t2=setTimeout("tipcss.visibility='hidden'",100);
		tipOn = false;
	}

	//-->
	</script>	

<?php		

echo '  

   <table cellspacing=0 cellpadding=0 width=437 align=center>
	<tr><td background=images/m22.gif width=437 height=29 valign=top>
	 <table cellspacing=0 cellpadding=0>
	  <tr><td height=8></td></tr>
	  <tr><td width=25></td><td class=ch6>' . BOX_HEADING_CATEGORIES . '</td><td valign=middle class=ch23 span>  \</span>  <u>'.$breadcrumb->trail(' » ').'</u></td></tr>
	 </table>
	</td></tr>
	<tr><td valign=top class=ch7>
	   <table cellspacing=0 cellpadding=0 width=417 border=0 align=center>
	   <tr><td height=10></td></tr>
		 <tr>

	 ';

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_MODEL':
		$lc_align = '';
		$lc_text = ' ' . $listing['products_model'] . ' ';
		break;
	  case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		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']) . '">' . $listing['products_name'] . '</a>';
		} else {
		  $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_MANUFACTURER':
		$lc_align = '';
		$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
		break;
	  case 'PRODUCT_LIST_PRICE':
		$lc_align = 'right';
		if (tep_not_null($listing['specials_new_products_price'])) {
		  $lc_text = '<span class=ch8 style="color:#7F7F7F;font-size:11px"><s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s></span><br>		 <span class=ch8>' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
		} else {
		  $lc_text = '<span class=ch8>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
		}	  
		break;
	  case 'PRODUCT_LIST_QUANTITY':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_quantity'] . ' ';
		break;
	  case 'PRODUCT_LIST_WEIGHT':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_weight'] . ' ';
		break;
	  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']) . '" onmouseover="doTooltip(event,'.($rows-1).')" onmouseout="hideTip()">' . 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']) . '" onmouseover="doTooltip(event,'.($rows-1).')" onmouseout="hideTip()">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break;
	  case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
		break;
	}

	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
	$product_contents[] = $lc_text;	  
  }


  $product_query = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)1 . "'");
  $product = tep_db_fetch_array($product_query);
  $new_products['products_description'] = $product['products_description'];

  echo '

		 <td width=208 valign=top align=center>			
		   <table cellspacing=0 cellpadding=0 width=200 align=center>

			<tr><td width=90 align=center valign=top>'.$product_contents[0].'</td>
			<td valign=top>
			  <table cellspacing=0 border=0  cellpadding=0>
			   <tr><td height=55 valign=middle>'.$product_contents[1].'</td></tr>

			   <tr><td height=30 valign=middle  class=ch10>'.preg_replace('/\s\S*$/i', '', substr($new_products['products_description'], 0, 25)).'</td></tr>
			   <tr><td height=0></td></tr>
			   <tr><td height=35 valign=middle><span  class=ch11>' . TEX_PRICE . '</span> <span class=ch8>'.$product_contents[2].'</span> </td></tr>
			  </table>
			 </td>
			</tr>
			<tr><td height=2></td></tr>	
			<tr><td colspan=2 align=right><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('detalles.gif') . '</a>  </td></tr>
			<tr><td colspan=2 align=right>' . tep_draw_hidden_field('products_id', $listing['products_id']) . (($listing['products_weight'] == 0) ? '<a href="' . tep_href_link('shipping1.php') . '"target="_blank"' . '">' . tep_image_button('frete_gratis.gif', frete_gratis) : '') . '</a>
											<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a>   </td></tr>
		  </table>
		 </td>



  ';
  $column ++;
  if ($column >= 2) {
	$rows ++;
	$column = 0;
	echo '

		 </tr>
		 <tr><td height=5></td></tr>
		  <tr><td colspan=3 valign=top>
		   <table cellspacing=0 cellpadding=0>
			<tr><td width=200 height=1 background=images/m29.gif></td><td width=14></td> <td width=200 height=1 background=images/m29.gif></td></tr>
		   </table>
		  </td></tr>
		  <tr><td height=5></td></tr>
		  <tr>


		 ';
  } else echo '<td background=images/m09.gif width=1></td>';



}

echo '

				 </tr>					
		  </table>
	 </td></tr>
	<tr><td><img src=images/m30.gif width=438 height=7></td></tr>
   </table>


	 ';

//new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);

echo '<div class=PageHeading>Categorias</div>';
new productListingBox($list_box_contents);
 }

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

<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr><td height=20></td></tr>
 <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
 }
?>
<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...