PrestaShop:以注册形式更改两个字段的顺序

时间:2016-09-15 15:37:09

标签: smarty prestashop prestashop-1.6

我知道这不是Prestashop论坛,但我不怀疑你有我想要的解决方案。 我想在Prestashop 1.6中更改注册表单中两个字段的顺序。我也想隐藏一些不必要的东西,但我已经设法自己做了。

我要移动的字段是增值税字段(瑞典语妈妈),如附图所示:

因为只有在填写公司字段时此字段才可见,所以我不敢触摸它。

您可以在此图片上看到的字段 MOMS field should go before web address field

我认为要改变的代码来到这里

            <h3 class="page-subheading">{l s='Your company information'}    </h3>
            <p class="form-group">
                <label for="">{l s='Company'}</label>
                <input type="text" class="form-control" id="company"     name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}    {/if}" />
            </p>

            <p class="form-group">
                <label for="website">{l s='Website'}</label>
                <input type="text" class="form-control" id="website"     name="website" value="{if isset($smarty.post.website)}{$smarty.post.website}    {/if}" />
            </p>
        </div>
    {/if}
    {if isset($PS_REGISTRATION_PROCESS_TYPE) &&     $PS_REGISTRATION_PROCESS_TYPE}
        <div class="account_creation">
            <h3 class="page-subheading">{l s='Your address'}</h3>
            {foreach from=$dlv_all_fields item=field_name}
                {if $field_name eq "company"}
                    {if !$b2b_enable}
                        <p class="form-group">
                            <label for="company">{l s='Company'}{if     in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
                            <input type="text" class="form-control"     id="company" name="company" value="{if isset($smarty.post.company)}    {$smarty.post.company}{/if}" />
                        </p>
                    {/if}
                {elseif $field_name eq "vat_number"}
                    <div id="vat_number" style="display:none;">
                        <p class="form-group">
                            <label for="vat_number">{l s='VAT number'}{if     in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
                            <input type="text" class="form-control"     id="vat_number" name="vat_number" value="{if isset($smarty.post.vat_number)}    {$smarty.post.vat_number}{/if}" />
                        </p>
                    </div>
                {elseif $field_name eq "firstname"}
                    <p class="required form-group">

                        <input type="hidden" class="form-control"     id="firstname" name="firstname" value="{if isset($smarty.post.firstname)}    {$smarty.post.firstname}{/if}" />
                    </p>
                {elseif $field_name eq "lastname"}
                    <p class="required form-group">

                        <input type="hidden" class="form-control"     id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}    {$smarty.post.lastname}{/if}" />
                    </p>

1 个答案:

答案 0 :(得分:0)

您必须将此字段移至上一部分:

            <h3 class="page-subheading">{l s='Your company information'}    </h3>
            <p class="form-group">
                <label for="">{l s='Company'}</label>
                <input type="text" class="form-control" id="company"     name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}    {/if}" />
            </p>

            <p class="form-group">
                <label for="website">{l s='Website'}</label>
                <input type="text" class="form-control" id="website"     name="website" value="{if isset($smarty.post.website)}{$smarty.post.website}    {/if}" />
            </p>
            {foreach from=$dlv_all_fields item=field_name}
                {if $field_name eq "vat_number"}
                    <div id="vat_number" style="display:none;">
                        <p class="form-group">
                            <label for="vat_number">{l s='VAT number'}{if     in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
                            <input type="text" class="form-control"     id="vat_number" name="vat_number" value="{if isset($smarty.post.vat_number)}    {$smarty.post.vat_number}{/if}" />
                        </p>
                    </div>
                {/if}
            {/foreach}
        </div>
    {/if}
    {if isset($PS_REGISTRATION_PROCESS_TYPE) &&     $PS_REGISTRATION_PROCESS_TYPE}
        <div class="account_creation">
            <h3 class="page-subheading">{l s='Your address'}</h3>
            {foreach from=$dlv_all_fields item=field_name}
                {if $field_name eq "company"}
                    {if !$b2b_enable}
                        <p class="form-group">
                            <label for="company">{l s='Company'}{if     in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
                            <input type="text" class="form-control"     id="company" name="company" value="{if isset($smarty.post.company)}    {$smarty.post.company}{/if}" />
                        </p>
                    {/if}                   
                {elseif $field_name eq "firstname"}
                    <p class="required form-group">

                        <input type="hidden" class="form-control"     id="firstname" name="firstname" value="{if isset($smarty.post.firstname)}    {$smarty.post.firstname}{/if}" />
                    </p>
                {elseif $field_name eq "lastname"}
                    <p class="required form-group">

                        <input type="hidden" class="form-control"     id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}    {$smarty.post.lastname}{/if}" />
                    </p>