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. ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| 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... 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> 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>';
} ?> Cheers, Guy |
|
#2
| ||||
| ||||
| Maybe with cookie bases session would be a better idea - no SID in URL. |
|
#3
| |||
| |||
| Thx for that, jpf. How would I switch the engine to use cookies instead of a SID in the URL? Guy |
|
#4
| ||||
| ||||
| Force cookies.... Under Configuration, Session.... |
| Thread Tools | |
| |
| ||||
| 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 |