[eluser]keld[/eluser]
Hello, I'm having a weird problem here.
I have a controller called booking.php that contains a checkout() function, a payment() function, a success() function and a cancel() function to use with paypal express checkout.
The transaction starts here:
mysite.com/booking/checkout where I check for the user's data being submitted, check for errors and calculate the price of the products.
When the user clickts the paypal Pay Now button, I load this url:
mysite.com/booking/payment which handles all the paypal api stuff like token, sending the user info and price to paypal then redirects to paypal to proceed with the payments. The user then pays, using paypal account or credit card then gets redirect to:
mysite.com/booking/success.
This is where it stops working, after the redirect, the constructor of the controller doesn't get loaded at all, meaning that all my CI sessions are gone, firephp output doesn't work, email lib and paypal lib don't load.
Using basic php like $_SESSION works but CI functions don't.
I have to re-declare everything in the success function.
This is what the constructor looks like:
Code:
function __construct()
{
parent::__construct();
session_start();
$this->firephp->setEnabled(TRUE);
$this->load->library('email');
$this->load->library('paypal');
$this->output->enable_profiler(TRUE);
}
My success function:
Code:
public function success(){
session_start();
//require 'paypal.php';
$this->firephp->log($this->session->userdata('amount'), 'amt: ');
$this->firephp->log($_GET['token'], 'token: ');
$this->firephp->log($_GET['PayerID'], 'PayerID: ');
echo "in success: ".$this->session->userdata('amount'); //DOESNT WORK
echo "session amount: ".$_SESSION['amount']; WORKS
echo "currency: ".$_SESSION['currency'];
if(!empty($_GET['token']) && !empty($_GET['PayerID'])){
//Update DB with payment
}else{
echo "Error, no access to this page";
}
Any idea why my constructor is ignored?
Thank you.