Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Infobox header gap! Please help


Guest

Recommended Posts

Posted

Hello,

 

First of all this is a great site with a ton of information and community support for oscommerce. I did do a forum search and spent the better part of 2 hours or more sifting through the posts about the problem I am having. However none of them was really relevant to my specific problem.

 

I can not seem to find the file or code to remove the header gap in the infoboxes. Below is a screen shot of what I am talking about.

 

Untitled-2-1.jpg

 

Notice the gap there? How in the world can I remove this?

 

I have searched through countless files and tried adjusting the CSS but there is still a gap between the top of the white box to the top of the first menu item.

 

Thank you,

 

Jake Guthrie

Posted

Jake,

 

This should be fairly straight forward because the info boxes are just plain html developed by the class boxes.php.

 

View your page source and correct the problem there then fix it in the class.

 

I highly reccommend dropping in a new function for the fixed box and leave the old function alone (just in case).

 

I called mine infobox2. You will need to change the class call in your column box affected, and adjust your style sheet accordingly.

 

You might want to fool around with the stylesheet first to see if you can acheive your goal there.

 

Quite often you will see something like the following...

 

$info_box_contents = array();

$info_box_contents[] = array('text' => '<br />' . BOX_HEADING_WHATS_NEW);

 

You see the <br /> adds a space before the text creating a space. I think this was done so the class would be more scalable.

 

Hope this explan. helps.

How do you know when you know what you want to do for the rest of your life?

Posted

have u checked cellspacing/padding

 

if u show your generated source it would be easier to see where the problem lies.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Masat thank you for the reply. I did go into box.php and do some adjusting which is what gave me what you see in the screenshot. However I did not find any <br /> within the source of the box.php. I did adjust the cell padding and spaces however this did not fix the problem either. I will look into trying to add a new function for the fixed box.

 

Spooks yes I did check both of what you suggested.

 

Here is the generated source for the category box.

 

<!-- start categorybox //-->


<table class="infoBoxContents" border="0" width="100%" cellpadding="3" cellspacing="0">
 <tbody><tr>
<td><img src="images/pixel_trans.gif" alt="" border="0" width="100%" height="1"></td>
 </tr>
 <tr>
<td class="boxText"><a href="/ohiopoolsupply/index.php?cPath=1">Hardware-></a> (6)<br><a href="/ohiopoolsupply/index.php?cPath=2">Software-></a> (4)<br><a href="/ohiopoolsupply/index.php?cPath=3">DVD Movies-></a> (17)<br></td>

 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" alt="" border="0" width="100%" height="1"></td>
 </tr>
</tbody></table>


<!-- end categorybox //-->

 

This happens with all boxes by the way not just the category. I just used the cat box as an example.

 

Thanks again for the replies I look forward to any other suggestions you guys may have.

Posted

the cellpadding="3" there will be adding some vertical space

 

also check for any css default settings for the table elements

 

firefox has some handy tools

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Sam,

 

Yeah even if i take out that extra cellpadding="3" there is still a huge vertical gap there. I am going to try and add some css to see if I can just correct it that way for now. I am on a very tight time table now since I spent so long trying to figure out a few other problems I ran into this past week.

 

Thank you for the advice Sam. I am always open for more suggestions.

Posted

Ok tested it with IE and come to find out it is a FireFox related issue. So now I need to try and figure out what is causing it in FF but not in IE...

Posted

Ok after doing a firebug check the problem seems to be with <td><td><td> The first and last <td> needs to be removed. I just need to try and locate those two tags so I can remove them. Any suggestions ?

Posted

that don't appear in the source u gave, where does it appear?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Jake, I agree.

 

The table has cellpadding=3 and that is 3 on each side which makes six plus the one from the 1px pixel_trans is now seven plus the three cellpadding from the following td makes 10 pixels .

 

The code presented is not standard output from oscommerce but if you are still using the box class that is where you will find what you are looking for. It maybe set in the base class but hopefully it will be in an extention to the class.

How do you know when you know what you want to do for the rest of your life?

Posted

Yeah I just can not seem the find the correct piece of code in the boxes.php that will remove these unwanted tags.

 

  class tableBox {
var $table_border = '0';
var $table_width = '100%';
var $table_cellspacing = '0';
var $table_cellpadding = '2';
var $table_parameters = '';
var $table_row_parameters = '';
var $table_data_parameters = '';

// class constructor
function tableBox($contents, $direct_output = false) {
  $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
  if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
  $tableBox_string .= '>' . "\n";

  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
	$tableBox_string .= '  <tr';
	if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
	if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
	$tableBox_string .= '>' . "\n";

	if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
	  for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
		if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
		  $tableBox_string .= '	<td';
		  if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
		  if (isset($contents[$i][$x]['valign']) && tep_not_null($contents[$i][$x]['valign'])) $tableBox_string .= ' valign="' . $contents[$i][$x]['valign'] . '"'; // Added in v4.4
		  if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
			$tableBox_string .= ' ' . $contents[$i][$x]['params'];
		  } elseif (tep_not_null($this->table_data_parameters)) {
			$tableBox_string .= ' ' . $this->table_data_parameters;
		  }
		  $tableBox_string .= '>';
		  if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
		  $tableBox_string .= $contents[$i][$x]['text'];
		  if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
		  $tableBox_string .= '</td>' . "\n";
		}
	  }
	} else {
	  $tableBox_string .= '	<td';
	  if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
	  if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
		$tableBox_string .= ' ' . $contents[$i]['params'];
	  } elseif (tep_not_null($this->table_data_parameters)) {
		$tableBox_string .= ' ' . $this->table_data_parameters;
	  }
	  $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
	}

	$tableBox_string .= '  </tr>' . "\n";
	if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
  }

  $tableBox_string .= '</table>' . "\n";

  if ($direct_output == true) echo $tableBox_string;

  return $tableBox_string;
}

function infoBoxHeaderTemplate($headertext,$right_arrow) {
// STS 4.3: put header template and tags in $sts object, do not display them now.
// STS 4.5.2: BUG corrected, was checking content cache instead of header cache
  global $sts;

	$btrace=debug_backtrace();
	$boxname=basename($btrace[1]['file'],".php");
	$boxprefix = "infobox_";

	// Added in v4.4: allows to use catalog_filename.html as template for boxes created directly in a catalog script.
	$boxname2 = basename($btrace[2]['file'],".php"); // backtrace 2 is the file calling the calling file (like sts_column_left.php)
if ($boxname2=='') $boxprefix = "catalog_";

  if (file_exists(STS_TEMPLATE_DIR."boxes/$boxprefix".$boxname."_header.php.html")) {
		$template=sts_read_template_file (STS_TEMPLATE_DIR."boxes/$boxprefix".$boxname."_header.php.html");
	} elseif (isset($sts->infobox['default_header'])) { // Corrected in v4.5.2, was checking content cache
	  $template = $sts->infobox['default_header']; // Default box already in memory, get it from there
	}	elseif (file_exists(STS_TEMPLATE_DIR."boxes/infobox_header.php.html"))  { // v4.5.2: header template optional
		$template=sts_read_template_file (STS_TEMPLATE_DIR."boxes/infobox_header.php.html");
		$sts->infobox['default_header'] = $template;
	} else $sts->infobox['default_header'] = ''; // v4.5.2: If no header template, cache an empty string
	$sts->infobox_header_template = $template;
	$sts->infobox_headertext = $headertext;
	$sts->infobox_right_arrow = $right_arrow;
}

function infoBoxTemplate($content) {
// STS 4.3: read content, display header & content.
// STS 4.4: reset headertext and right_arrow variables in case next box has no header.
  global $sts;
	$btrace=debug_backtrace();
	$boxname=basename($btrace[1]['file'],".php"); // backtrace 1 is the calling file
	$boxprefix = "infobox_"; // Added in v4.3SP2.

	// Added in v4.4: allows to use catalog_filename.html as template for boxes created directly in a catalog script.
	$boxname2 = basename($btrace[2]['file'],".php"); // backtrace 2 is the file calling the calling file (like sts_column_left.php)
if ($boxname2=='') $boxprefix = "catalog_";

  if (file_exists(STS_TEMPLATE_DIR."boxes/$boxprefix$boxname.php.html")) {
		$template=sts_read_template_file (STS_TEMPLATE_DIR."boxes/$boxprefix$boxname.php.html");
	} elseif (isset($sts->infobox['default_content'])) {
	  $template = $sts->infobox['default_content']; // Default box already in memory, get it from there
	} else { // Otherwise read it from file and save it
	  $template = sts_read_template_file (STS_TEMPLATE_DIR."boxes/infobox.php.html");
		$sts->infobox['default_content'] = $template;

	}

	$template = $sts->infobox_header_template."\n".$template;	// Add header before the content. Header can be empty.
	$template = str_replace('$headertext', $sts->infobox_headertext, $template);
	$template = str_replace('$right_arrow', $sts->infobox_right_arrow, $template);
	$template = str_replace('$content', $content, $template);

	echo $template;
	$sts->infobox_header_template = '';
	$sts->infobox_headertext = '';
	$sts->infobox_right_arrow = '';
}
 } // END tableBox class

 class infoBox extends tableBox {
function infoBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="infoBox"';

  // START  STS
  global $sts;
  if ($sts->infobox_enabled == true) {
	  $this->infoboxtemplate($this->infoBoxContents($contents));
  } else {
  $this->tableBox($info_box_contents, true);
  }
  // END STS
}

function infoBoxContents($contents) {
  $this->table_cellpadding = '0';
  $this->table_parameters = 'class="infoBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '0', '0')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
									   'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
									   'params' => 'class="boxText"',
									   'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '0', '0')));
  return $this->tableBox($info_box_contents);
}
 }

 class infoBoxHeading extends tableBox {
function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
  $this->table_cellpadding = '0';

  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '0', '0');
  }


  // START  STS
  global $sts;
  if ($sts->infobox_enabled == true) {
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'width="100%" class="infoBoxHeading"',
									 'text' => $contents[0]['text']));

	$this->infoBoxHeaderTemplate($this->tablebox($info_box_contents),$right_arrow);
  } else {/*
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="infoBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="infoBoxHeading" nowrap',
									 'text' => $right_corner));
*/
	$this->tableBox($info_box_contents, false);
  }
  // END  STS
}
 }

 class contentBox extends tableBox {
function contentBox($contents) {

	global $sts;
	if ($sts->infobox_enabled == true) {
		$this->infoBoxTemplate($this->tableBox($contents));
	} else {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="infoBox"';
  $this->tableBox($info_box_contents, true);
	}
}

function contentBoxContents($contents) {
  $this->table_cellpadding = '4';
  $this->table_parameters = 'class="infoBoxContents"';
  return $this->tableBox($contents);
}
 }

 class contentBoxHeading extends tableBox {
function contentBoxHeading($contents) {

	// START  STS
	global $sts;
	if ($sts->infobox_enabled == true) {
	$info_box_contents = array();
	$info_box_contents[] = array(array('params' => 'class="infoBoxHeading" width="100%"',
									   'text' => $contents[0]['text']));

	  $this->infoBoxHeaderTemplate($this->tablebox($info_box_contents),$right_arrow);
	} else {
  $this->table_width = '100%';
  $this->table_cellpadding = '0';

  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
									 'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif')),
							   array('params' => 'height="14" class="infoBoxHeading" width="100%"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="infoBoxHeading"',
									 'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif')));
	$this->tableBox($info_box_contents, true);
	}
	// END STS

}
 }

 class errorBox extends tableBox {
function errorBox($contents) {
  $this->table_data_parameters = 'class="errorBox"';

	  $this->infoBoxTemplate($this->infoBoxContents($contents));
}
 }

 class productListingBox extends tableBox {
function productListingBox($contents) {
	  // START  STS 4.4: optionally use template infobox_product_listing.php.html around product listing table.
		// If template does not exist, do not use default infobox template but use standard osC.
	global $sts;
	if ($sts->infobox_enabled == true && file_exists(STS_TEMPLATE_DIR."boxes/infobox_product_listing.php.html")) {
		//$this->infoBoxHeaderTemplate("","");
		$this->infoBoxTemplate($this->tablebox($contents));
	} else {
  $this->table_parameters = 'class="productListing"';
  $this->tableBox($contents, true);
		}
	  // STOP STS
}

 }
?>

 

I know I am using the STS however I am actually just using the boxes.php and not a sts standard html for the infoboxes.

Posted

ehh I am so stuck on this problem. However maybe if I walk away for the day it will come to me... Thanks for the help guys. Off to try and fix another problem heh.

Posted

I'm sorry you got mixed up in the STS thing.

 

Have you looked into the sts templates.

 

Try a code search for -> <!-- start categorybox //-->

 

You might even start by searching the includes->sts_templates if not do the whole site.

 

Have you looked into the sts contribution forum.

 

It is scary to think of the number of people who have tried sts and failed or worse became discouraged. It is kind of like walking through a corn field. You can see the sky but don't know where the heck you are.

 

Sorry Jake. I'm out of this one because of sts.

 

Take Care and best of luck.

How do you know when you know what you want to do for the rest of your life?

Posted

Hey Tim,

 

Yeah I have noticed many people love STS while many people did not like it so much.

 

Which would you suggest doing. STS for a person new to oscommerce ? STS,original template system or another addon if there is one? I am not lazy at all and I do learn as I go while taken notes as I go. However I will not lie I am new to CMS's that does not use smarty type template system. So which what would you suggest? Also do you know or anyone know of any easy to follow lol baby steps type tutorials for oscommerce template system?

 

Thank you all for the advice and effort,

 

Jake

Archived

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

×
×
  • Create New...