Created
November 13, 2013 09:09
-
-
Save mklooss/7446005 to your computer and use it in GitHub Desktop.
Magento form_key validation failed in 1.8 after upgrade from 1.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<controller_action_predispatch_checkout_cart_add> | |
<observers> | |
<mymodul_fromkey> | |
<type>singleton</type> | |
<class>mymodul/observer</class> | |
<method>addDisableValidatFromKey</method> | |
</mymodul_fromkey> | |
</observers> | |
</controller_action_predispatch_checkout_cart_add> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyCompany_MyModul_Model_Observer | |
{ | |
/** | |
* | |
* | |
*/ | |
public function addDisableValidatFromKey(Varien_Event_Observer $observer) | |
{ | |
$controller = $observer->getControllerAction(); | |
$formKey = $controller->getRequest()->getParam('form_key', null); | |
if(!is_null($formKey) && $formKey != Mage::getSingleton('core/session')->getFormKey()) | |
{ | |
$controller->getRequest()->setParam('form_key', Mage::getSingleton('core/session')->getFormKey()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment