具有注册页面的Opencart-2.1.0.2自定义字段排序顺序问题

时间:2016-02-19 13:19:37

标签: opencart2.x

我已安装开放式购物车版本2.1.0.2

我在管理员部分添加了一个名为电话号码的自定义字段,并将sort-order 6分配给此字段。

当我检查注册页面时,我无法看到此字段,但是当我更改sort order to 5 or 7时,此字段可见。我不确定为什么对于排序顺序6,此字段不会在注册页面上显示。

1 个答案:

答案 0 :(得分:0)

在注册字段中,sort order in custom filed

的javascript中缺少一个条件

条件:当data-sort等于form-group lenght

使用register.tpl文件中的以下内容更新您的代码。 line no arround 533。

<script type="text/javascript"><!--
// Sort the custom fields
    $('#account .form-group[data-sort]').detach().each(function() {
        if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#account .form-group').length) {
            $('#account .form-group').eq($(this).attr('data-sort')).before(this);
        }

        if ($(this).attr('data-sort') > $('#account .form-group').length) {
            $('#account .form-group:last').after(this);
        }

        if ($(this).attr('data-sort') == $('#account .form-group').length) {
            $('#account .form-group:last').after(this);
        }

        if ($(this).attr('data-sort') < -$('#account .form-group').length) {
            $('#account .form-group:first').before(this);
        }
    });

    $('#address .form-group[data-sort]').detach().each(function() {
        if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#address .form-group').length) {
            $('#address .form-group').eq($(this).attr('data-sort')).before(this);
        }

        if ($(this).attr('data-sort') > $('#address .form-group').length) {
            $('#address .form-group:last').after(this);
        }

        if ($(this).attr('data-sort') == $('#address .form-group').length) {
            $('#address .form-group:last').after(this);
        }

        if ($(this).attr('data-sort') < -$('#address .form-group').length) {
            $('#address .form-group:first').before(this);
        }
    });
</script>