Cookies, Links, Session IDs
Cheri asks;
I have an extra text box on my index page and I would like to add hyperlinks. I'm told that the HTML may cause problems, including the possibility of my customer's carts getting emptied and/or logging the customer out. Do you agree with this? And what issues would forcing cookies possibly cause? Please explain in as simple terms as possible, I don't know code, etc. The store is doing pretty well right now and the last thing I want to do is chase away customers. I just think adding hyperlinks on the front page would make the spiders happy. And we like happy spiders
![]()
All you need to remember is that any links that go to other osCommerce based pages in your own site MUST carry a SID. Any links elsewhere, need not.
So, to carry a SID, use the "tep_href_link" function;
-
<a href="<?php echo tep_href_link(FILENAME_SHIPPING); ?>">Shipping</a>
as an example. Note that in the example I have simplified a bit asyou would want to use the language definitions rather than just type "Shipping". But anyway, use the tep_href_link to other osCommerce pages and all will be well.
The tep_href_link function also accepts parameters - so if you wanted to link to a category you could do this:
-
<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=24'); ?>">Widgets</a>
Obviously in the example above we are linking to category ID = 24. You can pass more parameters as you need them;
-
<a href="<?php echo tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=3'); ?>">Manufacturer Name</a>
In this one, we are linking the manufacturers ID and setting an action. The action is carried out as per the codebase in the the file we link too - in this case "FILENAME_REDIRECT" (aka redirect.php).
You can also tell the tep_href_link to link via SSL - which you should do when linking to any page that requires the user to be logged in. Example:
-
<a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'>Login</a>
What this will do is link the SSL page iny our site (https://) rather than the normal http page. Assuming you have SSL set up of course!
Hope this helps.


