I want to pass a variable between two actions using Session component. the variable session read returns a value in the payment action but it returns NULL in the action checkout.
Here is the code:
//AppController.php
class AppController extends Controller
{
public $components = array('Session', 'Auth', 'Cookie', 'Email');
// rest of the code
}
//OrderController.php
class OrdersController extends AppController
{
public $components = array('Paginator','Session');
// rest of the code
public function payment($hash=null)
{
//some code
$priceTND = 123,55; //just for the test
$this->Session->write('priceCTP',$priceTND);
//var_dump($this->Session->read('priceCTP')); it returns 123.55
// rest of the code
}
public function checkout()
{
$this->render("checkout",FALSE);
$price = $this->Session->read('priceCTP');
var_dump($price); // it returns NULL
// rest of the code
}
}