I'm working on a project with CodeIgniter. Because CI Session class is using Cookie to store data, and Cookie can hold only 4KB of data, so I decided to use Native PHP Session for storing data instead.
My problem is: sometimes the data stored in Session lost but I dont have any ideas about what is causing it.
Let me explain what i've done in more detail:
In product detail page : Customer decides to buy this product -> He/she clicks on "Add to cart" button -> Product's information will be stored in Session. Now let's click "Next step" button
Go to "View cart" page: I use data stored in Session (product_id, for example) and get some extra data from database to display for customer. Now let's click "Next step" button
In this step, customer has to leave his/her informations (name, phone, email, address) for delivery and I save them in a Session variable names $_SESSION['customer_info']. Now let's click "Next step" button
In this step, customer will select a payment method, review his/her order detail and delivery information (it means SESSION is working). Let's click on "Checkout" button and move to final step
When customer hits "Checkout", I call an AJAX to POST the payment_method to, for example, "frontend/cart/checkout" function.
In this function, I pull out the informations stored in SESSION (cart items, customer information) and save them to the database and then send an email about the order detail to customer. The email content contains these informations : products (quantity, amount, name,...) and customer's delivery information (name, address, email, phone). I also save the email content to the database (just for make sure that I wont lose any information).
The problem is : Sometimes (just in sometimes), the delivery informations is empty (I mean there's nothing about the delivery information in the email, or even in the database, it's totally empty) but the cart items are still there. :( It's really really weird to me.
Any ideas or suggestions?
Thanks in advance!