如何为城市添加免费送货?

时间:2013-08-02 08:05:30

标签: magento magento-1.7

我为购物车创建了一条规则,为某个地区/州提供免费送货服务。问题是我只需要一个城市免费送货。

在这里,我有下一个属性航运邮政编码,航运区域,航运州/省,航运国家。

我如何添加航运城?

1 个答案:

答案 0 :(得分:1)

找到答案:

使用一些本地模块重写/app/code/core/Mage/SalesRule/Model/Rule/Condition/Address.php文件并更改这些行

public function loadAttributeOptions()
{
$attributes = array(
    'base_subtotal' => Mage::helper('salesrule')->__('Subtotal'),
    'total_qty' => Mage::helper('salesrule')->__('Total Items Quantity'),
    'weight' => Mage::helper('salesrule')->__('Total Weight'),
    'payment_method' => Mage::helper('salesrule')->__('Payment Method'),
    'shipping_method' => Mage::helper('salesrule')->__('Shipping Method'),
    'postcode' => Mage::helper('salesrule')->__('Shipping Postcode'),
    'region' => Mage::helper('salesrule')->__('Shipping Region'),
    'region_id' => Mage::helper('salesrule')->__('Shipping State/Province'),
    'country_id' => Mage::helper('salesrule')->__('Shipping Country'),
);
$this->setAttributeOption($attributes);
return $this;
} 

public function loadAttributeOptions()
{
    $attributes = array(
        'base_subtotal' => Mage::helper('salesrule')->__('Subtotal'),
        'total_qty' => Mage::helper('salesrule')->__('Total Items Quantity'),
        'weight' => Mage::helper('salesrule')->__('Total Weight'),
        'payment_method' => Mage::helper('salesrule')->__('Payment Method'),
        'shipping_method' => Mage::helper('salesrule')->__('Shipping Method'),
        'postcode' => Mage::helper('salesrule')->__('Shipping Postcode'),
        'region' => Mage::helper('salesrule')->__('Shipping Region'),
        'region_id' => Mage::helper('salesrule')->__('Shipping State/Province'),
        'country_id' => Mage::helper('salesrule')->__('Shipping Country'),
        'city' => Mage::helper('salesrule')->__('Shipping City'),
    );
    $this->setAttributeOption($attributes);
    return $this;
}