Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter
#12

[eluser]koichirose[/eluser]
I don't really understand how to offer a seamless experience for both logged users and guests.
Examples:

- A guest puts items in the cart. The guest logs in -> items are saved to the db in addition to the session. (I guess I could manage this in the login function, calling save_cart_data() right there, or is there something better?)
- A guest wants to view his cart -> load items from the session. (this works great)
- A logged-in user wants to view his cart -> load items from the db (this I don't understand: saved cart data on the db doesn't include some fields. This is the same product saved in the session and saved on db and unserialized:
Code:
//session
array
      'row_id' => string 'd3d9446802a44259755d38e6d163e820' (length=32)
      'id' => string '10' (length=2)
      'name' => string 'shoes' (length=5)
      'quantity' => string '1' (length=1)
      'price' => string '€99.99' (length=11)
      'stock_quantity' => string '10' (length=2)
      'internal_price' => float 99.99
      'weight' => string '0g' (length=2)
      'tax_rate' => string '20%' (length=3)
      'shipping_rate' => boolean false
      'separate_shipping' => boolean false
      'reward_points' => string '1,000' (length=5)
      'status_message' =>
        array
          empty
      'tax' => string '€16.67' (length=11)
      'non_discount_quantity' => string '1' (length=1)
      'discount_quantity' => string '0' (length=1)
      'price_total' => string '€99.99' (length=11)
      'discount_price' => string '€99.99' (length=11)
      'discount_price_total' => string '€99.99' (length=11)
      'discount_description' => boolean false
      'tax_total' => string '€16.67' (length=11)
      'weight_total' => string '0g' (length=2)
      'reward_points_total' => string '1,000' (length=5)

//db
array
      'd3d9446802a44259755d38e6d163e820' =>
        array
          'row_id' => string 'd3d9446802a44259755d38e6d163e820' (length=32)
          'id' => string '10' (length=2)
          'name' => string 'shoes' (length=5)
          'quantity' => float 1
          'price' => float 99.99
          'stock_quantity' => string '10' (length=2)
          'internal_price' => float 99.99
          'weight' => int 0
          'tax_rate' => boolean false
          'shipping_rate' => boolean false
          'separate_shipping' => boolean false
          'reward_points' => boolean false
          'status_message' =>
            array
              empty
          'tax' => float 16.665

So a bunch of fields are missing?

Thanks Smile


Messages In This Thread
flexi cart - A comprehensive shopping cart library for CodeIgniter - by El Forum - 05-15-2012, 06:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB