Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer gets logged out when clicking links


wayneoscommerce

Recommended Posts

Posted

Hi. I am using Define MainPage contribution that adds edit section for index.php page of catalog.

 

I have created a list of links for the catalog on this page. When a customer is logged in, goes to the index.php page of catalog, and clicks one of the links to a category, they get logged out.

 

How can I create links to categories that will dynamically hold the same session so customer does not get logged out? I am currently using a link such as index.php?cPath=21 on that page

<a href="index.php?cPath=21">Category One</a>

Posted

To retain the session ID and stay logged in you must use the osC PHP function tep_href_link to make links:

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=21'); ?>" title="Category One">Category One</a>

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 >

Posted
To retain the session ID and stay logged in you must use the osC PHP function tep_href_link to make links:

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=21'); ?>" title="Category One">Category One</a>

 

Thanks - I entered exactly what was suggested for the link, and but when I click the link in the index.php page of the catalog, I get a 404 error and the link is as follows in addres bar:

 

www.my-domain.com/oscommerce-catalog/%3C?php%20echo%20tep_href_link(FILENAME_DEFAULT,%20'cPath=21');%20?>

 

Any suggestions on this?

Posted

You must have the code embedded in more PHP.

 

In that case it should be:

 

echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=21') . '" title="Category One">Category One</a>';

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 >

Posted

If that doesn't work, you'll have to post the code where you're using it so I can see what's going on.

:blink:

 

I tested both ways on my site, and when used in the correct context they both work.

;)

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 >

Posted
If that doesn't work, you'll have to post the code where you're using it so I can see what's going on.

:blink:

 

I tested both ways on my site, and when used in the correct context they both work.

;)

 

The code on the index.php page is as follows:

 

<table cellspacing="10" cellpadding="0" width="100%" align="center" border="0">
<tbody>
	<tr>
		<td>
		<div align="center"><a href="index.php?cPath=21"><br />
		</a></div>
		</td>
		<td>
		<div style="text-align: left"><a href="index.php?cPath=21">Basic Bars</a></div>
		</td>
		<td>
		<div align="center">
		<div align="center">
		<div style="text-align: left"><a href="index.php?cPath=26">Canvas</a></div>
		</div>
		</div>
		</td>
	</tr>
	<tr>
		<td>
		<div align="center">
		<div align="center">
		<div align="center">
		<div align="center"> </div>
		</div>
		</div>
		</div>
		</td>
		<td>
		<div style="text-align: left"><a href="index.php?cPath=22">Standard Bars & Braces</a></div>
		</td>
		<td>
		<div align="center">
		<div align="center">
		<div style="text-align: left"><a href="index.php?cPath=32">Gesso</a></div>
		</div>
		</div>
		</td>
	</tr>
	<tr>
		<td>
		<div align="center">
		<div align="center"><a href="index.php?cPath=24"><br />
		</a></div>
		</div>
		</td>
		<td>
		<div style="text-align: left">
		<div style="text-align: left">
		<div style="text-align: left"><a href="index.php?cPath=24">Standard Frames</a></div>
		</div>
		</div>
		</td>
		<td>
		<div align="center">
		<div align="center">
		<div align="center">
		<div align="center">
		<div align="center">
		<div style="text-align: left"><a href="index.php?cPath=27">Tools for Stretching</a></div>
		</div>
		</div>
		</div>
		</div>
		</div>
		</td>
	</tr>
	<tr>
		<td>
		<div align="center"><a href="index.php?cPath=23"><br />
		</a></div>
		</td>
		<td>
		<div align="center">
		<div style="text-align: left">
		<div style="text-align: left">
		<div style="text-align: left"><a href="index.php?cPath=23">Professional Bars & Braces</a></div>
		</div>
		</div>
		</div>
		</td>
		<td>
		<div align="center"><a href="index.php?cPath=26"><br />
		</a></div>
		</td>
	</tr>
	<tr>
		<td>
		<div align="center">
		<div align="center"> </div>
		</div>
		</td>
		<td>
		<div align="center">
		<div align="center">
		<div align="center">
		<div align="center">
		<div style="text-align: left"><a href="index.php?cPath=25">Professional Frames</a></div>
		</div>
		</div>
		</div>
		</div>
		</td>
		<td>
		<div align="center"> </div>
		</td>
	</tr>
	<tr>
		<td> </td>
		<td>
		<div align="center">
		<div style="text-align: left"><a href="index.php?cPath=23">HD Basic Bars</a></div>
		<p style="text-align: left"> </p>
		</div>
		</td>
		<td>
		<div align="center">
		<div align="center"> </div>
		 </div>
		</td>
	</tr>
	<tr>
		<td>
		<div align="center">
		<div align="center"><a href="index.php?cPath=27"><br />
		</a></div>
		 </div>
		</td>
		<td>
		<div align="center"> </div>
		</td>
		<td> </td>
	</tr>
	<tr>
		<td>
		<div align="center">
		<div align="center"><a href="index.php?cPath=21"><br />
		</a></div>
		 </div>
		</td>
		<td>
		<div align="center">
		<div align="center"><a href="index.php?cPath=22"><br />
		</a></div>
		 </div>
		</td>
		<td>
		<div align="center">
		<div align="center"><a href="index.php?cPath=25"><br />
		</a></div>
		 </div>
		</td>
	</tr>
</tbody>
</table>

Posted

The first code I posted should work.

 

Your site doesn't appear tp be parsing PHP.

 

Contact your host for support.

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 >

Posted

I just saw this in your first post:

 

I am using Define MainPage contribution

I'm not familiar with how that works, but it appears you cannot embed PHP into the content.

 

If you put the code I posted first into a "normal" PHP page and accessed it with your browser it would work.

 

Maybe someone familiar with that contrib. will read this and offer suggestions.

 

As it is, I haven't a clue.

:blush:

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 >

Archived

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

×
×
  • Create New...