Jump to content

Resolved - Displaying Categories in static method


Guest Ray_huang
 Share

Recommended Posts

Guest Ray_huang

Hi there,

I have been catching with te category displaying problem for a couple of weeks. The thing is our store is not open for public. Only customers who registered and approved can login and check all products. But When they login, they cannot check products by viewing categories. when they click one category link, they will be redirected to login page(another page outside of the store).

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

I have made some changes at offline() function as

if(... || !$GLOBALS['user']->is()){

}

to block the access without login.

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

This change works fine with the store 5.1.2 but not well with 5.1.4 because of the category displaying problem I mentioned(the red words above).

So the whole web site structure is like www.example.com/login.php, www.example.com/store1(5.1.2) and www.example.com/store2(5.1.4)

customers in store1 can login and access category without any problems but customers in store2(5.1.4) can login but cannot access category link. Two stores get separate databases and different customers. I applied the offline() function change to both stores.

I tried to delete all cached files in store2/cache folder such as "4d2c0.html.kurouto.menu.en-GB.cache" and reload the cache files for category. customers in store2 can access the category for a while. But after one week or later, the problem will come back again.

I inspected differences between 5.1.2 and 5.1.4 (mainly in GUI class and cache classes) and found that

all differences are mainly LOGO related( from what I have seen in the class files), which means they may not contribute to the category thing(maybe), like the rebuildLogos() function in GUI class.

Can anyone help me out this problem?

Thanks for any idea. Any suggestion would be appreciated.

Link to comment
Share on other sites

Guest Ray_huang

Emmmm

Looks like few know how this problem comes up. After inspecting the cache files one by one. I found that the key factor is this file

"pdc0c9.html.kurouto.menu.en-US.cache". So I am using the kurouto skin.

Does anyone know how this file get generated? Or how the expire mechanism works? Because I found that the problem comes up when the cache file expires

Thank you for any help!

Link to comment
Share on other sites

Guest Ray_huang

Finally, I found the key issue. I am glad to share it with you.

By decoding the "pdc0c9.html.kurouto.menu.en-US.cache" I found that the urls that cached in that file are different between the correct access and wrong access.

URL1-- "https://www.example.com/store/index.php?_a=category&cat_id=15"

URL2--"https://example.com/store/index.php?_a=category&cat_id=15

and One important thing is that I added some code in the store/classes/session.class.php file. These code will include the store root folder into session control, which means that the above url differences will result in different session.

the code is as follow:

if ($ini['session.cookie_path'] !== $GLOBALS['rootRel']) {

// make sure session cookies are pointing to store path

ini_set('session.cookie_path',$GLOBALS['rootRel']);

}

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

So why are the urls different?

The cache file mechanism:

1. if pdc0c9.html.kurouto.menu.en-US.cache does not exist, the cubecart will create it with the first line like "a:2:{s:4:"time";i:1351475197;s:6:"expire";i:86400;}"

2. if the file exists, the file will be read by using the function in /store/classes/cache/file.class.php read() and check if there are two lines and if the cache expires

(1351475197 + 86400 < time())

3. if the cache expires, this cache file will be unlink() (deleted) and new cache file will be created using new time stamp and urls

So if the cache file expires and then another person access the store using http://example.com, the new cache file will cache this url

then if another customer try to access http://www.example.com/category..., he/she will be redirect out of the store because the urls are different

Solution:

use .htaccess to control the urls. Transfer all non-www urls to www urls

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...