Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new infobox


wondernet

Recommended Posts

I have a OSC running with STS. I have successfully created a new infobox and placed it in the template. I know need a little help with the code so I can have different optinos shown whether the user is logged in or not.

 

Here's the code for the infobox as it is now;

 

<!-- my_account //-->
         <tr>
           <td><table width="100%" border="0" cellspacing="0" cellpadding="4">
                           <tr>
                             <td class="pageTitleRed">My Account</td>
                           </tr>
                         </table>
<?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' => '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT) . '">' . BOX_MY_ACCOUNT . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT) . '">' . BOX_ACCOUNT_EDIT . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY) . '">' . BOX_ACCOUNT_HISTORY . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_LOGIN) . '">' . HEADER_TITLE_LOGIN . '</a><br>' .
          '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT) . '">' . HEADER_TITLE_CREATE_ACCOUNT . '</a><br>'); 

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- my_account_eof //-->

 

Fairly simple, yes?? Excellent. I would like to show 'logout' instead of 'login' when the user is logged in. I tried manipulating the code from the original header.php but could not get it to work.

 

Can someone help out with this please?

Link to comment
Share on other sites

Give this a go: (I've taken it from the login box contributions that I've used)

 

<?php

if (!tep_session_is_registered('customer_id')) {

// CODING FOR IF CUSTOMER IS NOT LOGGED IN

 } else {
// CODING FOR IF CUSTOMER IS LOGGED IN

 }
?>

Link to comment
Share on other sites

Excellent. This might not be good or clean code but it works ...

 

<!-- my_account //-->
         <tr>
           <td><table width="100%" border="0" cellspacing="0" cellpadding="4">
                           <tr>
                             <td class="pageTitleRed">My Account</td>
                           </tr>
                         </table>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

//  new infoBoxHeading($info_box_contents, false, false);

if (tep_session_is_registered(customer_id))
{

// if logged in

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_TITLE_CART_CONTENTS . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING) . '">' . HEADER_TITLE_CHECKOUT . '</a><br>' .
          '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT) . '">' . BOX_MY_ACCOUNT . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY) . '">' . BOX_ACCOUNT_HISTORY . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_LOGOFF) . '">' . HEADER_TITLE_LOGOFF . '</a><br>'); 

} else {

// if not logged in

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT) . '">' . BOX_MY_ACCOUNT . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT) . '">' . BOX_ACCOUNT_EDIT . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY) . '">' . BOX_ACCOUNT_HISTORY . '</a><br>' .
                                        '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_LOGIN) . '">' . HEADER_TITLE_LOGIN . '</a><br>' .
          '<img src="images/arrow_left.gif" width="8" height="9" hspace="2" vspace="2" border="0" align="middle"><a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT) . '">' . HEADER_TITLE_CREATE_ACCOUNT . '</a><br>'); 
}

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- my_account_eof //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...