What kind of information can I pull from $this->session->data?
I know that data is an array, but what sub-arrays lie within data? Can't find any real documentation on this?
Also, what would be the variables that contain a customer's(logged in or not) country, region, post code if they entered it into the "Estimate Shipping" on Cart page? I notice that it gets carried over to the Checkout page.
How can I access these?
I know that data is an array, but what sub-arrays lie within data? Can't find any real documentation on this?
Also, what would be the variables that contain a customer's(logged in or not) country, region, post code if they entered it into the "Estimate Shipping" on Cart page? I notice that it gets carried over to the Checkout page.
How can I access these?
The format and structure of $this->session->data changes from version to version, so the easiest way is just to print it out so you can see it. I usually do something like this in the /catalog/controller/common/header.php file:
That will hide it from the rendered HTML, but still show it in the source, so you can see what the session variables are on a given page.
Code: Select all
echo '<!--'; print_r($this->session->data); echo '-->';
It's different depending on your version, so the best way to tell is just to add that code and then look for the data in there. I believe in the latest versions it's usually something like:
Code: Select all
$this->session->data['shipping_country_id']
$this->session->data['shipping_zone_id']
$this->session->data['shipping_postcode']
Take note that the payment_ versus shipping_ also implies into the session data in order to capture the country, zone and postcode.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I cannot seem to print out the session data for 'agree'. Whenever I use the above method, all the session data is printed but the 'agree' data is missing.Johnathan wrote: ↑Thu Sep 24, 2015 12:46 amThe format and structure of $this->session->data changes from version to version, so the easiest way is just to print it out so you can see it. I usually do something like this in the /catalog/controller/common/header.php file:
That will hide it from the rendered HTML, but still show it in the source, so you can see what the session variables are on a given page.Code: Select all
echo '<!--'; print_r($this->session->data); echo '-->';
In catalog/controller/checkout/payment_method.php there is a check for this:
Code: Select all
if (isset($this->session->data['agree'])) {
That would be in your catalog/controller/checkout/confirm.php file around:
where you could add your own if statement:
Code: Select all
// Validate minimum quantity requirements.
Code: Select all
if (isset($this->session->data['agree'])) {
// Your condition statement here.
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 23 guests