我想你可以用observer.首先,你必须创建一个模块(我假设你已经知道如何创建模块)
在你config.xml的app>code>your_codepol>Namespace>module>etc>config.xml
<frontend>
<events>
<payment_method_is_active>
<observers>
<paymentfilter_payment_method_is_active>
<type>singleton</type>
<class>YOUR_CLASS_observer</class>
<method>paymentMethodIsActive</method>
</paymentfilter_payment_method_is_active>
</observers>
</payment_method_is_active>
</events>
</frontend>
Run Code Online (Sandbox Code Playgroud)
并创建您的观察者并在您的代码中编写此代码 observer.php
public function paymentMethodIsActive(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$method = $event->getMethodInstance();
$result = $event->getResult();
$quote = $observer->getEvent()->getQuote();
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
if($shippingMethod=="Free International Shipping"){
if($method->getCode() == 'cashondelivery' ){ // to hide this method
$result->isAvailable = false; // false means payment method is disable
}
}
Run Code Online (Sandbox Code Playgroud)
}
cashondelivery付款方式名称在哪里.您可以写任何付款名称,如
如果您有任何疑问,请告诉我
| 归档时间: |
|
| 查看次数: |
3213 次 |
| 最近记录: |