在Magento,爱尔兰不需要邮政编码

时间:2013-04-25 13:57:09

标签: magento

我的Magento 1.7.0.0安装在我的服务器上。我正面临关于可选邮政编码国家的问题。我的意思是我想为爱尔兰选择邮政/邮政编码,为此我在管理面板的可选国家/地区中选择了爱尔兰(系统>配置>常规)。但是当我访问结帐页面并选择爱尔兰时,它会从邮编/邮政编码字段中删除一个星号,但是当我点击继续时,它会显示一个警告框(“邮编/邮政编码是必需的值”)。为什么呢?
请帮我!提前谢谢......

2 个答案:

答案 0 :(得分:0)

我认为是因为邮政编码输入有html类必需条目如果您编辑模板并退出类js将不检查该输入并且不会触发警报。但请记住只使用条件或其他东西来退出爱尔兰这个类。

答案 1 :(得分:0)

短期解决方案

将此添加到您的.document(ready)。请注意,*country_id等需要billing[country_id]

function require_postcode_check(){
    jQuery('select[name*=country_id]').each(function(){
        jQuery(this).closest('form').find('input[name*=postcode]').toggleClass('required-entry', jQuery(this).val() != 'IE');
    });
}
require_postcode_check(); // execute on document ready
jQuery('select[name*=country_id]').on('change', function(){
    require_postcode_check(); // execute on country change
});

长期解决方案

长期解决方案是为每个<option>提供一个需要邮政编码的课程:

<option value="UK" class="postcode-required">United Kingdom</option>
<option value="IE" class="">Ireland</option>

然后,如果更改了<select>,请检查所选的选项hasClass('postcode-required')

相关问题