I have two store views which share the same product category and on one of them I want to disable PayPal Express Checkout.
This cant be done in the back-end without disabling it for both store views.
What I have tried so far is:
config.xml in app/code/local/Bh/ZeroSubtotalpaymentmethod/etc
<?xml version="1.0" ?>
<config>
<modules>
<Bh_ZeroSubtotalpaymentmethod>
<version>1.0.1</version>
</Bh_ZeroSubtotalpaymentmethod>
</modules>
<global>
<models>
<zerosubtotalpaymentmethod>
<class>Bh_ZeroSubtotalpaymentmethod_Model</class>
</zerosubtotalpaymentmethod>
</models>
</global>
<frontend>
<events>
<payment_method_is_active>
<observers>
<paymentfilter_payment_method_is_active>
<type>singleton</type>
<class>zerosubtotalpaymentmethod/observer</class>
<method>filterpaymentmethod</method>
</paymentfilter_payment_method_is_active>
</observers>
</payment_method_is_active>
</events>
</frontend>
</config>
Observer.php in app/code/local/Bh/ZeroSubtotalpaymentmethod/Model
class Bh_ZeroSubtotalpaymentmethod_Model_Observer {
public function filterpaymentmethod(Varien_Event_Observer $observer) {
/* call get payment method */
$method = $observer->getEvent()->getMethodInstance();
if($method->getCode()=='paypal_express_checkout')
{ $quote = $observer->getEvent()->getQuote();
if(Mage::app()->getStore()->getCode()=='wa'){
$result = $observer->getEvent()->getResult();
$result->isAvailable = false;
}
return;
}
return;
}
}
I am not sure exactly what the $method->getCode()
is. does this code look right for what I want to do?