Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

losing session id


Guest

Recommended Posts

Hi there, I currently have my shop working fine but when I put a file in a sub directory and then click to it in the shop I lose the session id.

 

I recently tried to add a links directory but had the same problem?

 

How do I fix this

 

Many thanks,

Ally

Link to comment
Share on other sites

It depends what sort of file it is and what you mean by sub-directory. If you have your site in a folder (e.g. catalog) and your other pages are in the root of your web then 'yes' it can be a bit of a problem.

 

If they are new pages in sub-folders of your osCommerce site then it's easy to keep the session id, provided they're php pages, or, if your server is set up to allow it, html pages in which you can run php code.

 

Vger

Link to comment
Share on other sites

If they are new pages in sub-folders of your osCommerce site then it's easy to keep the session id, provided they're php pages, or, if your server is set up to allow it, html pages in which you can run php code.

 

Thanks vger, set up a test and remember my problem better now, it was a few weeks ago and at the time I just used the work around of everything in the root.

 

what happens is the paths are a bit screwed up so when the page trys to load I get:

 

Warning: main(includes/application_top.php): failed to open stream: No such file or directory in /usr/local/psa/home/vhosts/naturalfigure.co.uk/httpdocs/Links/oscTest.php on line 10

 

Warning: main(includes/application_top.php): failed to open stream: No such file or directory in /usr/local/psa/home/vhosts/naturalfigure.co.uk/httpdocs/Links/oscTest.php on line 10

 

Warning: main(includes/application_top.php): failed to open stream: No such file or directory in /usr/local/psa/home/vhosts/naturalfigure.co.uk/httpdocs/Links/oscTest.php on line 10

 

Fatal error: main(): Failed opening required 'includes/application_top.php' (include_path='.:/usr/local/psa/apache/lib/php') in /usr/local/psa/home/vhosts/naturalfigure.co.uk/httpdocs/Links/oscTest.php on line 10

 

 

Example at http://www.naturalfigure.co.uk click on the link oscRelative and you'll see what happens above.

 

Hopefully an easy one for someone! Thanks, ally

Link to comment
Share on other sites

Well, if I could find such a link I'd take a look at it.

 

Vger

 

Thanks and sorry veger, the link oscRelative is down the very bottom of the page on the last line beside site map and links.

 

Thanks,

Ally

Link to comment
Share on other sites

It is looking for subdirectory/includes/application_top.php which does not exist. You have to rework the code on your new pages that you want to put into the subdirectory to look for the files in the correct places.

 

I have tried to do this but gave up, but that does not mean too much because I am not very good at that kind of stuff. :blush:

 

Edit;

But then again my reasoning could be wrong also because I am not very good at that kind of stuff so take my opinion for what it is worth. :thumbsup:

Link to comment
Share on other sites

This is the normal coding to include application_top.php, from a file which is in the root folder (which your new Links pages aren't):

 

require('includes/application_top.php');

 

You can try this, but it may not work:

 

require('../includes/application_top.php');

 

or you can hardcode it:

 

require('http://www.yourdomain.com/includes/application_top.php');

 

Vger

Link to comment
Share on other sites

I'm pretty sure that won't work, since the includes within application_top.php itself are based off the path of the current script. I think you'd need to use the php chdir command.

 

The ../ did work, the problem then is the files referenced/required inside application_top.php dont have the right path.

 

I think it would all be fine if I included the includs directory in the links folder, and then every other folder I created but thats then a lot of updates each time I mod a file in the includes folder.

 

Anyone got any ideas of a more elegant solution?

 

Thanks

Link to comment
Share on other sites

  • 2 months later...

Ahhh, I finally found this thread. I only wish there was an answer. Does anyone know of a way to make sub directories work for osCommerce pages? I have tried to link to the application_top with the ../, but again, the files referenced inside application_top.php are not found.

 

BTW, for anyone interested in at least maintaining the session ID on PHP pages outside the osCommerce engine, take a look at this contrib, works perfectly and easily:

 

http://www.oscommerce.com/community/contri...ternal+sessions

 

in my situation, I used an external product page because osCommerce's is just not robust enough. We wanted multiple pages, images, the works. Also, the client wanted the directory to be /products/productname

 

with the above contrib, I was able to maintain the session, as well as make a nifty little "logoff" link that only appears if the user has an assigned customer ID through the sessions. therefore, it never looks like the user has left the engine itself.

 

now though, since the product pages have been linked to from hundreds of blogs, and therefore is outside the actual cart engine, we cannot see which site sent the person to us. only the actual product page appears as the referrer.

 

any suggestions?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...