Codeigniter Cart wrong cookie - codeigniter

I embedded this example http://net.tutsplus.com/tutorials/php/how-to-build-a-shopping-cart-using-codeigniter-and-jquery/ to my shop.
I faced an issue that $total = $this->cart->total_items(); gets quantity value.
And if compare cookies from my site with cookie from example this is the difference:
my ...total_items"*;i:66;*s:10:"cart_total";i:5610;}}.....
original ...total_items*";s:1*:"1";s:10:"cart_total";s:4:"1499";...
So as you can see cookie stores wrong. I tried logging variables in Cart library but for this moment haven't caught problem. And I have another issue, as I think related with cookie I cannot add more than 7 items in cart. But I investigated this issue a bit, and mentioned only for helping.

Related

Magento : the cart is always empty

I've been looking for several days now and the problem is stil there.
I'm running the following version of Magento :1.9.0.1
I do not experience any particular problem on local (using Mamp). But on my production server my cart page (beginning of the checkout process) is always empty no matter the number of items i try to add inside my cart.
I tried lots of different solution posted on many websites but nothing seems to solve it (since this is working on local it might be a server configuration problem).
Any suggestion ?
Thank you
(Ps: English is not my main language so i'm sorry for the poor syntaxe).
Are you able to login to the site?
Just check in the backend. System->Configuration->Web->Session cookie management
Whether there is a wrong value set for cookie domain
I finally found the answer. The problem was related to a theme template module. I remove the module and it's working now.
Ty

Session gets clear in category page only in Magento

I have one problem in Magento Liver server uploaded site.
The problem is related to session or cookies. When I add product to cart or login, then visit category page, the session gets clear and i get signout and cart gets clear.
I tried setting session/cookie management. but not found solution.
Also asked to server technical support, they also not able to found.
This only happens in only one page category page.
Any other had faced this problem.
Please give me solution for this.
Thanks.
try this code for session issue fix
https://www.creare.co.uk/session-error-in-magento

Magento: add to cart shows empty cart

When I add a product to my cart, I get the "empty cart" page.
I run Magento 1.7.0.2.
I have a writable session dir (var/session/) and see sess_* files being created
I have the following cookie settings (System -> Configuration -> Web -> Session Cookie Management): Cookie Lifetime = 10800 (3 hours), Cookie Path = empty, Cookie Domain = empty, Use HTTP Only = Yes, Cookie Restriction Mode = No
I already tried: Use HTTP Only = No
The cart/checkout is set to go trough HTTPS, but I have the same base URL's for secure and unsecure. I tested this (HTTPS front end Yes and No) and it makes no difference...
I checked the addAction() on the Mage_Checkout_CartController and it gets the params and adds the product + saves the cart
I checked the chooseTemplate() method on Mage_Checkout_Block_Cart and this gets a cart's items count of NULL, when I manually/ (hard code) change this to 1, then the cart 'filled' template gets rendered (also rendered correctly, but 'of course' no items)
I cleared cache and session data in between testing and trying...
Anyone had this and fixed this somehow? Or any suggestions on what to try next?
The following solutions worked for us. This is a late answer and I still consider to post an answer to this question so that it may help other people who are still stuck and looking for more solutions to try.
First we switched our domain to www which caused this problem. We fixed that problem by removing the caches, sessions and cookies. But we started experiencing that problem again and we thought that it was complex situation for us since we changed some javascript, www and SSL. But finally we found out that some products had 0 quantity and we were unable to add to cart. The cart page was hiding the out of stock message as error since it was ajax cart page through another module and theme. Then We set correct quantities for those items and the empty cart page is gone.

Cannot log in or add items to cart in Magento after migrating to new server

I have migrated a Magento site to another server (the same server the database was already hosted on) and I am no longer able to log in or add items to my cart. I have found a few others who have posted about this type of problem but nothing seems to work for me. I have disabled all caching, etc. Ensured that sessions work. Increased the session lifetime. No errors are being logged anywhere. If I enter wrong credentials I get an error. But if I enter the correct information it just keeps returning me to the login page. I have opened permissions completely. Nothing makes any difference! So aggravated. Please help!
Found the issue. Well sort of. I think there was a problem with the timezone (the server I moved to was an hour different from the other) but essentially I resolved the problem by increasing the values for two config items in core_config_data:
UPDATE core_config_data SET value=86400 WHERE path='web/cookie/cookie_lifetime';
UPDATE core_config_data SET value=86400 WHERE path='admin/security/session_cookie_lifetime';
The first query fixed the shopping cart problem, the second the admin login problem.
Again I think there is a mitigating factor here as well, but this at least got me over the hump.

Magento session lost when switching to https from http

I've searched high and low for a solution to this, with no luck. My host told me they are too busy to help.
Magento 1.4.2 // SSL cert
1- When I add an item to cart, the page reloads and my item is added to cart. [good]
2- Next, I click home, and my items are no longer visible in cart sidebar. [bad]
3- Next, I click "Tops", and my items are still not visible in cart sidebar. [bad]
4- Next , I click "Bottoms" and the items show just fine.
In all cases where the cart isn't visible, I can add https to the URL and the cart loads up just fine. Can anyone help me figure out why my session is being lost between http and https?
I have all my backend web cookie settings set to "no" except for sID.
Also- When a user is logged in, the cart items ALWAYS show on the right. It's only screwy if they're a guest.
Thanks guys, if you need me to post any code let me know.
wwwdotlylifdotcom
EDIT: Here is a screenshot of my cookies session in firebug (not exactly sure what I am looking at). Hope this helps.
And here is my Session settings in magento: I have tried just about every variation of turning these on and off.
EDIT!
This issue has actually been narrowed down to a cache issue. We found out that when the cache is dumped/deleted, the website works properly. But after a few minutes of surfing the problem happens again. Does anyone have any idea? (And should i change the question title?)
I'm using a module called Lightspeed from TinyBrick, and it seems the new cache options are messing with our site. =( I'm contacting them shortly.
**EDIT Tinybricks excellent support helped us out. Thanks for all of your suggestions.
Is the session cookie being set to be HTTPS-only? That'll prevent it from being carried over to regular HTTP requests, effectively giving the user two different sessions.
You have in your screenshot two frontend cookie with two domains, one with www and an other one without. Check if you have a correct domain name in the configuration > Web tab > Cookie Management > Cookie Domain (or something close to that). If it's empty set it to ".mydomain.com" and try again.
Check if you don't have different cookie domain in your configuration in the other store views, set them to "use website".
If still doesn't work, What are the values of the fields of cookie management and the cookie validation settings
We were experiencing similar issues where our custom nav (depending on whether a user was logged in or not, was not very consistent across different pages.
We followed the suggestion # http://ka.lpe.sh/2011/06/19/magento-checking-customer-admin-is-logged-in-or-not/ to check if a user was logged base on the frontend session variable before a rendering a particular block, and it seems to have done the trick.
Perhaps you can try something similar.
Tinybricks excellent support helped us out. Thanks for all of your suggestions. This was a localized problem based off cache and a module called Lightspeed.

Resources