osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

How Can I Retain Session Id Outside Of osCommerce Catalog Directory?

This is a discussion on How Can I Retain Session Id Outside Of osCommerce Catalog Directory? within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi, Using osCommerce, I am aware that tep_href_link makes sure the Session ID gets attached to the URL being called. ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 05-27-2007, 09:55 AM
Lurker
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
dublinguy is on a distinguished road
Default How Can I Retain Session Id Outside Of osCommerce Catalog Directory?

Hi,
Using osCommerce, I am aware that tep_href_link makes sure the Session ID gets attached to the URL being called. However, it uses HTTP_SERVER . DIR_WS_HTTP_CATALOG (for NONSSL, anyway), meaning "catalog" must be part of the URL path.

I want my customer to be able to back out to higher level pages, above the "catalog" directory -- and then return to their shopping when they are ready.

I tried writing my own version of tep_href_link. I called it agp_tep_href_link and changed its signature to accept a boolean that tells whether it is at the "top" level, above "catalog". If, in "catalog/includes/header.php", I use this new function to go to a top-level page, it works fine: the page appears as expected, and the URL still contains the Session ID. HOWEVER, if I use this new function in my top-level page, I cannot figure out how to call the new method.

Here is the modified agp_tep_href_link...
// The HTML href link wrapper function written by AG Productions.// This version of the method allows the user to navigate to the top-level pages (above ../catalog) and still retain the session id.
Code:
function agp_tep_href_link($topLevel = false, $page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) { global $request_type, $session_started, $SID; if (!tep_not_null($page)) { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>'); } if ($connection == 'NONSSL') { if ($topLevel) { $link = HTTP_SERVER . '/'; } else { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } } elseif ($connection == 'SSL') { if (ENABLE_SSL == true) { if ($topLevel) { $link = HTTPS_SERVER . '/'; } else { $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG; } } else { if ($topLevel) { $link = HTTP_SERVER . '/'; } else { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } } } else { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>'); } ... rest of function exactly as in tep_href_link...
Here is use of it inside catalog/includes/header.php that works fine. Clicking the Home image button takes me to my top-level page, and the Session ID remains in the URL...
Code:
<tr><td><a href="<?=agp_tep_href_link(true, 'index.php')?>" title="Home"><?=Tep_Image_Button('Home.gif')?></a><a href="<?=agp_tep_href_link(false, 'account.php')?>" title="My Account"><?=Tep_Image_Button('MyAccount.gif')?></a></td></tr>
Here is just one of the many failed variations of php code I tried in my top-level menu. This only works if I'm on the Home page, and my other menu options do not appear at all..
Code:
<!-- Home -->
<?php if ($thisPage == "Home") {
echo '<li class="menuItemSelected"><a title="Home">Home</a></li>';
} else {
echo '<li><a href="' . agp_tep_href_link(true, 'index.php') . '" title="Home">Home</a></li>';
} ?>
I will greatly appreciate any help. I'm sure the concept is sound. I think my problem lies with my inexperience in php. Ideally, someone already has an elegant solution for this: carrying the Session ID outside of the catalog.
Cheers,
Guy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-27-2007, 11:00 AM
jpf's Avatar
jpf jpf is offline
Moderator

 
Join Date: Sep 2003
Posts: 1,521
Thanks: 1
Thanked 81 Times in 68 Posts
Rep Power: 10
jpf is just really nicejpf is just really nicejpf is just really nicejpf is just really nicejpf is just really nice
Default Re: How Can I Retain Session Id Outside Of osCommerce Catalog Directory?

Maybe with cookie bases session would be a better idea - no SID in URL.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-27-2007, 12:05 PM
Lurker
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
dublinguy is on a distinguished road
Default Re: How Can I Retain Session Id Outside Of osCommerce Catalog Directory?

Thx for that, jpf. How would I switch the engine to use cookies instead of a SID in the URL?
Guy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-27-2007, 09:46 PM
jpf's Avatar
jpf jpf is offline
Moderator

 
Join Date: Sep 2003
Posts: 1,521
Thanks: 1
Thanked 81 Times in 68 Posts
Rep Power: 10
jpf is just really nicejpf is just really nicejpf is just really nicejpf is just really nicejpf is just really nice
Default Re: How Can I Retain Session Id Outside Of osCommerce Catalog Directory?

Force cookies....

Under Configuration, Session....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Rot or in Catalog directory theengineer osCMax v2 Installation issues 1 02-28-2007 11:10 PM
Warning: Session directory doesnt exist benlogan osCMax v2 Installation issues 1 08-06-2005 04:54 AM
How do you retain Session/Product ID in Standard HTML site Ttownsend osCommerce 2.2 Modification Help 7 07-19-2005 01:48 AM
Error: Catalog images directory does not exist: catalog/imag Korsh osCommerce 2.2 Installation Help 1 11-26-2003 08:31 PM
warning directory does not exist: /tmp.Session will not work mickthefish osCommerce 2.2 Installation Help 2 09-18-2003 04:09 PM


All times are GMT -8. The time now is 06:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2008 osCMax