X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Change order of address fields (https://forum.x-cart.com/showthread.php?t=78295)

bionuts 09-13-2021 01:58 AM

Change order of address fields
 
2 Attachment(s)
Hi all,

We currently have X-Cart 5 installed on four of our websites, each one using a different theme.

On one of the themes, when looking at the Checkout page, the Email address field is at the top of the list whereas on the other three themes it is at the bottom. (see attached images)

I would prefer to have the email field at the top of the list for all of the themes, but as it is not in the list of fields for Cart & Checkout > Address Fields I'm not sure how to do this.

I've tried to find the differences in the files between the themes but haven't been able to. Can anyone point me in the right direction here?

Thanks as ever for your help.

Ed B. 09-26-2021 01:35 AM

Re: Change order of address fields
 
Hi, a quick glance at the codes suggest that the output comes from


../../../skins/customer/checkout/steps/shipping/parts/address.shipping.twig


which looks like
Code:

{##
 # Checkout shipping address form
 #}

{% form '\\XLite\\View\\Form\\Checkout\\UpdateProfile' with {className: 'addr
ess shipping-address'} %}
  <ul class="form shipping-address-form">
    {% for fieldName, fieldData in this.getAddressSchemaFields() %}
      <li class="item-{{ fieldName }} {{ fieldData.additionalClass }} clearfi
x">
        {{ this.displayCommentedData(this.getFieldCommentedData(fieldData)) }
}
        {{ fieldData.widget.display() }}
        {{ widget_list('checkout.shipping.address.' ~ fieldName, address=this
.getAddressInfo(), fieldName=fieldName, fieldData=fieldData) }}
      </li>
    {% endfor %}
    {{ widget_list('checkout.shipping.address', address=this.getAddressInfo()
) }}
  </ul>
{% endform %}



Unfortunately I have been unable to figure out where the widget list checkout.shipping.address is defined. But with a little luck, you an maybe get away just by making sure the array this.getAddressSchemaFields() (which is defined in the view class View/Checkout/AAddressBlock.php) isn't sorted in the theme that outputs address fields in a wrong order.

bionuts 10-04-2021 05:15 AM

Re: Change order of address fields
 
Hi,

Thanks for your reply.

I haven't been able to find any code differences between the themes that do this how I want and the ones that don't, so I'm a bit lost. I haven't really got my head round the way that 5 does things compared to 4, where I think I would have been able to achieve this relatively easily.

Guess I'll just have to live with it for now, until I manage to get some time to really learn 5 properly.


All times are GMT -8. The time now is 12:30 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.