Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Converting Header from OSC to Zen

Converting Header from OSC to Zen

Locked

Views: 1,395

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
13 Nov 2008, 6:14 PM
#1
msmith1111 avatar

msmith1111

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Converting Header from OSC to Zen

Hi everyone!

I've got kind of a tricky situation here and I'm at the point where I need some help.

Server and Zen Specs:
Zen 1.3.8a full fileset
Hostgator Linux Server (CentOS I think, not sure though)
PHP 5 and Mysql 5
Template overrides system in effect, no original files are being changed

Now here's my situation. I'm supposed to convert a custom designed OSCommerce Template as seen here: http://www.hhhenterprises.com
I've got almost everything figured out but the header is killing me. You'll notice they have a quick buy option, custom nav, search, newsletter, and of course it's all laid out in tables.

So I need to get that complete header in working order ported over to the test server at http://www.ithinkcreative.us/hhhtest
and it's not working out well. I've tried to add the tables directly into tpl_header.php (overrides of course) within the divs and I've also tried removing the divs as well. I've also tried just using the original header.php from the OSC and changing the values in tpl_main_page.php to point to it.
The OSC header code has php calls going to file defines that don't exist in the zencart filenames.php, so I'll be creating the files in includes/extra_datafiles. That should take care of the things like quick buy and newsletter. We're all good there.
So here's my questions:

  1. I can't get tpl_header.php (or header.php) to display any of the tables properly. I understand that there would be some php parsing issues with files that don't exist, but as they are includes php should skip them anyway. the graphics at least should appear where they're suppose to go. What am I doing wrong here?
    2.How much of the php from the OSC Header will need to change...i.e. things like "if (basename($PHP_SELF) != 'scrapbook.php'" Is this valid code for Zen?
  2. just out of curiosity, why do none of the defined files in zen's filenames.php have an extension to them? i.e. define('FILENAME_SITE_MAP', 'site_map');
    What would happen if one did add extensions to them?

If you look at http://www.ithinkcreative.us/hhhtest you'll see what the site looks like right now, below is the code that is being used to get the lovely site you see there. Obviously, reverting to the original tpl_header.php gives me the full site which is pretty much complete at this point.

tpl_header.php (no php here except for message stack)

<?php /** * Common Template - tpl_header.php * * this file can be copied to /templates/your_template_dir/pagename<br /> * example: to override the privacy page<br /> * make a directory /templates/my_template/privacy<br /> * copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_header.php<br /> * to override the global settings and turn off the footer un-comment the following line:<br /> * <br /> * $flag_disable_header = true;<br /> * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_header.php 4813 2006-10-23 02:13:53Z drbyte $ */ ?> <?php // Display all header alerts via messageStack: if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) { echo htmlspecialchars(urldecode($_GET['error_message'])); } if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) { echo htmlspecialchars($_GET['info_message']); } else { } ?> <!--bof-header logo and navigation display--> <?php if (!isset($flag_disable_header) || !$flag_disable_header) { ?> <!--bof-navigation display--> <table width="820" border="0" cellspacing="0" cellpadding="0" align="center"> <tr>
<td> 

  <table width="820" border="0" cellspacing="0" cellpadding="0">

    <tr> 

      <td width="396"><img src="../images/topmenu_left.gif" height="21" ALT=""></td>

      <td width="424"> 

        <table width="424" border="0" cellspacing="0" cellpadding="0">

          <tr> 

            <td width="52"><img src="../images/topmenu_mycart.gif" width="52" height="21" ALT="My Shopping Cart"></td>

            <td background="images/topmenu_cartcontents.gif" width="85" style="font-family: Verdana, Arial, sans-serif; font-size: 10pt;" align="center" valign="top"></td>

            <td width="62"><a href=""><img src="../images/topmenu_viewcart.gif" width="62" height="21" border="0" ALT="View Shopping Cart"></a></td>

            <td width="62"><a href=""><img src="../images/topmenu_checkout.gif" width="62" height="21" border="0" ALT="Check Out"></a></td>

            <td width="49"><a href=""><img src="../images/topmenu_login.gif" width="49" height="21" border="0" ALT="Login to My Account"></a></td>

            <td><a href=""><img src="../images/topmenu_myaccount.gif" width="92" height="21" border="0" ALT="My Customer Account"></a></td>

          </tr>

        </table>

      </td>

    </tr>

  </table>

</td>
</tr> <tr>
<td><img src="../images/main_banner.gif" ALT="Beading and Jewelry Making Supplies at HHH Enterprises"></td>
</tr> <tr>
<td><a href=""><img src="../images/mainmenu_home.gif" height="20" border="0" ALT="Home"></a><a href=""><img src="../images/mainmenu_aboutus.gif" height="20" border="0" ALT="About Us"></a><a href=""><img src="../images/mainmenu_contactus.gif" height="20" border="0" ALT="Contact Us"></a><a href=""><img src="../images/mainmenu_design.gif" height="20" border="0" ALT="Design Gallery"></a><a href=""><img src="../images/mainmenu_angel.gif" height="20" border="0" ALT="Beading Articles"></a><a href="blog_index.php"><img src="../images/mainmenu_blog.gif" height="20" border="0" ALT="Our Beading Blog"></a><a href=""><img src="../images/mainmenu_shopping.gif" height="20" border="0"></a><a href=""><img src="../images/mainmenu_whatsnew.gif" height="20" border="0"></a><a href=""><img src="../images/mainmenu_clearance.gif" height="20" border="0" ALT="Clearance Sale"></a><img src="../images/mainmenu_right.gif" height="20" ALT=""></td>
</tr> <tr>
<td background="images/thirdmenu_bg.gif">

  <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr> 




      <td><img src="../images/thirdmenu_left.gif" ALT=""></td>

      <td><img src="../images/thirdmenu_search.gif" ALT="Search Our Site"></td>

      <td background="images/thirdmenu_search_bg.gif" width="126" align="center" valign="top" style="padding-top: 10px;"> 

        <input type="text" name="keywords" size="15" VALUE="keyword or item #" onFocus="document.quick_find.keywords.value=''">

      </td>

      <td><input type="image" src="../images/thirdmenu_search_button.gif" border="0" ALT="Search"></td>
</form>
      <td><img src="../images/thirdmenu_quick.gif" ALT="Catalog Order Form"></td>

      <td background="images/thirdmenu_quick_bg.gif" width="109" align="center" valign="top" style="padding-top: 10px;"> 

       <INPUT TYPE="text" NAME="directbuy_qty[1]" VALUE="1" size="2">

      </td>

      <td><input type="image" src="../images/thirdmenu_quick_button.gif" border="0" ALT="Buy"></td>
</form> <td><!-- BEGIN LivePerson Button Code -->

<a href="newsletter.html" target="_blank"><img src="../images/news_signup.gif" name="hcIcon" width=160 height=73 border=0></a></a><!-- END LivePerson Button code --></td>

      <td><a href=""><img src="../images/thirdmenu_getcatalog.gif" border="0" ALT="Get a Catalog"></a></td>

    </tr>

  </table>

</td>
</tr> <tr>
<td>

  <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">

    <tr>




      <td width="175" valign="top"><table border="0" cellspacing="0" cellpadding="0"></table></td>

I hope all of this makes sense to someone, and I really appreciate any help offered.

Michael Smith

13 Nov 2008, 6:57 PM
#2
msmith1111 avatar

msmith1111

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Re: Converting Header from OSC to Zen

Sorry, I guess I should have posted the original OSC header.php.

here it is:

<?php /* $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions <http://www.oscommerce.com> Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // check if the 'install' directory exists, and warn of its existence if (WARN_INSTALL_EXISTENCE == 'true') { if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) { $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning'); } } // check if the configure.php file is writeable if (WARN_CONFIG_WRITEABLE == 'true') { if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) { $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning'); } } // check if the session folder is writeable if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') { if (STORE_SESSIONS == '') { if (!is_dir(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning'); } elseif (!is_writeable(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning'); } } } // check session.auto_start is disabled if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) { if (ini_get('session.auto_start') == '1') { $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning'); } } if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) { if (!is_dir(DIR_FS_DOWNLOAD)) { $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning'); } } if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } ?> <?php if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
</tr> </table> <?php } if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="headerInfo">
<td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
</tr> </table> <?php } ?> <table width="820" border="0" cellspacing="0" cellpadding="0" align="center"> <tr>
<td> 

  <table width="820" border="0" cellspacing="0" cellpadding="0">

    <tr> 

      <td width="396"><img src="../images/topmenu_left.gif" height="21" ALT=""></td>

      <td width="424"> 

        <table width="424" border="0" cellspacing="0" cellpadding="0">

          <tr> 

            <td width="52"><img src="../images/topmenu_mycart.gif" width="52" height="21" ALT="My Shopping Cart"></td>

            <td background="images/topmenu_cartcontents.gif" width="85" style="font-family: Verdana, Arial, sans-serif; font-size: 10pt;" align="center" valign="top"><?php echo $currencies->format($cart->show_total()); ?></td>

            <td width="62"><a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><img src="../images/topmenu_viewcart.gif" width="62" height="21" border="0" ALT="View Shopping Cart"></a></td>

            <td width="62"><a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><img src="../images/topmenu_checkout.gif" width="62" height="21" border="0" ALT="Check Out"></a></td>

            <td width="49"><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><img src="../images/topmenu_login.gif" width="49" height="21" border="0" ALT="Login to My Account"></a></td>

            <td><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL'); ?>"><img src="../images/topmenu_myaccount.gif" width="92" height="21" border="0" ALT="My Customer Account"></a></td>

          </tr>

        </table>

      </td>

    </tr>

  </table>

</td>
</tr> <tr>
<td><img src="../images/main_banner.gif" ALT="Beading and Jewelry Making Supplies at HHH Enterprises"></td>
</tr> <tr>
<td><a href="<?php echo tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'); ?>"><img src="../images/mainmenu_home.gif" height="20" border="0" ALT="Home"></a><a href="<?php echo tep_href_link(FILENAME_ABOUT, '', 'NONSSL'); ?>"><img src="../images/mainmenu_aboutus.gif" height="20" border="0" ALT="About Us"></a><a href="<?php echo tep_href_link(FILENAME_CONTACT_US, '', 'NONSSL'); ?>"><img src="../images/mainmenu_contactus.gif" height="20" border="0" ALT="Contact Us"></a><a href="<?php echo tep_href_link(FILENAME_DESIGN_GALLERY, '', 'NONSSL'); ?>"><img src="../images/mainmenu_design.gif" height="20" border="0" ALT="Design Gallery"></a><a href="<?php echo tep_href_link(FILENAME_ARTICLES, '', 'NONSSL'); ?>"><img src="../images/mainmenu_angel.gif" height="20" border="0" ALT="Beading Articles"></a><a href="blog_index.php"><img src="../images/mainmenu_blog.gif" height="20" border="0" ALT="Our Beading Blog"></a><a href="<?php echo tep_href_link(FILENAME_SHIPPING, '', 'NONSSL'); ?>"><img src="../images/mainmenu_shopping.gif" height="20" border="0"></a><a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=20689', 'NONSSL'); ?>"><img src="../images/mainmenu_whatsnew.gif" height="20" border="0"></a><a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=20986', 'NONSSL'); ?>"><img src="../images/mainmenu_clearance.gif" height="20" border="0" ALT="Clearance Sale"></a><img src="../images/mainmenu_right.gif" height="20" ALT=""></td>
</tr> <tr>
<td background="images/thirdmenu_bg.gif">

  <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr> 
<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); ?>
      <td><img src="../images/thirdmenu_left.gif" ALT=""></td>

      <td><img src="../images/thirdmenu_search.gif" ALT="Search Our Site"></td>

      <td background="images/thirdmenu_search_bg.gif" width="126" align="center" valign="top" style="padding-top: 10px;"> 

        <input type="text" name="keywords" size="15" VALUE="keyword or item #" onFocus="document.quick_find.keywords.value=''">

      </td>

      <td><input type="image" src="../images/thirdmenu_search_button.gif" border="0" ALT="Search"></td>
</form> <? echo tep_draw_form('directbuy', tep_href_link(FILENAME_DIRECTBUY, 'action=directbuy'), 'post'); ?>
      <td><img src="../images/thirdmenu_quick.gif" ALT="Catalog Order Form"></td>

      <td background="images/thirdmenu_quick_bg.gif" width="109" align="center" valign="top" style="padding-top: 10px;"> 

        <?php echo tep_draw_input_field('directbuy_product[1]', 'Item #', 'style="width: 50px;"  onFocus="document.directbuy.directbuy_product[1].value=\'\'"'); ?><INPUT TYPE="text" NAME="directbuy_qty[1]" VALUE="1" size="2">

      </td>

      <td><input type="image" src="../images/thirdmenu_quick_button.gif" border="0" ALT="Buy"></td>
</form> <td><!-- BEGIN LivePerson Button Code -->

<a href="newsletter.html" target="_blank"><img src="../images/news_signup.gif" name="hcIcon" width=160 height=73 border=0></a></a><!-- END LivePerson Button code --></td>

      <td><a href="<?php echo tep_href_link('catalog_order_form.php', '', 'NONSSL'); ?>"><img src="../images/thirdmenu_getcatalog.gif" border="0" ALT="Get a Catalog"></a></td>

    </tr>

  </table>

</td>
</tr> <tr>
<td>

  <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">

    <tr>
<?php if (basename($PHP_SELF) != 'scrapbook.php' && basename($PHP_SELF) != 'free_gift.php' && basename($PHP_SELF) != 'fall_votives.php' && basename($PHP_SELF) != 'watch_faces_for_beading.php' && basename($PHP_SELF) != 'swarovski_crystal_birthstones.php' && basename($PHP_SELF) != 'sitemap.php' && basename($PHP_SELF) != FILENAME_BUILDABUCKLE && basename($PHP_SELF) != 'crystal_buttons.php' && basename($PHP_SELF) != 'july_popular_promotion.php' && basename($PHP_SELF) != FILENAME_CHECKOUT_SHIPPING && basename($PHP_SELF) != FILENAME_SEEDBEADS && basename($PHP_SELF) != FILENAME_LOGIN && basename($PHP_SELF) != FILENAME_CHECKOUT_PAYMENT && basename($PHP_SELF) != FILENAME_CHECKOUT_SUCCESS && basename($PHP_SELF) != FILENAME_CHECKOUT_CONFIRMATION) { ?>
      <td width="175" valign="top"><table border="0" cellspacing="0" cellpadding="0"><?php include('includes/column_left.php'); ?></table></td>
<?php } ?>
      <td width="645" valign="top">
<?php $r = tep_db_query("SELECT parent_id FROM categories WHERE categories_id = " . $current_category_id); $prt = mysql_fetch_array($r); if (basename($PHP_SELF) != 'login.php' && basename($PHP_SELF) != 'crystal_buttons.php' && basename($PHP_SELF) != 'create_account.php' && basename($PHP_SELF) != 'checkout_shipping.php' && basename($PHP_SELF) != 'checkout_payment.php' && basename($PHP_SELF) != 'checkout_confirmation.php') { if (!tep_banner_exists('dynamic', $current_category_id) && !tep_banner_exists('dynamic', $prt['parent_id'])){ if ($banner = tep_banner_exists('dynamic', 'sitewide')) { echo '<center>' . tep_display_banner('static', $banner) . '</center>'; } } } ?>
13 Nov 2008, 7:02 PM
#3
charmedbytina2 avatar

charmedbytina2

Totally Zenned

Join Date:
Mar 2007
Location:
AZ
Posts:
1,890
Plugin Contributions:
0

Re: Converting Header from OSC to Zen

Have you tried am image map to get this working for you?

Tina

13 Nov 2008, 9:21 PM
#4
msmith1111 avatar

msmith1111

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Re: Converting Header from OSC to Zen

I actually did consider that for at least portions of the header. But as far as I know I can't create input fields within image maps. maybe I'm wrong there?
It's been years since I've done an image map, and never have done but maybe 4 or 5 in my whole career.

Does it seem possible to do the entire thing in a map or just portions even?

Thanks!

Michael Smith

15 Nov 2008, 3:49 AM
#5
msmith1111 avatar

msmith1111

New Zenner

Join Date:
Apr 2006
Posts:
15
Plugin Contributions:
0

Re: Converting Header from OSC to Zen

I found a solution. This post is just an update for anyone attempting the same thing.
here's what I did:

I used the original zen tpl_header.php and just inserted all the tables from my OSC header.php within the headerwrapper div and before the navmainwrapper div.
I removed all php code in the OSC tables and made all links to images absolute instead of relative. It was the relative links that was causing the images in the tables not to show. I don't understand why, but I can only use absolute paths for the images. After that, everything came together beautifully.

Michael Smith