After cart reload you should again assign discountForm
var, because your form is lost and new form is rendered (I assume because don't know, you wrote "complete reload cart"). And then attach submit function again.
discountForm = new VarienForm('discount-coupon-form');
discountForm.submit = function (isRemove) {
if (isRemove) {
$('coupon_code').removeClassName('required-entry');
$('remove-coupone').value = "1";
} else {
$('coupon_code').addClassName('required-entry');
$('remove-coupone').value = "0";
}
return VarienForm.prototype.submit.bind(discountForm)();
}
Add it to your reload function (ajax callback function?).
Of course don't duplicate the code, first define var discountForm;
as empty and then extract above snippet as a function and call it on body load and on ajax load.
Looks like your admin route declaration is incorrect. Try this:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<TwilitGrotto_AutoCustomerLookup after="Mage_Adminhtml">TwilitGrotto_AutoCustomerLookup</TwilitGrotto_AutoCustomerLookup>
</modules>
</args>
</adminhtml>
</routers>
</admin>
Here is a good article on the topic: Magento Admin Hello World Revisited
EDIT:
I'm posting a working solution below:
File: TwilitGrotto\AutoCustomerLookup\etc\adminhtml.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<sales>
<children>
<twilitgrotto_autocustomerlookup translate="title" module="twilitgrotto_autocustomerlookup">
<title>Auto Customer Lookup</title>
</twilitgrotto_autocustomerlookup>
</children>
</sales>
</children>
</admin>
</resources>
</acl>
</config>
File: TwilitGrotto\AutoCustomerLookup\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<TwilitGrotto_AutoCustomerLookup>
<version>1.0.0.0</version>
</TwilitGrotto_AutoCustomerLookup>
</modules>
<global>
<helpers>
<twilitgrotto_autocustomerlookup>
<class>TwilitGrotto_AutoCustomerLookup_Helper</class>
</twilitgrotto_autocustomerlookup>
</helpers>
</global>
<adminhtml>
<layout>
<updates>
<twilitgrotto>
<file>twilitgrotto_autocustomerlookup_layout.xml</file>
</twilitgrotto>
</updates>
</layout>
</adminhtml>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<TwilitGrotto_AutoCustomerLookup after="Mage_Adminhtml">TwilitGrotto_AutoCustomerLookup_Adminhtml</TwilitGrotto_AutoCustomerLookup>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
File: TwilitGrotto\AutoCustomerLookup\controllers\Adminhtml\Autocustomerlookup\AddressController.php
<?php
class TwilitGrotto_AutoCustomerLookup_Adminhtml_Autocustomerlookup_AddressController
extends Mage_Adminhtml_Controller_Action
{
public function checkEmailExistsAction()
{
$emailAddress = $this->getRequest()->getParam('emailAddress');
$result = Mage::helper('twilitgrotto_autocustomerlookup')->checkEmailExists($emailAddress);
$this->getResponse()->setBody($result);
}
protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('sales/twilitgrotto_autocustomerlookup');
}
}
Controller URL: Mage::getUrl('adminhtml/autocustomerlookup_address/checkEmailExists');
Best Answer
I used the below Code & its Done