2

I have a slightly strange problem that I need your help with.

I have three independent Magento installations on my server. Two of which under an SSL certificate as such: https ://apps.domain.com/store1 & https ://apps.domain.com/store2. Both of these stores how custom themes. The third installation is a fresh install on the root of the domain without an SSL certificate as such: http:// www.domain.com/store3

What happens is that, all of a sudden, all three stores stop being able to add items to cart and give me this error "Cannot add the item to shopping cart.". And then an hour or a couple of hours later or so, the add to cart buttons start working again. The weird thing is that I don't change anything to make it work or stop working, and they all work or stop working simultaneously.

Please advise!

Update:

Actually I found this in my exception log:

2014-07-27T21:09:35+00:00 DEBUG (7): Exception message: Notice: Undefined offset: 2  in /home/---/store2/lib/Zend/Locale/Format.php on line 577
Trace: #0 /home/---/store2/lib/Zend/Locale/Format.php(577): mageCoreErrorHandler(8, 'Undefined offse...', '/home/vmegypt/p...', 577, Array)
1 /home/---/store2/lib/Zend/Locale/Format.php(513): Zend_Locale_Format::_getRegexForType('decimalnumber', Array)
2 /home/---/store2/lib/Zend/Filter/LocalizedToNormalized.php(100): Zend_Locale_Format::isNumber('3', Array)
3 /home/---/store2/app/code/core/Mage/Checkout/controllers/CartController.php(187): Zend_Filter_LocalizedToNormalized->filter('3')
4 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->addAction()
5 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add')
6 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
7 /home/---/store2/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
8 /home/---/store2/app/Mage.php(683): Mage_Core_Model_App->run(Array)
9 /home/---/store2/index.php(117): Mage::run('', 'store')
10 {main}
2014-07-27T21:09:35+00:00 ERR (3): 
exception 'Exception' with message 'Notice: Undefined offset: 2  in /home/---/store2/lib/Zend/Locale/Format.php on line 577' in /home/---/store2/app/code/core/Mage/Core/functions.php:245
Stack trace:
0 /home/---/store2/lib/Zend/Locale/Format.php(577): mageCoreErrorHandler(8, 'Undefined offse...', '/home/vmegypt/p...', 577, Array)
1 /home/---/store2/lib/Zend/Locale/Format.php(513): Zend_Locale_Format::_getRegexForType('decimalnumber', Array)
2 /home/---/store2/lib/Zend/Filter/LocalizedToNormalized.php(100): Zend_Locale_Format::isNumber('3', Array)
3 /home/---/store2/app/code/core/Mage/Checkout/controllers/CartController.php(187): Zend_Filter_LocalizedToNormalized->filter('3')
4 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->addAction()
5 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add')
6 /home/---/store2/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
7 /home/---/store2/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
8 /home/---/store2/app/Mage.php(683): Mage_Core_Model_App->run(Array)
9 /home/---/store2/index.php(117): Mage::run('', 'store')
10 {main}

mandoz
  • 21
  • 1
  • 1
  • 4
  • Delete the site cookies in your browser and see if it changes, you may have a session/time-zone issue. – Fiasco Labs Jul 27 '14 at 15:54
  • @FiascoLabs I still have the same issue even when I use the store in a Chrome Incognito window. It appears that as soon as it breaks in one store it breaks in the others as well. Then later they all start working again together for a few minutes until they all break again. Could you please elaborate on the session/time-zone possibility? – mandoz Jul 27 '14 at 21:01
  • @FiascoLabs I have posted an update. – mandoz Jul 27 '14 at 21:17
  • http://stackoverflow.com/a/22630194/3881568 This fixed the problem for me. – mandoz Jul 28 '14 at 12:26

5 Answers5

0

Good thing that it's working anyway. You haven't provided much infromation here and it's hard to guess what it could have been. Check magento and server logs, maybe you'll find your answer there.

Zentoaku
  • 766
  • 4
  • 12
0

It seems to me as it has something to do with the session. If you actually look at function addAction in CartController.php you will see where this error is coming from. So please try to debug, its somethin in the try block in addAction method that is throwing exception. You can var_dump until you see where the code breaks

letsanov
  • 191
  • 12
0

I solved this issue by repairing one table in magento 1.7 repair table sales_flat_quote_item_option;

nimit8989
  • 11
  • 3
0

While my solution would appear to be unique, I figured I'd share my personal solution in case someone comes across a similar scenario. Ultimately, there were some tables missing from the database that my client dropped accidentally. I restored them from a backup and everything worked fine. There are so many reasons for this error that it might be worth checking the number of tables as compared with a recent backup.

Aaron Ratner
  • 111
  • 3
0

This solution worked for me go to

app/code/core/Mage/Checkout/controllers/CartController.php

and find this code and comment it. Your issue will be solved.

public function addAction()
{
    if (!$this->_validateFormKey()) {
         $this->_goBack();
         return;
     }
Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107