If you want to disable a specfic payment method for specfic State then follow these steps.
1.Make a new file in app/etc/module/Arunendra_Disablepayment.xml
copy and Paste below code in that file
<?xml version="1.0"?>
true
local
2.Now make module folder inside app/code/local/Arunendra/Disablepayment
3.Make new folder and file inside app/code/local/Arunendra/Disablepayment/etc/config.xml
and copy and paste below code in that file.
<?xml version="1.0"?>
1.0.1
Arunendra_Disablepayment_Model
singleton
disablepayment/observer
filterpaymentmethod
4.Make new folder and file inside app/code/local/Arunendra/Disablepayment/Model/Observer.php
and copy and paste below code in that file.
<?php
class Arunendra_Disablepayment_Model_Observer {
public function filterpaymentmethod(Varien_Event_Observer $observer) {
/* call get payment method */
$method = $observer->getEvent()->getMethodInstance();
/* you can put your own payment method code here */
if($method->getCode()=='paypal_express'){
$quote = $observer->getEvent()->getQuote();
$shippingAddress = $quote->getShippingAddress();
$RegionId=$shippingAddress->getRegionId();
if($RegionId=='yourregioncode'){
$result = $observer->getEvent()->getResult();
$result->isAvailable = true;
return;
}
else{
$result = $observer->getEvent()->getResult();
$result->isAvailable = false;
}
}
return;
}
}
it's done.!
No comments:
Post a Comment