Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

boxes.php -> class contentBox NEED HELP!


MaxB

Recommended Posts

Posted

Hi!

 

I want to create a new contentBox class to make the "New Products" Box on the Homepage appear pretty similiar like this:

 

osc1.jpg

 

By now I figured out how to make the rounded edges on top and on bottom but I got stuck on how to insert tables in the table.

 

That?s what I got so far:

 

// New Contentbox BOF


 class contentBoxHeading2 extends tableBox {
   function contentBoxHeading2($contents) {
     $this->table_width = '100%';
     $this->table_cellpadding = '0';

     $info_box_contents = array();
     $info_box_contents[] = array(array('params' => 'height="20" class="mainboxtop"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/tcorn_le.gif')),
                                  array('params' => 'height="20" class="mainboxtop" width="100%"',
                                        'text' => $contents[0]['text']),
                                  array('params' => 'height="20" class="mainboxtop"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/tcorn_re.gif')));

     $this->tableBox($info_box_contents, true);
   }
 }

 class contentBox2 extends tableBox {
   function contentBox2($contents) {
  $this->table_width = '100%';
     $this->table_cellspacing = '0';

     $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'width="7" class="mainboxmid_le"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/mid_le.gif')),
                                  array('params' => 'class="mainboxmid" width="100%"',
                                        'text' => $this->contentBoxContents2($contents)),
                                  array('params' => 'width="7" class="mainboxmid_re"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/mid_re.gif')));
  
  

     $this->tableBox($info_box_contents, true);
   }

 function contentBoxContents2($contents) {
     $this->table_cellpadding = '0';
     $this->table_parameters = 'class="infoBoxssContents"';

     return $this->tableBox($contents);
   }

 }

 
class contentBox2Footer extends tableBox { 
function contentBox2Footer() { 
  $this->table_cellpadding = '0'; 

  $middle_part = tep_image(DIR_WS_IMAGES . 'layout/spacer.gif');  

 $left_corner = tep_image(DIR_WS_IMAGES . 'layout/mainbox/bot_le.gif'); 

 $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'layout/mainbox/bot_re.gif'); 


  $info_box_contents = array(); 
  $info_box_contents[] = array(array('params' => 'width="7" height="7" class="mainboxbot"', 'text' => $left_corner), 
          array('params' => 'width="100%" height="7" class="mainboxbot"', 'text' => $middle_part), 
          array('params' => 'width="7" height="7" align="right" class="mainboxbot"', 'text' => $right_corner)); 
  $this->tableBox($info_box_contents, true); 
} 
}
 
// New ContentBox EOF

 

The Problem is that I want to add another Table in the contentBox2 class in this section...

 

  class contentBox2 extends tableBox {
   function contentBox2($contents) {
  $this->table_width = '100%';
     $this->table_cellspacing = '0';

     $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'width="7" class="mainboxmid_le"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/mid_le.gif')),
                                  array('params' => 'class="mainboxmid" width="100%"',
                                        'text' => $this->contentBoxContents2($contents)),
                                  array('params' => 'width="7" class="mainboxmid_re"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'layout/mainbox/mid_re.gif')));
  
  

     $this->tableBox($info_box_contents, true);
   }

   function contentBoxContents2($contents) {
     $this->table_cellpadding = '0';
     $this->table_parameters = 'class="infoBoxssContents"';

     return $this->tableBox($contents);
   }

 }

 

... where the contentBoxContents2 Function is called.

 

array('params' => 'class="mainboxmid" width="100%"',
                                        'text' => $this->contentBoxContents2($contents)),

 

I?ve tried to modify the contentBoxContents2 Funtion this way...

 

  function contentBoxContents2($contents) {
     $this->table_cellpadding = '0';
     $this->table_parameters = 'class="infoBoxssContents"';
  
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'class="mainboxmid" width="100%"',
                                        'text' => $this->contentBoxContents3($contents));

     $this->tableBox($info_box_contents, true);
   }

function contentBoxContents3($contents) {
     $this->table_cellpadding = '0';
     $this->table_parameters = 'class="infoBoxsssContents"';

     return $this->tableBox($contents);
   }

 

... but this won?t add a new new Table in the Table that is created by the contentBoxContents2 Function. It just prolongs the contentBox2 class downwards with no content in it (see screenshot).

 

osc2.jpg

 

Without my modification the HTML Output on the catalog page looks like this:

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td height="20" class="mainboxtop"><img src="images/layout/mainbox/tcorn_le.gif" border="0" alt="" width="7" height="20"></td>
   <td height="20" class="mainboxtop" width="100%">Neue Produkte im August</td>
   <td height="20" class="mainboxtop"><img src="images/layout/mainbox/tcorn_re.gif" border="0" alt="" width="7" height="20"></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxsssContents">
 <tr>
   <td width="7" class="mainboxmid_le"><img src="images/layout/mainbox/mid_le.gif" border="0" alt="" width="7" height="267"></td>
   <td class="mainboxmid" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxsssContents">
 <tr>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=18"><img src="images/dvd/speed_2.gif" border="0" alt="Speed 2: Cruise Control" title=" Speed 2: Cruise Control " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=18">Speed 2: Cruise Control</a><br>42.00EUR</td>
 </tr>
 <tr>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=6"><img src="images/dvd/the_matrix.gif" border="0" alt="Matrix" title=" Matrix " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=6">Matrix</a><br>30.00EUR</td>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=22"><img src="images/gt_interactive/unreal_tournament.gif" border="0" alt="Unreal Tournament" title=" Unreal Tournament " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=22">Unreal Tournament</a><br>89.99EUR</td>
 </tr>
 <tr>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=10"><img src="images/dvd/under_siege2.gif" border="0" alt="Alarmstufe: Rot 2" title=" Alarmstufe: Rot 2 " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=10">Alarmstufe: Rot 2</a><br>29.99EUR</td>
   <td align="center" class="smallText" width="50%" valign="top"><a href="http://www.domain.tld/shop/product_info.php?products_id=25"><img src="images/microsoft/intkeyboardps2.gif" border="0" alt="Microsoft Internet Tastatur PS/2" title=" Microsoft Internet Tastatur PS/2 " width="100" height="80"></a><br><a href="http://www.domain.tld/shop/product_info.php?products_id=25">Microsoft Internet Tastatur PS/2</a><br>69.99EUR</td>
 </tr>
</table>
</td>
   <td width="7" class="mainboxmid_re"><img src="images/layout/mainbox/mid_re.gif" border="0" alt="" width="7" height="267"></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td width="7" height="7" class="mainboxbot"><img src="images/layout/mainbox/bot_le.gif" border="0" alt="" width="7" height="7"></td>
   <td width="100%" height="7" class="mainboxbot"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
   <td width="7" height="7" align="right" class="mainboxbot"><img src="images/layout/mainbox/bot_re.gif" border="0" alt="" width="7" height="7"></td>
 </tr>
</table>

 

But I want it to look like this

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td height="20" class="mainboxtop"><img src="images/layout/mainbox/tcorn_le.gif" border="0" alt="" width="7" height="20"></td>
   <td height="20" class="mainboxtop" width="100%">Neue Produkte im August</td>
   <td height="20" class="mainboxtop"><img src="images/layout/mainbox/tcorn_re.gif" border="0" alt="" width="7" height="20"></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxsssContents">
 <tr>
   <td width="7" class="mainboxmid_le"><img src="images/layout/mainbox/mid_le.gif" border="0" alt="" width="7" height="267"></td>
   <td class="mainboxmid" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td align="center" class="smallText" width="50%" valign="top">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   <a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td>
   <td class="divider_V"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
   <td align="center" class="smallText" width="50%" valign="top">
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   </td>
 </tr>
 <tr>
   <td class="divider_h" colspan="3" width="100%"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
 </tr>
 <tr>
   <td align="center" class="smallText" width="50%" valign="top">
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   </td>
   <td class="divider_V"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
   <td align="center" class="smallText" width="50%" valign="top">
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   </td>
 </tr>
 <tr>
   <td class="divider_h" colspan="3" width="100%"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
 </tr>
 <tr>
   <td align="center" class="smallText" width="50%" valign="top">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   </td>
   <td class="divider_V"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
   <td align="center" class="smallText" width="50%" valign="top">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2"><img src="images/matrox/mg400-32mb.gif" border="0" alt="Matrox G400 32 MB" title=" Matrox G400 32 MB " width="100" height="80"></a></td>
       <td><a href="http://www.domain.tld/shop/product_info.php?products_id=2">Matrox G400 32 MB</a><br>499.99EUR</td></td>
      </tr>
      <tr>
       <td colspan="2">Products Description...</td>
      </tr>
    </table>
   </td>
 </tr>
</table>
</td>
   <td width="7" class="mainboxmid_re"><img src="images/layout/mainbox/mid_re.gif" border="0" alt="" width="7" height="267"></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td width="7" height="7" class="mainboxbot"><img src="images/layout/mainbox/bot_le.gif" border="0" alt="" width="7" height="7"></td>
   <td width="100%" height="7" class="mainboxbot"><img src="images/layout/spacer.gif" border="0" alt="" width="1" height="1"></td>
   <td width="7" height="7" align="right" class="mainboxbot"><img src="images/layout/mainbox/bot_re.gif" border="0" alt="" width="7" height="7"></td>
 </tr>
</table>

 

What do have to do to accomplish it in the way that i want it? Any Ideas or Links to other threads dealing with this problem? I?ve searched the forum for hours but could not find anything but infobox problems :'(

 

Thanks in advance

 

max

  • 2 weeks later...

Archived

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

×
×
  • Create New...