I have a page (cart page in ecommerce) with some data id like to access via PHP so I can mail it.
When I print all session variables using print_r( $_SESSION ); I get the following code.
I want to echo the value of "total".
I am using $_SESSION['cart']['total']; but it doesn't work.
All other outputs like "currency" and "language" are displayed as they should be.
What am I doing wrong here?
array(22) {
["sessiontoken"]=>
&string(32) "2239f469b65f039885a0c747f6595609"
["cart"]=>
&object(shoppingCart)#1 (5) {
["contents"]=>
array(2) {
[216]=>
array(1) {
["qty"]=>
int(1)
}
[71]=>
array(1) {
["qty"]=>
int(1)
}
}
["total"]=>
float(115.9)
["weight"]=>
float(0)
["cartID"]=>
&string(5) "91586"
["content_type"]=>
string(8) "physical"
}
["language"]=>
&string(7) "english"
["languages_id"]=>
&string(1) "1"
["currency"]=>
&string(3) "USD"
["navigation"]=>
&object(navigationHistory)#2 (2) {
["path"]=>
array(5) {
[0]=>
array(4) {
["page"]=>
string(9) "index.php"
["mode"]=>
string(6) "NONSSL"
["get"]=>
array(1) {
["cPath"]=>
string(2) "50"
}
["post"]=>
array(0) {
}
}
[1]=>
array(4) {
["page"]=>
string(7) "404.php"
["mode"]=>
string(6) "NONSSL"
["get"]=>
array(0) {
}
["post"]=>
array(0) {
}
}
[2]=>
array(4) {
["page"]=>
string(21) "checkout_shipping.php"
["mode"]=>
string(3) "SSL"
["get"]=>
array(0) {
}
["post"]=>
array(15) {
["formid"]=>
string(32) "2239f469b65f039885a0c747f6595609"
["action"]=>
string(7) "process"
["payment"]=>
string(5) "gspay"
["shipping"]=>
string(9) "flat_flat"
["hd_shipping"]=>
string(5) "12.00"
["hd_std_shipping"]=>
string(5) "29.00"
["cust_fname"]=>
string(1) "k"
["cust_lname"]=>
string(1) "k"
["cust_email"]=>
string(10) "[email protected]"
["cust_street"]=>
string(3) "kkk"
["cust_city"]=>
string(3) "kkk"
["cust_state"]=>
string(3) "kkk"
["cust_zip"]=>
string(3) "222"
["country"]=>
string(2) "72"
["btnSubmit"]=>
string(20) "Continue to checkout"
}
}
[3]=>
array(4) {
["page"]=>
string(20) "checkout_payment.php"
["mode"]=>
string(3) "SSL"
["get"]=>
array(0) {
}
["post"]=>
array(0) {
}
}
[4]=>
array(4) {
["page"]=>
string(25) "checkout_confirmation.php"
["mode"]=>
string(3) "SSL"
["get"]=>
array(0) {
}
["post"]=>
array(2) {
["formid"]=>
string(32) "2239f469b65f039885a0c747f6595609"
["payment"]=>
string(5) "gspay"
}
}
}
["snapshot"]=>
array(0) {
}
}
["user_type"]=>
&string(5) "guest"
["sendto"]=>
&NULL
["cartID"]=>
&string(5) "91586"
["payment"]=>
&string(5) "gspay"
["comments"]=>
&NULL
["shipping"]=>
&array(3) {
["id"]=>
string(9) "flat_flat"
["title"]=>
string(53) "Global Priority Shipping (It takes 5-7 business days)"
["cost"]=>
string(5) "12.00"
}
["cust_fname"]=>
&string(1) "k"
["cust_lname"]=>
&string(1) "k"
["cust_email"]=>
&string(10) "[email protected]"
["cust_street"]=>
&string(3) "kkk"
["cust_city"]=>
&string(3) "kkk"
["cust_state"]=>
&string(3) "kkk"
["cust_zip"]=>
&string(3) "222"
["cust_country"]=>
&string(2) "72"
["cust_country_title"]=>
&string(7) "Finland"
["billto"]=>
&NULL
}
['cart']->total, since cart is an object?