0

I am combining OpenCart and CakePHP Modules and I want to use session value of CakePHP in OpenCart session of customer ID.

$this->Session->write('customer_id',$id);//in cakephp
$_SESSION['customer_id'];//in open cart 

Value of customer_id comes correct but not shown in session of OpenCart, is there any method to do so?

livibetter
  • 19,832
  • 3
  • 42
  • 42
  • Most likely your sessions are completely separate - which probably means that the cookie domain for both sessions is different and/or they are using differently-named session cookies. – AD7six Apr 21 '15 at 12:57
  • so how do i make a common cookie domain for both of them ?? –  Apr 22 '15 at 03:07
  • Well, by applying how you'd do that to any two applications, to both your CakePHP app and opencart. Possible duplicate of [CakePHP keep session from main domain across to a subdomain](http://stackoverflow.com/questions/10519570/cakephp-keep-session-from-main-domain-across-to-a-subdomain) – AD7six Apr 22 '15 at 12:26

1 Answers1

1

CakePHP may be creating a multi-dimensional array on $_SESSION. I would do a print_r($_SESSION); to see where exactly the customer_id is ending up, or use CakePHP's debug() function debug($_SESSION);

John McMahon
  • 1,605
  • 1
  • 16
  • 21
  • Debugging CakePHP's session data will at most give you CakePHP's session data - [the problem is likely different](http://stackoverflow.com/questions/29761656/merging-session-values#comment47676116_29761656). – AD7six Apr 21 '15 at 12:57
  • Another way for debugging in CakePHP: `$this->log($variable_name, 'debug');` If you use DebugKit toolbar, simpler than before: `debug($_SESSION)`. – Vy Do Apr 24 '15 at 11:38