Jump to content

Echo/Print info from Array from Session Variable


Go to solution Solved by Ch0cu3r,

Recommended Posts

Hi I have a session $_SESSION['pdf_quote'] which has a number of variables which i can easily echo/print. But... in the same session i have 2 arrays. I have no idea how to echo/print the contents of what is in the arrays.

These are the arrays
[product_arr] => Array
and
[extra_arr] => Array

when i run that i get the following but it still won't show me the contents of product_arr 

 

i think i need to implode to get the array... but thats where i get lost.

Array(    [id] => 46    [location_id] => 4    [type] => pickup    [status] => pending    [payment_method] => none    [is_paid] => 0    [txn_id] =>     [processed_on] =>     [price_subtotal] => 3125.00    [price_delivery] => 0.00    [price_total] => 3125.00    [voucher_code] =>     [created] => 2013-10-15 21:12:20    [p_dt] => 2013-10-25 08:00:00    [d_address_1] =>     [d_address_2] =>     [d_country_id] =>     [d_state] =>     [d_city] =>     [d_zip] =>     [d_notes] =>     [d_dt] =>     [c_name] => test    [c_email] => test@test.com    [c_phone] => 8298392832    [c_address_1] => eokeoj    [c_address_2] =>     [c_notes] =>     [c_country] =>     [c_state] => test    [c_city] =>     [c_zip] => 2000    [cc_type] =>     [cc_num] =>     [cc_code] =>     [cc_exp] =>     [product_arr] => Array        (            [0] => Array                (                    [extra_arr] => Array                        (                        )                )        ))
Edited by jay83rr
  • Solution

 

 

I'm guessing these are stored in the array that i can't see the contents of.

Try looking to see what is stored within the whole of $_SESSION variable

printf('<pre>%s</pre>', print_r($_SESSION, true));

If the product info is not in the session then your shopping cart is most likely storing the products information within the database. The $_SESSION['pdf_quote']['id'] varibale could hold the product id, This is used in database query to get the products information.  You will want to look at your shopping carts documentation on how it stores and retrieves products in the database.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.