vendor/shopware/storefront/Resources/views/storefront/component/address/address-form.html.twig line 1

Open in your IDE?
  1. {% block component_address_form %}
  2.     {% block component_address_form_addressId %}
  3.         {% if data.get('id') %}
  4.             <input type="hidden"
  5.                    name="{{ prefix }}[id]"
  6.                    value="{{ data.get('id') }}">
  7.         {% endif %}
  8.     {% endblock %}
  9.     {# @deprecated tag:v6.5.0 - will be removed #}
  10.     {% if not feature('FEATURE_NEXT_15957') %}
  11.         {% set showVatIdField = false %}
  12.     {% endif %}
  13.     {% block component_address_form_company %}
  14.         {% if showFormCompany %}
  15.             {% if config('core.loginRegistration.showAccountTypeSelection') %}
  16.                 {% set accountTypeRequired = true %}
  17.             {% endif %}
  18.             {% if config('core.loginRegistration.showAccountTypeSelection') or prefix == "address" or prefix == "shippingAddress" or hasSelectedBusiness %}
  19.                 <div class="{% if prefix == "shippingAddress" or hasSelectedBusiness %}address-contact-type-company{% elseif prefix == "address" %}js-field-toggle-contact-type-company d-block{% else %}js-field-toggle-contact-type-company d-none{% endif %}">
  20.                     {% block component_address_form_company_fields %}
  21.                         <div class="{{ formRowClass }}">
  22.                             {% block component_address_form_company_name %}
  23.                                 <div class="form-group col-6">
  24.                                     {% if formViolations.getViolations("/company") is not empty %}
  25.                                         {% set violationPath = "/company" %}
  26.                                     {% elseif formViolations.getViolations("/#{prefix}/company") is not empty %}
  27.                                         {% set violationPath = "/#{prefix}/company" %}
  28.                                     {% endif %}
  29.                                     {% block component_address_form_company_name_label %}
  30.                                         <label class="form-label"
  31.                                                for="{{ idPrefix ~ prefix }}company">
  32.                                             {{ "address.companyNameLabel"|trans|sw_sanitize }}{% if prefix != "shippingAddress" and accountTypeRequired %}{{ "general.required"|trans|sw_sanitize }}{% endif %}
  33.                                         </label>
  34.                                     {% endblock %}
  35.                                     {% block component_address_form_company_name_input %}
  36.                                         <input type="text"
  37.                                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  38.                                                id="{{ idPrefix ~ prefix }}company"
  39.                                                placeholder="{{ "address.companyNamePlaceholder"|trans|striptags }}"
  40.                                                name="{{ prefix }}[company]"
  41.                                                value="{{ data.get('company') }}"
  42.                                                {% if prefix != "shippingAddress" and accountTypeRequired %}required="required"{% endif %}>
  43.                                     {% endblock %}
  44.                                     {% block component_address_form_company_name_input_error %}
  45.                                         {% if violationPath %}
  46.                                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  47.                                         {% endif %}
  48.                                     {% endblock %}
  49.                                 </div>
  50.                             {% endblock %}
  51.                             {% block component_address_form_company_department %}
  52.                                 <div class="form-group col-md-6">
  53.                                     {% if formViolations.getViolations("/department") is not empty %}
  54.                                         {% set violationPath = "/department" %}
  55.                                     {% elseif formViolations.getViolations("/#{prefix}/department") is not empty %}
  56.                                         {% set violationPath = "/#{prefix}/department" %}
  57.                                     {% endif %}
  58.                                     {% block component_address_form_company_department_label %}
  59.                                         <label class="form-label"
  60.                                                for="{{ idPrefix ~ prefix }}department">
  61.                                             {{ "address.companyDepartmentLabel"|trans|sw_sanitize }}
  62.                                         </label>
  63.                                     {% endblock %}
  64.                                     {% block component_address_form_company_department_input %}
  65.                                         <input type="text"
  66.                                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  67.                                                id="{{ idPrefix ~ prefix }}department"
  68.                                                placeholder="{{ "address.companyDepartmentPlaceholder"|trans|striptags }}"
  69.                                                name="{{ prefix }}[department]"
  70.                                                value="{{ data.get('department') }}">
  71.                                     {% endblock %}
  72.                                     {% block component_address_form_company_department_input_error %}
  73.                                         {% if violationPath %}
  74.                                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  75.                                         {% endif %}
  76.                                     {% endblock %}
  77.                                 </div>
  78.                             {% endblock %}
  79.                             {% block component_address_form_company_vatId %}
  80.                                 {% if not feature('FEATURE_NEXT_15957') and showVatIdField %}
  81.                                     <div class="form-group col-md-6">
  82.                                         {% if formViolations.getViolations("/vatId") is not empty %}
  83.                                             {% set violationPath = "/vatId" %}
  84.                                         {% elseif formViolations.getViolations("/#{prefix}/vatId") is not empty %}
  85.                                             {% set violationPath = "/#{prefix}/vatId" %}
  86.                                         {% endif %}
  87.                                         {# @deprecated tag:v6.5.0 - will be removed, look into `@Storefront/storefront/component/address/address-personal-vat-id.html.twig` instead #}
  88.                                         {% block component_address_form_company_vatId_label %}
  89.                                             <label class="form-label"
  90.                                                    for="{{ idPrefix ~ prefix }}vatId">
  91.                                                 {{ "address.companyVatLabel"|trans|sw_sanitize }}
  92.                                             </label>
  93.                                         {% endblock %}
  94.                                         {# @deprecated tag:v6.5.0 - will be removed, look into `@Storefront/storefront/component/address/address-personal-vat-id.html.twig` instead #}
  95.                                         {% block component_address_form_company_vatId_input %}
  96.                                             <input type="text"
  97.                                                    class="form-control{% if violationPath %} is-invalid{% endif %}"
  98.                                                    id="{{ idPrefix ~ prefix }}vatId"
  99.                                                    placeholder="{{ "address.companyVatPlaceholder"|trans|striptags }}"
  100.                                                    name="{{ prefix }}[vatId]"
  101.                                                    value="{{ data.get('vatId') }}">
  102.                                         {% endblock %}
  103.                                         {# @deprecated tag:v6.5.0 - will be removed, look into `@Storefront/storefront/component/address/address-personal-vat-id.html.twig` instead #}
  104.                                         {% block component_address_form_company_vatId_input_error %}
  105.                                             {% if violationPath %}
  106.                                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  107.                                             {% endif %}
  108.                                         {% endblock %}
  109.                                     </div>
  110.                                 {% elseif feature('FEATURE_NEXT_15957') and prefix == 'address' and showVatIdField %}
  111.                                     <div class="form-group col-md-6">
  112.                                         {% sw_include '@Storefront/storefront/component/address/address-personal-vat-id.html.twig' with {
  113.                                             'vatIds': context.customer.vatIds
  114.                                         } %}
  115.                                     </div>
  116.                                 {% endif %}
  117.                             {% endblock %}
  118.                         </div>
  119.                     {% endblock %}
  120.                 </div>
  121.             {% endif %}
  122.         {% endif %}
  123.     {% endblock %}
  124.     {% block component_address_form_address_fields %}
  125.         <div class="{{ formRowClass }}">
  126.             {% block component_address_form_street %}
  127.                 <div class="form-group col-md-6">
  128.                     {% if formViolations.getViolations("/street") is not empty %}
  129.                         {% set violationPath = "/street" %}
  130.                     {% elseif formViolations.getViolations("/#{prefix}/street") is not empty %}
  131.                         {% set violationPath = "/#{prefix}/street" %}
  132.                     {% else %}
  133.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.streetLabel"|trans|sw_sanitize }) %}
  134.                     {% endif %}
  135.                     {% block component_address_form_street_label %}
  136.                         <label class="form-label"
  137.                                for="{{ idPrefix ~ prefix }}AddressStreet">
  138.                             {{ "address.streetLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  139.                         </label>
  140.                     {% endblock %}
  141.                     {% block component_address_form_street_input %}
  142.                         <input type="text"
  143.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  144.                                id="{{ idPrefix ~ prefix }}AddressStreet"
  145.                                placeholder="{{ "address.streetPlaceholder"|trans|striptags }}"
  146.                                name="{{ prefix }}[street]"
  147.                                value="{{ data.get('street') }}"
  148.                                data-form-validation-required
  149.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  150.                                required="required">
  151.                     {% endblock %}
  152.                     {% block component_address_form_street_input_error %}
  153.                         {% if violationPath %}
  154.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  155.                         {% endif %}
  156.                     {% endblock %}
  157.                 </div>
  158.             {% endblock %}
  159.             {% block component_address_form_zipcode_city %}
  160.                 {% set zipcodeField %}
  161.                 {% set zipcodeValue = formViolations.getInputData()['zipcode'] ?? data.get('zipcode') %}
  162.                     {% if formViolations.getViolations("/zipcode") is not empty %}
  163.                         {% set violationPath = "/zipcode" %}
  164.                     {% elseif formViolations.getViolations("/#{prefix}/zipcode") is not empty %}
  165.                         {% set violationPath = "/#{prefix}/zipcode" %}
  166.                     {% else %}
  167.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.zipcodeLabel"|trans|sw_sanitize }) %}
  168.                     {% endif %}
  169.                     {% block component_address_form_zipcode_label %}
  170.                         <label class="form-label"
  171.                                for="{{ idPrefix ~ prefix }}AddressZipcode">
  172.                             {{ "address.zipcodeLabel"|trans|sw_sanitize }}<span {% if feature('v6.5.0.0') %}class="d-none"{% endif %} id="zipcodeLabel">{{ "general.required"|trans|sw_sanitize }}</span>
  173.                         </label>
  174.                     {% endblock %}
  175.                     {% block component_address_form_zipcode_input %}
  176.                         <input type="text"
  177.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  178.                                id="{{ idPrefix ~ prefix }}AddressZipcode"
  179.                                placeholder="{{ "address.zipcodePlaceholder"|trans|striptags }}"
  180.                                name="{{ prefix }}[zipcode]"
  181.                                value="{{ zipcodeValue }}"
  182.                                data-input-name="zipcodeInput"
  183.                                {% if not feature('v6.5.0.0') %}required="required"{% endif %}
  184.                         >
  185.                     {% endblock %}
  186.                     {% block component_address_form_zipcode_error %}
  187.                         {% if violationPath %}
  188.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  189.                         {% endif %}
  190.                     {% endblock %}
  191.                 {% endset %}
  192.                 {% set cityField %}
  193.                     {% if formViolations.getViolations("/city") is not empty %}
  194.                         {% set violationPath = "/city" %}
  195.                     {% elseif formViolations.getViolations("/#{prefix}/city") is not empty %}
  196.                         {% set violationPath = "/#{prefix}/city" %}
  197.                     {% else %}
  198.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.cityLabel"|trans|sw_sanitize }) %}
  199.                         {% set violationPath = null %}
  200.                     {% endif %}
  201.                     {% block component_address_form_city_label %}
  202.                         <label class="form-label"
  203.                                for="{{ idPrefix ~ prefix }}AddressCity">
  204.                             {{ "address.cityLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  205.                         </label>
  206.                     {% endblock %}
  207.                     {% block component_address_form_city_input %}
  208.                         <input type="text"
  209.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  210.                                id="{{ idPrefix ~ prefix }}AddressCity"
  211.                                placeholder="{{ "address.cityPlaceholder"|trans|striptags }}"
  212.                                name="{{ prefix }}[city]"
  213.                                value="{{ data.get('city') }}"
  214.                                data-form-validation-required
  215.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  216.                                required="required">
  217.                     {% endblock %}
  218.                     {% block component_address_form_city_error %}
  219.                         {% if violationPath %}
  220.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  221.                         {% endif %}
  222.                     {% endblock %}
  223.                 {% endset %}
  224.                 {% if config('core.address.showZipcodeInFrontOfCity') %}
  225.                     <div class="form-group col-md-2 col-4">
  226.                         {{ zipcodeField }}
  227.                     </div>
  228.                     <div class="form-group col-md-4 col-8">
  229.                         {{ cityField }}
  230.                     </div>
  231.                 {% else %}
  232.                     <div class="form-group col-md-4 col-8">
  233.                         {{ cityField }}
  234.                     </div>
  235.                     <div class="form-group col-md-2 col-4">
  236.                         {{ zipcodeField }}
  237.                     </div>
  238.                 {% endif %}
  239.             {% endblock %}
  240.             {% block component_address_form_additional_field1 %}
  241.                 {% if config('core.loginRegistration.showAdditionalAddressField1') %}
  242.                     {% if formViolations.getViolations("/additionalAddressLine1") is not empty %}
  243.                         {% set violationPath = "/additionalAddressLine1" %}
  244.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine1") is not empty %}
  245.                         {% set violationPath = "/#{prefix}/additionalAddressLine1" %}
  246.                     {% endif %}
  247.                     <div class="form-group col-md-6">
  248.                         {% block component_address_form_additional_field1_label %}
  249.                             <label class="form-label"
  250.                                    for="{{ idPrefix ~ prefix }}AdditionalField1">
  251.                                 {{ "address.additionalField1Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField1Required') ? "general.required"|trans|sw_sanitize }}
  252.                             </label>
  253.                         {% endblock %}
  254.                         {% block component_address_form_additional_field1_input %}
  255.                             <input type="text"
  256.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  257.                                    id="{{ idPrefix ~ prefix }}AdditionalField1"
  258.                                    placeholder="{{ "address.additionalField1Placeholder"|trans|striptags }}"
  259.                                    name="{{ prefix }}[additionalAddressLine1]"
  260.                                    value="{{ data.get('additionalAddressLine1') }}"
  261.                                     {{ config('core.loginRegistration.additionalAddressField1Required') ? 'required="true"' }}>
  262.                         {% endblock %}
  263.                         {% block component_address_form_additional_field1_error %}
  264.                             {% if violationPath %}
  265.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  266.                             {% endif %}
  267.                         {% endblock %}
  268.                     </div>
  269.                 {% endif %}
  270.             {% endblock %}
  271.             {% block component_address_form_additional_field2 %}
  272.                 {% if config('core.loginRegistration.showAdditionalAddressField2') %}
  273.                     {% if formViolations.getViolations("/additionalAddressLine2") is not empty %}
  274.                         {% set violationPath = "/additionalAddressLine2" %}
  275.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine2") is not empty %}
  276.                         {% set violationPath = "/#{prefix}/additionalAddressLine2" %}
  277.                     {% endif %}
  278.                     <div class="form-group col-md-6">
  279.                         {% block component_address_form_additional_field2_label %}
  280.                             <label class="form-label"
  281.                                    for="{{ idPrefix ~ prefix }}AdditionalField2">
  282.                                 {{ "address.additionalField2Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField2Required') ? "general.required"|trans|sw_sanitize }}
  283.                             </label>
  284.                         {% endblock %}
  285.                         {% block component_address_form_additional_field2_input %}
  286.                             <input type="text"
  287.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  288.                                    id="{{ idPrefix ~ prefix }}AdditionalField2"
  289.                                    placeholder="{{ "address.additionalField2Placeholder"|trans|striptags }}"
  290.                                    name="{{ prefix }}[additionalAddressLine2]"
  291.                                    value="{{ data.get('additionalAddressLine2') }}"
  292.                                     {{ config('core.loginRegistration.additionalAddressField2Required') ? 'required="true"' }}>
  293.                         {% endblock %}
  294.                         {% block component_address_form_additional_field2_error %}
  295.                             {% if violationPath %}
  296.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  297.                             {% endif %}
  298.                         {% endblock %}
  299.                     </div>
  300.                 {% endif %}
  301.             {% endblock %}
  302.         </div>
  303.         <div class="{{ formRowClass }} country-and-state-form-elements" data-country-state-select="true">
  304.             {% block component_address_form_country %}
  305.                 <div class="form-group col-md-6">
  306.                     {% set initialCountryId = null %}
  307.                     {% if data.get('countryId') %}
  308.                         {% set initialCountryId = data.get('countryId') %}
  309.                     {% elseif page.countries|length == 1 %}
  310.                         {% set initialCountryId = (page.countries|first).id %}
  311.                     {% endif %}
  312.                     {% if formViolations.getViolations("/countryId") is not empty %}
  313.                         {% set violationPath = "/countryId" %}
  314.                     {% elseif formViolations.getViolations("/#{prefix}/countryId") is not empty %}
  315.                         {% set violationPath = "/#{prefix}/countryId" %}
  316.                     {% endif %}
  317.                     {% block component_address_form_country_label %}
  318.                         <label class="form-label"
  319.                                for="{{ idPrefix ~ prefix }}AddressCountry">
  320.                             {{ "address.countryLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  321.                         </label>
  322.                     {% endblock %}
  323.                     {% block component_address_form_country_select %}
  324.                         <select class="country-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  325.                                 id="{{ idPrefix ~ prefix }}AddressCountry"
  326.                                 name="{{ prefix }}[countryId]"
  327.                                 required="required"
  328.                                 data-initial-country-id="{{ initialCountryId }}">
  329.                             {% if not initialCountryId %}
  330.                                 <option disabled="disabled"
  331.                                         value=""
  332.                                         selected="selected">
  333.                                     {{ "address.countryPlaceholder"|trans|sw_sanitize }}
  334.                                 </option>
  335.                             {% endif %}
  336.                             {% for country in page.countries %}
  337.                                 <option {% if country.id == initialCountryId %}
  338.                                         selected="selected"
  339.                                         {% endif %}
  340.                                         value="{{ country.id }}"
  341.                                         data-zipcode-required="{{ country.postalCodeRequired }}"
  342.                                         data-vat-id-required="{{ country.vatIdRequired }}"
  343.                                         data-state-required="{{ country.forceStateInRegistration }}"
  344.                                         {% if feature('FEATURE_NEXT_15707') and  not country.shippingAvailable and disableNonShippableCountries %}
  345.                                             disabled="disabled"
  346.                                         {% endif %}>
  347.                                     {{ country.translated.name }}{% if feature('FEATURE_NEXT_15707') and showNoShippingPostfix and not country.shippingAvailable %} {{ "address.countryPostfixNoShipping"|trans|sw_sanitize }}{% endif %}
  348.                                 </option>
  349.                             {% endfor %}
  350.                         </select>
  351.                     {% endblock %}
  352.                 </div>
  353.                 <div class="form-group col-md-6  d-none">
  354.                     {% if formViolations.getViolations("/countryStateId") is not empty %}
  355.                         {% set violationPath = "/countryStateId" %}
  356.                     {% elseif formViolations.getViolations("/#{prefix}/countryStateId") is not empty %}
  357.                         {% set violationPath = "/#{prefix}/countryStateId" %}
  358.                     {% endif %}
  359.                     {% block component_address_form_country_state_label %}
  360.                         <label class="form-label"
  361.                                for="{{ idPrefix ~ prefix }}AddressCountryState">
  362.                             {{ "address.countryStateLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  363.                         </label>
  364.                     {% endblock %}
  365.                     {% block component_address_form_country_state_select %}
  366.                         <select class="country-state-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  367.                                 id="{{ idPrefix ~ prefix }}AddressCountryState"
  368.                                 name="{{ prefix }}[countryStateId]"
  369.                                 data-initial-country-state-id="{{ data.get('countryStateId') }}">
  370.                             <option value=""
  371.                                     selected="selected"
  372.                                     data-placeholder-option="true">
  373.                                 {{ "address.countryStatePlaceholder"|trans|sw_sanitize }}
  374.                             </option>
  375.                         </select>
  376.                     {% endblock %}
  377.                     {% block component_address_form_country_error %}
  378.                         {% if violationPath %}
  379.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  380.                         {% endif %}
  381.                     {% endblock %}
  382.                 </div>
  383.             {% endblock %}
  384.         </div>
  385.         <div class="{{ formRowClass }}">
  386.             {% block component_address_form_phone_number %}
  387.                 {% if config('core.loginRegistration.showPhoneNumberField') %}
  388.                     <div class="form-group col-md-6">
  389.                         {% if formViolations.getViolations("/phoneNumber") is not empty %}
  390.                             {% set violationPath = "/phoneNumber" %}
  391.                         {% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
  392.                             {% set violationPath = "/#{prefix}/phoneNumber" %}
  393.                         {% endif %}
  394.                         {% block component_address_form_phone_number_label %}
  395.                             <label class="form-label"
  396.                                    for="{{ idPrefix ~ prefix }}AddressPhoneNumber">
  397.                                 {{ "address.phoneNumberLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.phoneNumberFieldRequired') ? "general.required"|trans|sw_sanitize }}
  398.                             </label>
  399.                         {% endblock %}
  400.                         {% block component_address_form_phone_number_input %}
  401.                             <input type="text"
  402.                                    class="form-control"
  403.                                    id="{{ idPrefix ~ prefix }}AddressPhoneNumber"
  404.                                    placeholder="{{ "address.phoneNumberPlaceholder"|trans|striptags }}"
  405.                                    name="{{ prefix }}[phoneNumber]"
  406.                                    value="{{ data.get('phoneNumber') }}"
  407.                                 {{ config('core.loginRegistration.phoneNumberFieldRequired') ? 'required="true"' }}>
  408.                         {% endblock %}
  409.                         {% block component_address_form_phone_error %}
  410.                             {% if violationPath %}
  411.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  412.                             {% endif %}
  413.                         {% endblock %}
  414.                     </div>
  415.                 {% endif %}
  416.             {% endblock %}
  417.         </div>
  418.     {% endblock %}
  419. {% endblock %}