Pablos Posted May 9, 2014 Share Posted May 9, 2014 My session variables are all taking the value of the last one set. $session->getAll() returns '0'. Seems like they're not being set at all.I've turned on debug in config and I'm getting the following errors:Notice: Trying to get property of non-object in /Users/Pablo/Sites/shoptest/wire/core/PageAccess.php on line 26Notice: Trying to get property of non-object in /Users/Pablo/Sites/shoptest/wire/core/PageAccess.php on line 28Notice: Undefined variable: cartActive in /Users/Pablo/Sites/shoptest/site/templates/shophead.inc on line 79Notice: Undefined variable: itemRemoved in /Users/Pablo/Sites/shoptest/site/templates/shophead.inc on line 131The last two are the session variables.Thanks for any advice,Paul Link to comment Share on other sites More sharing options...
diogo Posted May 9, 2014 Share Posted May 9, 2014 Can you show us the code of setting the session? Link to comment Share on other sites More sharing options...
Pablos Posted May 10, 2014 Author Share Posted May 10, 2014 I've tried both these $session->$cartActive='true'; $session->set($cartActive, 'true'); Link to comment Share on other sites More sharing options...
diogo Posted May 10, 2014 Share Posted May 10, 2014 What is the variable $cartActive holding? Link to comment Share on other sites More sharing options...
Soma Posted May 10, 2014 Share Posted May 10, 2014 And the code around it? Is $session existent in scope? Try wire("session")->$cartActive instead if in a function. Link to comment Share on other sites More sharing options...
Pablos Posted May 10, 2014 Author Share Posted May 10, 2014 I'm using the 'true'/'false' string to track whether my shopping cart code should be displayed when the page is reloaded. I'm not setting the variable from within a function. In fact, even with the session variable assignment removed, I still get Notice: Trying to get property of non-object in /Users/Pablo/Sites/shoptest/wire/core/PageAccess.php on line 26Notice: Trying to get property of non-object in /Users/Pablo/Sites/shoptest/wire/core/PageAccess.php on line 2 Link to comment Share on other sites More sharing options...
Soma Posted May 10, 2014 Share Posted May 10, 2014 Looks like it's not about session. Line 2? There's nothing. Make sure PW is installed and there's all files and that they're not corrupted or missing. Sometimes it happens when upload to a server. Link to comment Share on other sites More sharing options...
Pablos Posted May 10, 2014 Author Share Posted May 10, 2014 Sorry, that should have been line 28, not line 2. Edit: It's actually on my local server, so I haven't moved it since starting the project. Can I simply download Processwire and replace the wire folder? Link to comment Share on other sites More sharing options...
Pablos Posted May 10, 2014 Author Share Posted May 10, 2014 OK, I've got it sorted now. I remade the template and repopulated it. No error messages and session variables are working perfectly. Thanks for the replies, Paul Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now