Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I'm not understanding infox boxes.


Guest

Recommended Posts

I'm trying to understand infoboxes, infact I'd like to maybe add new custom ones. I was reading through the contributions and what not and saw a great right up on how to add, edit, etc.

 

Now, my real confusion lies here:

 

<!-- my new box //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_MY_NEW_BOX);

 

new infoBoxHeading($info_box_contents, false, false);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_PAGE1) . '">' . BOX_MY_NEW_BOX_PAGE1 . '</a><br>' .

'<a href="' . tep_href_lin (FILENAME_PAGE2) . '">' . BOX_MY_NEW_BOX_PAGE2 . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PAGE3) . '">' . BOX_MY_NEW_BOX_PAGE3 . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PAGE4) . '">' . BOX_MY_NEW_BOX_PAGE4 . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PAGE5) . '">' . BOX_MY_NEW_BOX_PAGE5 . '</a>');

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- information_eof //-->

 

I don't understand what the text with the _ _ _ in between it is, or, where it's pulling it's information? My impression is that there's a .php page with information in it, and the info box pulls that info and displays it on a different page? But I'm still confused as to all the other changes necessary.

Link to comment
Share on other sites

I don't understand what the text with the _ _ _ in between it is

its a definition for the heading description for the infobox. It is defined in the equivalent language file. like english.php in the languages\english dir.

 

basically you setup a string of html and you pass that to the infoBox constructor. This in turn instantiates the base class of the box. Then depending where you place

your new infoBox($info_box_contents); determines its position. Could be left,right column, top, bottom, or in the page content.

Link to comment
Share on other sites

I guess that makes sense to me...sorta. But, Does this mean to create a new infobox I need to not only add the code to where I want it to be ( say the right_column.php ) but create an entirely new .php file for the information to be called for and displayed?

Link to comment
Share on other sites

if you create a brand new box say for example "Services" then yes you need a new box file in the include\boxes dir. where you setup your infobox contents accordingly. Then you change your column_left or column_right to add your box.

 

If you need to provide different layout for different boxes then you will change the classes/boxes directory creating a new class or derive one from the base so you change the graphics, fonts etc.

Link to comment
Share on other sites

So essentially could I just copy/paste an already created .php box, change the text/code within and add it within the right column?

Link to comment
Share on other sites

Also, what if I just want to change the heading of an info box, for instance it says: "information" right now, I'd like it to say "Customer Service" - what must be changed? The entire .php file name or just code, if so where?

 

I do appreciate your help.

Link to comment
Share on other sites

yea of course is the fastest way to leverage existing code. just make sure you use new filenames and there is the filenames.php to add the new files with a header definition

Link to comment
Share on other sites

Understood, here is the information.php file that I'd like to have the heading CUSTOMER SERVICE.

 

<?php

/*

$Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- information //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 

new infoBoxHeading($info_box_contents, false, false);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- information_eof //-->

 

Do I need to change the name of the FILE? Or code within?

 

Can I change "BOX_HEADING_INFORMATION" to "BOX_HEADING_CUSTOMER SERVICE" ? Or is that not right?

Link to comment
Share on other sites

well the information box theoretically has the about company disclaimer such info in general. Customer service better create a new box. You could copy that file you have there use a new heading like BOX_HEADING_CUSTOMER_SERVICE then add the definition for the languages you use.

 

Finally put the new pages you need for this service. Just modify the links and definitions to reflect the new pages on this section of the new file

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

You could have customer support, returns, refunds and so on instead for the privacy, condition, contact_us etc.

 

There is also a contribution called "extra pages" a more elegant way to create custom pages but I believe you would need to modify it to create new boxes. Worth checking it out though.

Link to comment
Share on other sites

All header definitions have their associated text in the language files. Look in includes/languages/english/ files for instance. This makes it possible for multilingual support

Link to comment
Share on other sites

When I edit the code to say this:

 

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CUSTOMER_SERVICE);

 

It then shows up on my info box has BOX_HEADING_CUSTOMER_SERVICE instead of just Customer Service, why is this?

Link to comment
Share on other sites

yes you should have the text associated with your definition in the catalog\includes\languages\english.php file you should have:

define(BOX_HEADING_CUSTOMER_SERVICE', 'Customer Service');

Link to comment
Share on other sites

Well I succesfully changed the titles of my info boxes, and went on to add my own.

 

I created a new info box file called payments.php, this is the code I tried to use:

 

<?php

/*

$Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- information //-->

<tr>

<td ALIGN="CENTER">

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_PAYMENTS_ACCEPTED);

 

new infoBoxHeading($info_box_contents, false, false);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' <IMG SRC="http://blacksheepperformance.net/images/paypal.gif" border="0"><BR>

<IMG SRC="http://blacksheepperformance.net/images/satis.gif" border="0">

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- information_eof //-->

 

It has given me errors on line 16, 22 and 25. I tried to correct but don't understand what is wrong with the coding. ( I used the information.php is a base of the code )

 

And I did define it within the english.php.

Link to comment
Share on other sites

try this:

 

<?php
/*
$Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $

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

Copyright ? 2003 osCommerce

Released under the GNU General Public License
*/
?>
<!-- information //-->
<tr>
<td ALIGN="CENTER">
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_PAYMENTS_ACCEPTED);

new infoBoxHeading($info_box_contents, false, false);

$info_box_contents = array();
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '"><IMG SRC="http://blacksheepperformance.net/images/paypal.gif" border="0"><BR>
<IMG SRC="http://blacksheepperformance.net/images/satis.gif" border="0">');
new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- information_eof //-->

Link to comment
Share on other sites

Everythings great except that I still have BOX_HEADING as the title, yet I defined it in the english.php, like this:

 

 

// paypal text in left column info box

define('HEADER_TITLE_PAYMENT_TYPE', 'Payment Methods');

 

Is that sufficient?

Link to comment
Share on other sites

make sure they match exactly the definitions are case sensitive just like passwords and I see from the box code BOX_HEADING_PAYMENTS_ACCEPTED

 

so I would expect

define('BOX_HEADING_PAYMENTS_ACCEPTED', 'Payment Methods');

 

in your language file

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...