Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Friday, June 28, 2013

Magento: Form key in backend

Sometime you try to catch the submit url to handle your request in backend.
E.g. http://localhost/Magento/admin/assign_theme/approve/id/10
You look at the controller and find you have already declare the delete action as
1
2
3
4
5
6
7
class Pamysoft_AssignTheme_IndexController
{
    public function approve()
    {
         echo 'The approving processing should go here!'; exit;
    }
}
Solution:
Add the hidden input form_key to make your form submit correctly
1
2
3
$formKey = Mage::getSingleton('core/session')->getFormKey();
 
<input type="hidden" name="form_key" value="<?php echo $formKey; ?>" />;

No comments:

Post a Comment