Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What is the major reason of the code?


RusNN

Recommended Posts

Posted

Hi

 

I have a question about some code explanation. I mean code && empty($SID) from columns_left.php or product_info.php. This is used in addition to USE_CACHE setting in eg. manufacturers box

  if ((USE_CACHE == 'true') && empty($SID)) {
   echo tep_cache_manufacturers_box();
 } else {
   include(DIR_WS_BOXES . 'manufacturers.php');
 }

 

The general idea is to cache manufacturers (and so on). But, in fact of using && empty($SID) we have situation when only spiders or visitors without a session uses cached results. If we deal with registered customer that always has a session, we never use cache due to && empty($SID) is allways false and the results were generated on every page load.

I think, this is not the result we want, because the server load is not decrease. So, please, explain me the major reason of using && empty($SID) in the example code above. May be I am wrong in my thoughts, but for now I think it wil be good idea to drop && empty($SID) code from the IF statement.

Posted

The first time a page is accessed, We don't yet know if the browser is accepting cookies or not, so after session_start() is called, $SID will be non-empty, and the session id will be added to all the URL's, In this instance we don't want to cache anything.

 

On the next page you will see $SID is empty (assuming the browser has accepted the cookie) so the cached boxes can then be used. This applies to both anonymous users and also registered users alike.

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Posted

Thank you, Mark!

 

Seems, I understand. If we cache the results when $SID is not empty, the session id will be added to all links. This links will be saved as cache results wich cause a security problem and so on.

 

Unfortunatelly on Denwer session id is added to URL every time. This cause some debug issues.

 

Thanks again!

Posted

If you are seeing a session id on every page then either your browser is rejecting the cookie or your cookie settings do no match your store location. You will need to tweak your settings in configure.php so that the cookie gets set properly.

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Posted

If you are seeing a session id on every page then either your browser is rejecting the cookie or your cookie settings do no match your store location. You will need to tweak your settings in configure.php so that the cookie gets set properly.

On real server everything is OK.

Possible the problem is on Denwer or some of its settings. I use it for local development and testing and there are a some little difference between real server and localhost. So, the issue succesfully solved.

Archived

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

×
×
  • Create New...