Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

remove text from box header


1cookie

Recommended Posts

Posted

hi

It's another box header query. I know, there are lots of examples on this site and on the web but i couldn't find a specific one that suits my query, so here i am. :rolleyes:

 

OK, i'm following an example in the documentation.pdf that is included with oscom. I'm trying to replace a box header with a graphic (a shopping cart) to be specific. Please see code snippets below to give you a clearer picture. I successfully create a new 'infoBoxHeadingShopCart' class, and the cart image is visible on the site but there is one small niggle. I can't get rid of the text in the header. The text lies over my image! If i try changing the text in english.php file to:

 

define('BOX_HEADING_SHOPPING_CART', '');

then the header vanishes completely. Ive combatted this by defining a '.' as the text definition but i get an ugly dot on the screen! Am i missing something really simple here? Can someone assist with this?

 

:rolleyes:

 

NB I'm not interested in the easy solution of

define('BOX_HEADING_SHOPPING_CART', '<img src="someimage.gif" />');

as this has it's own limitations.

 

 

my adjustments:

 

//english.php
// shopping_cart box text in includes/boxes/shopping_cart.php
define('BOX_HEADING_SHOPPING_CART', '.');
define('BOX_SHOPPING_CART_EMPTY', '0 items');

 

 

 

//boxes.php
class infoBoxHeadingShopCart extends tableBox {  
   function infoBoxHeadingShopCart($contents) {  
     $this->table_cellpadding = '0';  

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

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

 

 

//stylesheet
TD.infoBoxHeadingShopCart {  
 background: #fffff;  
 background-image: url('images/cart.jpg');  
 background-repeat: no-repeat;  
}  

 

 

//shopping_cart.php
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 new infoBoxHeadingShopCart($info_box_contents, true, true, tep_href_link(FILENAME_SHOPPING_CART));

Posted

hold up, if i put

<img src="images/pic.jpg" />

in the code below it works! :rolleyes:

 

//english.php
// shopping_cart box text in includes/boxes/shopping_cart.php
define('BOX_HEADING_SHOPPING_CART', '.');
define('BOX_SHOPPING_CART_EMPTY', '0 items');

 

So, it turns out you need to refer to the pic in the stylesheet AND in the english.php code!!

 

I hope this helps someone as i spent a few hours playing with it! :rolleyes:

Archived

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

×
×
  • Create New...