Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

InfoBoxes & Boxes.php


Suppleme

Recommended Posts

Posted

Hi,

 

I'm using the STS contribution on my store and for the Manufacturer Infobox I want the box content only - so just the drop-down box.

 

Now I have been editing the following two files:

/includes/boxes/manufacturers.php

/includes/classes/boxes.php

 

I have managed to remove just about everything, like the heading & spacing images etc but I am left with an empty table row that I do not know how to remove.

 

Here is the browser output. As you can see an empty table row.

<!-- start manufacturerbox //-->

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
   <td></td>
 </tr>
 <tr>
   <td class="boxText"><form name="manufacturers" action="http://mystore.com/index.php" method="get"><select name="manufacturers_id" onChange="this.form.submit();" size="1" style="width: 100%"><option value="" SELECTED>Please Select</option><option value="6">Canon</option><option value="4">Fox</option><option value="8">GT Interactive</option><option value="9">Hewlett Packard</option><option value="5">Logitech</option><option value="1">Matrox</option><option value="2">Microsoft</option><option value="7">Sierra</option><option value="3">Warner</option></select></form></td>

 </tr>
</table>


<!-- end manufacturerbox //-->

 

Any idea how I can remove this? I'm guessing I need to amend something in the following two files. I have pasted my current code for these files. Thanks.

 

/includes/boxes/manufacturers.php

<?php
/*
 $Id: manufacturers.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>
<!-- manufacturers //-->
         <tr>
           <td>
<?php
   $info_box_contents = array();

   if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
     $manufacturers_list = '';
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
       $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
     }

     $manufacturers_list = substr($manufacturers_list, 0, -4);

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $manufacturers_list);
   } else {
// Display a drop-down
     $manufacturers_array = array();
     if (MAX_MANUFACTURERS_LIST < 2) {
       $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
     }

     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                      'text' => $manufacturers_name);
     }

     $info_box_contents = array();
     $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());
   }

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

 

 

/includes/classes/boxes.php

<?php
/*
 $Id: boxes.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class tableBox {
   var $table_border = '0';
   var $table_width = '100%';
   var $table_cellspacing = '0';
   var $table_cellpadding = '0';
   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_";
	$module_file=0;
	if(stristr($btrace[1]['file'], 'modules') !== FALSE) { $module_file=1; }
	// 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();
	$module_file=0;
	if(stristr($btrace[1]['file'], 'modules') !== FALSE) { $module_file=1; }
	$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($module_file==1) {
		 $template ='$content'; // Default box already in memory, get it from there

	}elseif (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 = '3';
     $this->table_parameters = 'class="infoBoxContents"';
     $info_box_contents = array();
     $info_box_contents[] = array();
     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'] : '')));
     }
     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', '11', '14');
     }


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

    $this->infoBoxHeaderTemplate($contents[0]['text'],$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, true);

  }
  // 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
   }

 }
?>

Posted

Hi,

 

I'm using the STS contribution on my store and for the Manufacturer Infobox I want the box content only - so just the drop-down box.

 

Now I have been editing the following two files:

/includes/boxes/manufacturers.php

/includes/classes/boxes.php

 

I have managed to remove just about everything, like the heading & spacing images etc but I am left with an empty table row that I do not know how to remove.

 

Here is the browser output. As you can see an empty table row.

<!-- start manufacturerbox //-->

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
   <td></td>
 </tr>
 <tr>
   <td class="boxText"><form name="manufacturers" action="http://mystore.com/index.php" method="get"><select name="manufacturers_id" onChange="this.form.submit();" size="1" style="width: 100%"><option value="" SELECTED>Please Select</option><option value="6">Canon</option><option value="4">Fox</option><option value="8">GT Interactive</option><option value="9">Hewlett Packard</option><option value="5">Logitech</option><option value="1">Matrox</option><option value="2">Microsoft</option><option value="7">Sierra</option><option value="3">Warner</option></select></form></td>

 </tr>
</table>


<!-- end manufacturerbox //-->

 

Any idea how I can remove this? I'm guessing I need to amend something in the following two files. I have pasted my current code for these files. Thanks.

 

/includes/boxes/manufacturers.php

<?php
/*
 $Id: manufacturers.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>
<!-- manufacturers //-->
         <tr>
           <td>
<?php
   $info_box_contents = array();

   if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
     $manufacturers_list = '';
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
       $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
     }

     $manufacturers_list = substr($manufacturers_list, 0, -4);

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $manufacturers_list);
   } else {
// Display a drop-down
     $manufacturers_array = array();
     if (MAX_MANUFACTURERS_LIST < 2) {
       $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
     }

     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                      'text' => $manufacturers_name);
     }

     $info_box_contents = array();
     $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());
   }

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

 

 

/includes/classes/boxes.php

<?php
/*
 $Id: boxes.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class tableBox {
   var $table_border = '0';
   var $table_width = '100%';
   var $table_cellspacing = '0';
   var $table_cellpadding = '0';
   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_";
	$module_file=0;
	if(stristr($btrace[1]['file'], 'modules') !== FALSE) { $module_file=1; }
	// 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();
	$module_file=0;
	if(stristr($btrace[1]['file'], 'modules') !== FALSE) { $module_file=1; }
	$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($module_file==1) {
		 $template ='$content'; // Default box already in memory, get it from there

	}elseif (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 = '3';
     $this->table_parameters = 'class="infoBoxContents"';
     $info_box_contents = array();
     $info_box_contents[] = array();
     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'] : '')));
     }
     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', '11', '14');
     }


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

    $this->infoBoxHeaderTemplate($contents[0]['text'],$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, true);

  }
  // 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
   }

 }
?>

 

If I understand what you want you should not change anything in the code but go to admin panel > configuration > maximum values > manufacturers and set it to 0 you will have dropdown list no matter how many manufacturers you will add.

Posted

Hi Mirko,

 

Thanks but I don't think you understand what I mean.

 

Oscommerce is trying to display the Manufacturer in a dropdown BUT WITHIN an InfoBox (new infoBox($info_box_contents);

I am using my own html template and do not want the Info Box I just want the box content. So in this case I just want the drop down box.

In a normal info box you get headers and spacer pixels etc none of which I want. At the minute I am stuck with an empty table row.

 

Maybe it would be possible to skip the Boxes.php entirely and print the $info_box_contents straight to browser.(not in an InfoBox)

 

Only thing is my php skills are pretty poor. I've managed to print the entire array to Browser using 'print_r ($info_box_contents);' but I only need the 'form' and 'text' parts of the array from manufacturer.php

Archived

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

×
×
  • Create New...