Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with two boxes in left column


Fyod

Recommended Posts

I installed Pollbooth contrib and since my shop code is a bit different, I'm having this problem:

 

Each box ends with a gif line. The main information is in <table>, but the poll box doesn't have the <table>

I think the problem is that in polls.php, "new infoBox($info_box_contents);" is not outside of a table, therefore in polls.php it "sticks" under the last <td> which makes all of the <td>'s in the poll the same size as the gif.

 

What I want is to add <table cellspacing="0" cellpadding="0" align="center" border="0"> and </table> before "new infoBox($info_box_contents);", but I have no idea how to do it.

 

Of course I could just get rid of the gif, which would solve the problem (I've tested that), but I don't want to do that.

 

Here are the two different boxes for comparison:

 

POLLS.PHP

<!-- polls //-->
<?php
require(DIR_WS_LANGUAGES . $language . '/pollbooth.php');
 $hide = tep_hide_session_id();

function pollnewest() {
	global $customer_id, $HTTP_GET_VARS;
	if (DISPLAY_POLL_HOW==3) {
			$extra_query=" and pollID='" . DISPLAY_POLL_ID . "'";
			}
	if (!isset($customer_id)) {
			$extra_query.=" and poll_type='0' ";
			}
	if (DISPLAY_POLL_HOW==2) {
			$order = 'voters DESC';
			 } else {
			$order = 'timestamp DESC';
			}
	$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query."and catID != 0 order by ".$order);
	$count=tep_db_num_rows($query);
	$result = tep_db_fetch_array($query);
	$pollid = false;
	if ($count>0) {
	   if ($HTTP_GET_VARS['cPath']) $mypath = $HTTP_GET_VARS['cPath'];
	   if ($HTTP_GET_VARS['products_id'])$mypath = tep_get_product_path($HTTP_GET_VARS['products_id']);
	   if ($mypath) {
		 $sub_cat_ids = split("[_]", $mypath);
		 for ($i = 0; $i < count($sub_cat_ids); $i++) {
		   if ($sub_cat_ids[$i] == $result['catID']) $pollid = $result['pollid'];
		 }
	   }
	}
	if(empty($HTTP_GET_VARS['cPath'])){
	$catid=0;
	}
	if($HTTP_GET_VARS['cPath']) {
	$mypath = $HTTP_GET_VARS['cPath'];
	list($catid, $subcatid)=split("[_]", $mypath);
	//echo $catid;
	}

	$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$catid ." order by ".$order);

	$count=tep_db_num_rows($query);
		   if ((!DISPLAY_POLL_HOW==0 || $count==1) && !$pollid) {
			if ($result=tep_db_fetch_array($query)) {
					$pollid = $result['pollid'];
			}
	} elseif (!$pollid) {
			mt_srand((double) microtime() * 1000000);
			$rand = mt_rand(1,$count);
			for($i=0;$i<$rand;$i++) {
					$result=tep_db_fetch_array($query);
					$pollid = $result['pollid'];
					}
	}
	return $pollid;
}
if (basename($PHP_SELF) !='pollbooth.php') {
$pollid=pollnewest();
if ($pollid) {
?>
 <tr>
	<td>
<?php
	$poll_query=tep_db_query("select voters from phesis_poll_desc where pollid=$pollid and poll_open='0'");
	$poll_details=tep_db_fetch_array($poll_query);
	$title_query = tep_db_query("select optionText from phesis_poll_data where pollid=$pollid and voteid='0' and language_id = '" . $languages_id . "'");
	$title = tep_db_fetch_array($title_query);
	$info_box_contents = array();
	  $info_box_contents[] = array('align' => 'center',
						   'text'  => _POLLS
						  );
	  new infoBoxHeading($info_box_contents, false, false);
	  $url = tep_href_link('pollbooth.php', 'op=results&pollid='.$pollid);
	$content = "<tr><td colspan=\"2\" class=\"main\">" . $title['optionText'] . "</td></tr>";
	 $content .=  "<input type=\"hidden\" name=\"pollid\" value=\"".$pollid."\">\n";
	  $content .=  "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">\n";
	for ($i=1;$i<=8;$i++) {
		  $query=tep_db_query("select pollid, optiontext, optioncount, voteid from phesis_poll_data where (pollid=$pollid) and (voteid=$i) and (language_id=$languages_id)");
		  if ($result=tep_db_fetch_array($query)) {
						  if ($result['optiontext']) {
				   $content.= "<tr class=\"pollOptRow\"><td class=\"pollBoxRow\"><input type=\"radio\" name=\"voteid\" value=\"".$i."\" class=\"radio\"></td><td class=\"pollBoxRow\">".$result['optiontext']."</td></tr>";
				   }
				}
	}
	$content .= "<tr class=\"pollFooter\"><td colspan=\"2\"><center><input type=\"submit\" value=\""._VOTE."\"></center>\n</td></tr>";
	$query=tep_db_query("select sum(optioncount) as sum from phesis_poll_data where pollid=$pollid");
	$query1=tep_db_query("select count(pollid) as comments from phesis_comments where pollid=$pollid and language_id=$languages_id");
	$result1 = tep_db_fetch_array($query1);
	$comments1  = $result1['comments'];
	if ($result=tep_db_fetch_array($query)) {
			$sum=$result['sum'];
	}
	$content .= "<tr class=\"pollFooter\"><td colspan=\"2\" class=\"pollBoxText\"><center>[ <a href=\"" . tep_href_link('pollbooth.php', 'op=results&pollid=' .$pollid, 'NONSSL')."\"><u>"._RESULTS."</u></a> ]</td></tr>";
	$content .= "<tr class=\"pollFooter\"><td class=\"pollBoxText\"><center>" . $sum . " "._VOTES."</center>\n</td><td class=\"pollBoxText\"><center>" . $comments1  . " "._COMMENTS."</center>\n</td></tr><tr>";
$info_box_contents = array();
$info_box_contents[] = array('form' => '<form name="poll" method="post" action="'. tep_href_link('pollcollect.php') .'">',
						   'align' => 'center',
						   'text'  => $content
						  );
new infoBox($info_box_contents);
?>
	</td>
 </tr>
<?php
} elseif (SHOW_NOPOLL==1) {
?>
 <tr>
	<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
						   'text'  => _NOPOLLS
						);
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
						  'text'  => _NOPOLLSCONTENT
						 );
new infoBox($info_box_contents);
?>
	</td>
 </tr>
<?php
}
}
?>
<!-- polls-eof //-->

 

WHATS_NEW.PHP

<?php
/*
 $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
	  <tr>
		<td class="">
<?php
$random_product['products_name'] = tep_get_products_name($random_product['products_id']);
$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

if (tep_not_null($random_product['specials_new_products_price'])) {

  $name_prod = '
  <span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . substr( $random_product['products_name'],0,MAX_DESCR_NAME_BOX) . '</a></span>
  ';

  $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s>     ';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = '<span class="productSpecialPrice">'.$currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])).'</span>';

   $name_prod = '
  <span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . substr( $random_product['products_name'],0,MAX_DESCR_NAME_BOX) . '</a></span>
  ';
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center ',
							 'text' => '
								<table cellspacing="0" cellpadding="0" align="center" border="0">
									<tr><td align="center" class="pic">
			<br style="line-height:5px">
			<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '</a><br>
			<br style="line-height:9px">
			'.$name_prod.'<br>
			<br style="line-height:9px">'.$whats_new_price.'

									</td></tr>
								</table>
							 ');

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

 

BOXES.PHP around line 123

		$info_box_contents[] = array(  array('params' => ' align="center"',
				'text' => ''.tep_image(DIR_WS_IMAGES.'1-line3.gif').''));	  }

Link to comment
Share on other sites

And here's the code ripped from the working index.php.

 

<!-- whats_new //-->
	  <tr>
		<td class="">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td  class="box_header_txt">xxx</td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:6px;">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_body">
 <tr>
<td align="center"  style="padding:0px 29px 14px 29px;">
								<table cellspacing="0" cellpadding="0" align="center" border="0">
									<tr><td align="center" class="pic">
			<br style="line-height:5px">
			<a href="http://xxx/product_info.php?products_id=253"><img src="xxx.jpg" border="0" alt="xxx" title="xxx" width="150" height="100"></a><br>
			<br style="line-height:9px">

  <span><a href="http://xxx/product_info.php?products_id=253">xxx</a></span>
  <br>
			<br style="line-height:9px"><span class="productSpecialPrice">xxx</span>

									</td></tr>
								</table>
							 </td>
 </tr>
 <tr>
<td  align="center"><img src="images/1-line3.gif" border="0" alt="" width="211" height="1"></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- whats_new_eof //-->
<!-- polls //-->
 <tr>
	<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td  class="box_header_txt">Polls</td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:6px;">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_body">
 <tr>
<td align="center"  style="padding:0px 29px 14px 29px;"><form name="poll" method="post" action="http://xxx/pollcollect.php"><tr><td colspan="2" class="main">Poll name</td></tr><input type="hidden" name="pollid" value="4">
<input type="hidden" name="forwarder" value="http://xxx/pollbooth.php?op=results&pollid=4">
<tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="1" class="radio"></td><td class="pollBoxRow">1</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="2" class="radio"></td><td class="pollBoxRow">2</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="3" class="radio"></td><td class="pollBoxRow">3</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="4" class="radio"></td><td class="pollBoxRow">4</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="5" class="radio"></td><td class="pollBoxRow">5</td></tr><tr class="pollFooter"><td colspan="2"><center><input type="submit" value="VOTE"></center>
</td></tr><tr class="pollFooter"><td colspan="2" class="pollBoxText"><center>[ <a href="http://xxx/pollbooth.php?op=results&pollid=4"><u>Results</u></a> ]</td></tr><tr class="pollFooter"><td class="pollBoxText"><center>0 Votes</center>
</td><td class="pollBoxText"><center>0 Comments</center>
</td></tr></form></td>
 </tr>
 <tr>
<td  align="center"><img src="images/1-line3.gif" border="0" alt="" width="211" height="1"></td>
 </tr>
</table>
</td>
 </tr>
</table>
	</td>
 </tr>
<!-- polls-eof //-->

Link to comment
Share on other sites

Got it <table cellspacing="0" cellpadding="0" align="center" border="0">

has to be <table cellspacing=\"0\" cellpadding=\"0\" align=\"center\" border=\"0\">

 

I'll be the php master of the universe when I'm done with this shop :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...