My module is about filtering Payment Method when customer selects one of the shipping methods. Namespace: Insync
Module-Name: Paymentfilter
Config.xml (app/code/local/Insync/Paymentfilter/etc) :
<?xml version="1.0"?>
<config>
<modules>
<Insync_Paymentfilter>
<version>1.0</version>
</Insync_Paymentfilter>
</modules>
<frontend>
<events>
<payment_method_is_active>
<observers>
<paymentfilter_payment_method_is_active>
<type>singleton</type>
<class>Insync_Paymentfilter_Model_Observer</class>
<method>paymentMethodIsActive</method>
</paymentfilter_payment_method_is_active>
</observers>
</payment_method_is_active>
</events>
</frontend>
</config>
Observer.php (app/code/local/Insync/Paymentfilter/Model) :
class Insync_Paymentfilter_Model_Observer {
public function paymentMethodIsActive(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$method = $event->getMethodInstance();
$result = $event->getResult();
$carriers = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
if ($carriers == 'tablerate' ){
if($method->getCode() == 'checkmo' OR $method->getCode() == 'ccsave'){
$result->isAvailable = true;
}else{
$result->isAvailable = false;
}
}
}
}
Insync_Paymentfilter.xml (app/etc/modules)
<?xml version="1.0"?>
<config>
<modules>
<Insync_Paymentfilter>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Insync_Paymentfilter>
</modules>
</config>
The purpose of module is when customer selects 'tablerate' as shipping method he would be ONLY given two Payment Methods i.e
Check/Money Order (checkmo)
and
Credit Card (ccsave)
app/etc/modules/Insync_Paymentfilter.xml? Did you clear the cache? – Marius Sep 04 '15 at 11:50app/etc/modulesis not there or is not readable or is not valid, or if the cache is not cleared. Theconfig.xmlcan be completely screwed up. If the declaration fileapp/etc/modulesis there and is valid and is readable the rest of the module is not important. It should show up in the advanced section. – Marius Sep 04 '15 at 12:01