- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
'Invalid Form Key. ' when trying to save editing product from admin
I google and only find it's to do with
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
and I have tried a couple of solutions but still can't get the one which works for me...
Magento Community Edition V1.7.0.2
Any idea/suggestion?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
Do you have any custom extension which has a field which affects Admin product page? If so disable it and try again.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
first thing first, open product editing page and view source, find if there is
<input name="form_key" type="hidden" value=".....
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
No, it deosn't have any cases in \app\design\adminhtml\default\default\template\catalog\product directory files.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
I mean check the html code in browser in source view.
in template, its added like this
<?php echo $this->getBlockHtml('formkey')?>
we need to first make sure its there in the html, then figure out why its not sent to server or why the value is incorrect.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
Yes, in the source code, it does have
<input name="form_key" type="hidden" value="......." />
and I belive it comes from this code:
app/design/adminhtml/default/template/formkey.phtml
<div><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /></div>
which seems correct.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
in Mage_Core_Controller_Varien_Action::_validateFormKey
var_dump($this->getRequest()->getParam('form_key', null), Mage::getSingleton('core/session')->getFormKey());
if they contain different hash value, then your core/ession is not holding generated form key,
if the first is empty, then your form key is not sent back,
if the first is some non-hash string, then your form key is overided by some other filed.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
Yes, indeed. The first value
$this->getRequest()->getParam('form_key')
is NULL.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
make sure its in the form element, or there isn't another form_key field with empty value
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: 'Invalid Form Key. ' when trying to save editing product from admin
Do you mean, i should replace all
$this->getRequest()->getParam('form_key')
on the site with
Mage::getSingleton('core/session')->getFormKey()
?