Jump to content

Can't view an offline store when logged in as admin V3


steve-t
 Share

Recommended Posts

I know this is an old chestnut - I have tried all the fixes here, and different browsers etc. and still can't get it working.

I have two CubeCart sites, both are hosted by the same company, same PHP, same MySQL versions.

One site is version 3.0.17 - installed via Fantastico - no problems: when logged in as an admisistrator you can view the site offline all the time and in any browser. It has been like this 'out of the box', and didn't require any of the mods shown here to get it working.

The other site is version 3.0.20 - installed manually via FTP - all working so far, apart from not being able to view the store when logged in as admin MOST of the time. Very occasionally you can see the store as admin, regardless of browser and seemingly for no reason.

The only difference between the two is that the URL for the site using version 3.0.20 is a subdomain.

I know version 4 (and now 5) is available but I would like to know that this issue can be fixed - i.e. there is proper support here - before commiting myself and my customers to the product, which in all other ways seems excellent.

Link to comment
Share on other sites

Welcome steve-t! Glad to see you made it to the forums.

When you say you've tried all the fixes here, could you briefly enumerate what you've tried?

If you can view the v20 store occasionally, then the store code must be functioning correctly and the problem for most of the time must lie elsewhere.

Let's review:

1. Even if you think you are logged out, do so manually at both stores: yoururl/admin/logout.php

2. Find and delete all browser cookies that may be left over that reference either of your stores

3. Log in to the v20 admin section. (not the customer section)

4. Make sure the store configuration is set to be offline and that the admin can view.

5. Using the same web browser, visit your store.

If you still get the offline page, in the file /offline.php, add this after the <body> tag:

<?php 

echo "The Admin has set the store to be "; if($config['offLine']) { echo "offline.<br />"; }else{ echo "online.<br />"; }

echo "And the Admin "; if($config['offLineAllowAdmin']) { echo "is"; }else{ echo "is not"; } echo " allowed to view an offline store.<br />";

echo "But, there "; if(isset($_SESSION['ccAdmin'])) { echo "is (".$_SESSION['ccAdmin'].")"; }else{ echo "is not"; } echo " an admin session active at this store.<br />";

?>

This will tell the conditions found when CC decided to show the offline page instead of the main store.

The moderator might chime in and say that these forums are not the place for "proper" support. Proper support is through paid support through Devellions ticket/helpdesk system. That being said, there is a lot of ad hoc support here, a lot of it very good.

Link to comment
Share on other sites

This is an old bug, v3 front end admin sessions can be problematic on occasion. Try this, backing up the file in case it doesn't help...

1. Edit '/admin/login.php'.

2. Find the following line, around line 49.

@ini_set("session.cookie_path",$sessionDomain);

3. Change to this...


@ini_set("session.cookie_path","/");

Where the '/' entry is the path of the store from the domain root. If your store is http://domain.com/store/ the entry will be '/store/'

Link to comment
Share on other sites

bsmither, thanks for the reply.

I tried your 5 point suggestion and it appeared to work for a few logins.

I'm back to square one now though, and repeating the suggestion list doesn't help.

I put the code in you suggested and this was the result:

The Admin has set the store to be offline.

And the Admin is allowed to view an offline store.

But, there is not an admin session active at this store.

I hope this helps you troubleshoot the problem?!

The fixes I remember doing are changing the line around 49 '$session Domain' to the store entry path in admin/login.php; and another which involved putting a block of code above 'session_name' in the same file and two other files, which were also in the admin folder I think. Sorry that is vague.

Any more help you have would be greatly appreciated.

Link to comment
Share on other sites

The Admin has set the store to be offline.

And the Admin is allowed to view an offline store.

But, there is not an admin session active at this store.

I hope this helps you troubleshoot the problem?!

Strange that you are able to log in, and while still logged in, the front of the store isn't aware of $_SESSION['ccAdmin'].

...it appeared to work for a few logins.

About how much time (if you recall) elapsed between the first login and the login where you lost the ability to view your store?

And just to be clear, when you are attempting to view your store, you are, in fact, still logged in to the admin side of the store and can navigate around?

And also, to be clear, during your visits to to your v20 store admin section and front section, you did not visit any part of your v17 store?

When logging in, /admin/login.php checks if a user and pass was sent. If so, several tests are made to determine if this login attempt should be blocked.

If your login credentials were found and you are not blocked, $_SESSION['ccAdmin'] is set to your CubeCart_admin_users adminId value. You are then redirected to the admin pages.

(I read a comment - in the PHP online documentation - where someone asserted that jumping between https and http pages on the same site would confuse the SESSION data. I don't know how that would happen, but just as a test, in the Admin settings, switch off SSL mode for a while.)

Link to comment
Share on other sites

Thanks for the message Robsta.

The fix you posted was one of the first things I tried, I read it an another post. Unfortunately it didn't work for me.

I use a program called Millshield to clean up IE - it even shreds the index.dat file as well as the temp files, so I'm as sure as I can be that there are no old files left. I did manually check the temp files folder too.

Link to comment
Share on other sites

Thanks again for the repsonse bsmither.

The facility to view the store offline was available for about 20 minutes.

I can confirm I am still logged and and can navigate anywhere in the back end without a problem.

I can't be sure about not visiting the V17 store at the time, but I tried again today witha clean temp cache, avoiding the V17 store and there is no change.

I've done a little investigation though, hopefully it doesn't complicate things unecessarily :-

I looked at the temp files folder to see what was happening while I moved around the site.

Once I have logged in as admin, I would have expected (with my limited knowledge of how these things work) a cookie to appear in the temp files. There are no cookies there though.

When I click the 'Store Home' link, that's the point when the cookie is delivered to the temp files folder, and it has an expiry time of 48 hours according to IE if that's relevant. If this happens then I can view the store in offline mode while logged in, and I seem to be able to do this after logging in and out many times, as long as the cookie is there.

However, if the cookie doesn't get delivered (after clearing the temp files folder out again) then I can't view it offline. This is the situtation most of the time - the cookie doesn't get delivered to the temp files folder.

The above is hard to see if you go first to a store that is online, because another cookie with same name (I think) is delivered as soon as you hit the home page.

I can repeat this over and over, every time there is no cookie I can't see the store offline and vice versa.

So what is responsible for delivering the cookie?

Apologies if I have over-simplified things and missed a vital point somewhere!

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...