Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Question about classes/boxes.php


TerryK

Recommended Posts

Posted

I'm trying to change the CSS class on the search box in advanced_search.php. Through catalog/classes/boxes.php, it's somehow calling the 'InfoBox" class, and I need it to change to my "infoBox2" class that I've set up, but I can't figure out how or where to change this. (I *do* use the regular infoBox class on other boxes, so I don't want to modify the wrong setting.)

 

In advanced_search.php, the table appears to be called through this code:

 

        <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => HEADING_SEARCH_CRITERIA);

 new infoBoxHeading($info_box_contents, true, true);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => tep_draw_input_field('keywords', '', 'style="width: 75%"'));
 $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_checkbox_field('search_in_description', '1', true) . ' ' . TEXT_SEARCH_IN_DESCRIPTION);

 new infoBox($info_box_contents);
?>
       </td>

 

I see numerous references to $info_box_contents in the catalog/classes/boxes.php file -- so how do I know which one it is that I need? Or can I create a new one with a new definition to capture the CSS style I need?

 

TIA for any help!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Posted

u can inherit the original infoBox class and make your own infoBox with different behaviour/look and than use it in the advanced search box instead of the original one.

Posted

Fishy, when I entered the file location, I mistyped it. I am referring to /catalog/includes/classes/boxes.php.

 

To clarify:

 

My left column contains a 'Search' infoBox. I have set it up to also search product descriptions. It also includes a link to "Advanced Search," which links to /catalog/advanced_search.php.

 

At the top of that file (advanced_search.php), there is a search field where a customer can enter advanced search criteria. That field is contained within an array (per my original message) that appears to construct a table through a call to /catalog/includes/classes/boxes.php.

 

Somehow, I need to be able to either:

 

1. Change the array in advanced_search.php so I can specify the CSS class I want to use, or

 

2. Create a new bit of code in /classes/boxes.php so I can specify the CSS class and table attributes I want to use, or

 

3. Amend the existing code in /classes/boxes.php to specify the CSS class and table attributes I want to use.

 

In the latter case, however, if the array is used to construct more than one table, then I don't want to change it, as it will likely affect other elements of my site design that DO rely on the existing CSS class call, in which case I need some help with either 1) or 2).

 

Anyone? Pretty please?

 

Many thanks,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Posted

TK -

 

i would certainly go with rafeal's solution, your #2. in this manner, only the new box will use the new code and then you won't have to worry about code changes effecting any other calls/boxes/etc and where they all need to be changed.

 

best.

Posted

So how do I create a new one in classes/boxes.php?

 

I have no idea how to do that because I don't know WHICH of the various $info_box_contents definitions in boxes.php is being called from advanced_search.php. They all look the same to me.

 

TIA,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Posted

advanced_search.php calls:

new infoBoxHeading($info_box_contents, true, true); & new infoBox ($info_box_contents);

 

  new infoBox($info_box_contents);  
  
 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"';
     $this->tableBox($info_box_contents, true);
   }

   function infoBoxContents($contents) {
     $this->table_cellpadding = '3';
     $this->table_parameters = 'class="infoBoxContents"';
     $info_box_contents = array();
     $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
     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', '100%', '1')));
     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');
     }

     $info_box_contents = array();
     $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"'),
                                  array('params' => 'width="100%" height="14" class="infoBoxHeading"',
                                        'text' => $contents[0]['text']),
                                  array('params' => 'height="14" class="infoBoxHeading" nowrap'));

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

 

copy these classes and:

1. rename the classes name and the functions name( ie: infoBoxSearchHeading & infoBoxSearch).

 

2. Change the code on advanced_search.php to match the names you changed the classes to.

 

3. Change the css class name to the one you want.

( ie: $this->table_parameters = 'class="infoBoxSearchContents" )

 

I haven't gone thru the exercise, so there may be other steps needed to rweek the code. but overall this is what i immediately see. i hope this helps.

 

good luck.

Posted

Thanks, Fishy -- I'll give that a shot!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Posted

Got it! Thanks so much for your help! :)

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Archived

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

×
×
  • Create New...