货到付款付款方式应仅对 magento 中的某些邮政编码 codes/pin 可见

Cash on delivery payment method should visible only for some zip codes/pin codes in magento

我们在 magento 1.9.0 版本

中使用"Cash On Delivery"付款方式

我们仅支持部分 zip/pin 个代码位置的货到付款。

表示我们仅接受来自某些邮政编码 [表示位置] 的现金。

在 "shipping address" 中的 "checkout" 下,客户将键入 his/her "zip code" .

使用我们必须验证的邮政编码。

意味着如果我们将产品交付到该邮政编码,那么 "COD" 付款方式应该在 "payment method"

下可见

否则 "COD" 应该不可见。

以上问题如有不明之处,请参考以下link:

How to restrict default COD in magento to certain zip codes only?

这就是问题。

任何人都可以详细解释上述解决方案....

也在下面link :

有一个选项可以输入受限制的邮政编码列表。但我们需要一个允许的邮政编码列表的解决方案。

您只需编辑文件 /app/code/core/Mage/Payment/Model/Method/Cashondelivery.php

在这里你会得到答案:

public function isAvailable($quote = null)
{
    if ($quote) {

        // Here is the list of restricted Zip Codes
        $restrictedZips = array(
            '85001',
            '87965'
        );

        $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
        $customerZip = $address->getPostcode();

        if (in_array($customerZip, $restrictedZips)) {
            return false;
        }
    }

    return parent::isAvailable($quote);
}

这里是基于邮政编码的现金交货限制的免费扩展

http://www.magentocommerce.com/magento-connect/cashondelivery-based-on-zipcode.html