Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

running OSC 2.3.1 header from a subdirectory


Ezboy

Recommended Posts

Hello everyone. I've got a pretty standard installation of 2.3.1 and I have been trying for days to resolve this issue. What I need is to have lots of html pages inside the catalog directory. These pages need to have the same header as the standard osc pages so I have figured that the files: application_top.php and template_top.php need to be called at the top of each page. So far so good!

 

The problem: My HTML pages work fine with the OSC header at the top when ran from the root of the catalog directory. However, I have too many of these pages and I'd like to basically group them and place each group of pages in a separate subfolder. Such as, catalog/cars/, catalog/bikes/, catalog/planes/ and so on.

 

I do use the php command chdir('../'); at the top of the code before application_top.php when I place a page inside a subfolder but this alone does not seem to do it. The java scripts for the buttons at the top right don't seem to run and the store logo does not show because the code tries to locate the file in the \images folder of the subfolder it ran from, i.e catalog/cars/images/store_logo.png

 

Any help is appreciated greatly.

Link to comment
Share on other sites

Pretty hard to solve problems like this without a URL so the page source can be examined and the exact problem determined.

 

If you don't want to post the URL you can PM it to me and I'll take a look.

 

That doesn't mean I'll have an answer to the problem - only that I'll try my best.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

For images use absolute path dont go for relative path.

 

 

 

 

Satish

 

 

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Thanks for the replies guys. Just to conclude on this, and as touched upon by Satish, I had to create new versions of template_top.php and header.php located in catalog/includes/ folder. I basically copied these files and named the new ones template_top_subd.php and header_subd.php . I then made changes to the new ones as below.

 

In template_top_subd.php which contains all java script calls for the top-right shortcut buttons:

I added ../ to the beginning of all paths. So lines 29,30,31 look like this now:

 

<link rel="stylesheet" type="text/css" href="../ext/jquery/ui/redmond/jquery-ui-1.8.6.css" />
<script type="text/javascript" src="../ext/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../ext/jquery/ui/jquery-ui-1.8.6.min.js"></script>

 

The same changes were also applied to lines 36,44,45,46,47 and 48.

 

template_top_bubd.php finally calls the file 'header.php' on line 55. I modified the file name to header_subd.php so it now looks like this:

 

<?php require(DIR_WS_INCLUDES . 'header_subd.php'); ?>

 

header_subd.php contains the code responsible for displaying the store logo (top-left of all pages), on line 19.

I added the ../ at the beginig of the path where store_logo.png is called on this line, so it now looks like this:

 

<div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image('../' . DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?></div>

 

With the above modifications in the newly created files, I managed to run the OSC header on the top of my HTML pages from a sub-folder.

 

Needless to say that all my HTML files start with the following two lines:

 

<?php
chdir('../');
require('includes/application_top.php'); ?>

 

This is a pretty manual modification as a quick fix but it works. The negative point is that there are now two sets of template_top.php and header.php files, so if modifications are needed, both sets will have to be edited separately.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...