J
J
Jan Sokolikovyan2019-05-08 15:04:15
Magento
Jan Sokolikovyan, 2019-05-08 15:04:15

How to split the address field into street, house, building, apartment (office number)?

The task is to split the address field into components (street, house, building, apartment (office number)) in the standard checkout form (placement order), so that each field is a separate input. Before that, I had no business with Magento, from the word "absolutely".
Please point in the right direction on what and, most importantly, how to register and redefine a new component, or you can change the current one, thanks in advance!
5cd2c55ce58d4146152502.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
imdeveloper, 2019-05-08
@link_web

You need to create a layout processor. This class will contain a large array with all the inputs and their attributes. You can put a breakpoint in xdebug in the layout processor class you create, on the js layout variable, and overwrite the values ​​of the array keys accordingly. For example here

$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
        ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['company']
        ['config']['elementTmpl'] = 'Vendor_Checkout/inputs/company';

I changed the html template for the company field.
all information on the topic here:
https://devdocs.magento.com/guides/v2.3/howdoi/che...
https://devdocs.magento.com/guides/v2.3/howdoi/che...
for more info google : magento 2 checkout layout processor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question