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.                     {% if formViolations.getViolations("/zipcode") is not empty %}
  162.                         {% set violationPath = "/zipcode" %}
  163.                     {% elseif formViolations.getViolations("/#{prefix}/zipcode") is not empty %}
  164.                         {% set violationPath = "/#{prefix}/zipcode" %}
  165.                     {% else %}
  166.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.zipcodeLabel"|trans|sw_sanitize }) %}
  167.                     {% endif %}
  168.                     {% block component_address_form_zipcode_label %}
  169.                         <label class="form-label"
  170.                                for="{{ idPrefix ~ prefix }}AddressZipcode">
  171.                             {{ "address.zipcodeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  172.                         </label>
  173.                     {% endblock %}
  174.                     {% block component_address_form_zipcode_input %}
  175.                         <input type="text"
  176.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  177.                                id="{{ idPrefix ~ prefix }}AddressZipcode"
  178.                                placeholder="{{ "address.zipcodePlaceholder"|trans|striptags }}"
  179.                                name="{{ prefix }}[zipcode]"
  180.                                value="{{ data.get('zipcode') }}"
  181.                                data-form-validation-required
  182.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  183.                                required="required">
  184.                     {% endblock %}
  185.                     {% block component_address_form_zipcode_error %}
  186.                         {% if violationPath %}
  187.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  188.                         {% endif %}
  189.                     {% endblock %}
  190.                 {% endset %}
  191.                 {% set cityField %}
  192.                     {% if formViolations.getViolations("/city") is not empty %}
  193.                         {% set violationPath = "/city" %}
  194.                     {% elseif formViolations.getViolations("/#{prefix}/city") is not empty %}
  195.                         {% set violationPath = "/#{prefix}/city" %}
  196.                     {% else %}
  197.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.cityLabel"|trans|sw_sanitize }) %}
  198.                         {% set violationPath = null %}
  199.                     {% endif %}
  200.                     {% block component_address_form_city_label %}
  201.                         <label class="form-label"
  202.                                for="{{ idPrefix ~ prefix }}AddressCity">
  203.                             {{ "address.cityLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  204.                         </label>
  205.                     {% endblock %}
  206.                     {% block component_address_form_city_input %}
  207.                         <input type="text"
  208.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  209.                                id="{{ idPrefix ~ prefix }}AddressCity"
  210.                                placeholder="{{ "address.cityPlaceholder"|trans|striptags }}"
  211.                                name="{{ prefix }}[city]"
  212.                                value="{{ data.get('city') }}"
  213.                                data-form-validation-required
  214.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  215.                                required="required">
  216.                     {% endblock %}
  217.                     {% block component_address_form_city_error %}
  218.                         {% if violationPath %}
  219.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  220.                         {% endif %}
  221.                     {% endblock %}
  222.                 {% endset %}
  223.                 {% if config('core.address.showZipcodeInFrontOfCity') %}
  224.                     <div class="form-group col-md-2 col-4">
  225.                         {{ zipcodeField }}
  226.                     </div>
  227.                     <div class="form-group col-md-4 col-8">
  228.                         {{ cityField }}
  229.                     </div>
  230.                 {% else %}
  231.                     <div class="form-group col-md-4 col-8">
  232.                         {{ cityField }}
  233.                     </div>
  234.                     <div class="form-group col-md-2 col-4">
  235.                         {{ zipcodeField }}
  236.                     </div>
  237.                 {% endif %}
  238.             {% endblock %}
  239.             {% block component_address_form_additional_field1 %}
  240.                 {% if config('core.loginRegistration.showAdditionalAddressField1') %}
  241.                     {% if formViolations.getViolations("/additionalAddressLine1") is not empty %}
  242.                         {% set violationPath = "/additionalAddressLine1" %}
  243.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine1") is not empty %}
  244.                         {% set violationPath = "/#{prefix}/additionalAddressLine1" %}
  245.                     {% endif %}
  246.                     <div class="form-group col-md-6">
  247.                         {% block component_address_form_additional_field1_label %}
  248.                             <label class="form-label"
  249.                                    for="{{ idPrefix ~ prefix }}AdditionalField1">
  250.                                 {{ "address.additionalField1Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField1Required') ? "general.required"|trans|sw_sanitize }}
  251.                             </label>
  252.                         {% endblock %}
  253.                         {% block component_address_form_additional_field1_input %}
  254.                             <input type="text"
  255.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  256.                                    id="{{ idPrefix ~ prefix }}AdditionalField1"
  257.                                    placeholder="{{ "address.additionalField1Placeholder"|trans|striptags }}"
  258.                                    name="{{ prefix }}[additionalAddressLine1]"
  259.                                    value="{{ data.get('additionalAddressLine1') }}"
  260.                                     {{ config('core.loginRegistration.additionalAddressField1Required') ? 'required="true"' }}>
  261.                         {% endblock %}
  262.                         {% block component_address_form_additional_field1_error %}
  263.                             {% if violationPath %}
  264.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  265.                             {% endif %}
  266.                         {% endblock %}
  267.                     </div>
  268.                 {% endif %}
  269.             {% endblock %}
  270.             {% block component_address_form_additional_field2 %}
  271.                 {% if config('core.loginRegistration.showAdditionalAddressField2') %}
  272.                     {% if formViolations.getViolations("/additionalAddressLine2") is not empty %}
  273.                         {% set violationPath = "/additionalAddressLine2" %}
  274.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine2") is not empty %}
  275.                         {% set violationPath = "/#{prefix}/additionalAddressLine2" %}
  276.                     {% endif %}
  277.                     <div class="form-group col-md-6">
  278.                         {% block component_address_form_additional_field2_label %}
  279.                             <label class="form-label"
  280.                                    for="{{ idPrefix ~ prefix }}AdditionalField2">
  281.                                 {{ "address.additionalField2Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField2Required') ? "general.required"|trans|sw_sanitize }}
  282.                             </label>
  283.                         {% endblock %}
  284.                         {% block component_address_form_additional_field2_input %}
  285.                             <input type="text"
  286.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  287.                                    id="{{ idPrefix ~ prefix }}AdditionalField2"
  288.                                    placeholder="{{ "address.additionalField2Placeholder"|trans|striptags }}"
  289.                                    name="{{ prefix }}[additionalAddressLine2]"
  290.                                    value="{{ data.get('additionalAddressLine2') }}"
  291.                                     {{ config('core.loginRegistration.additionalAddressField2Required') ? 'required="true"' }}>
  292.                         {% endblock %}
  293.                         {% block component_address_form_additional_field2_error %}
  294.                             {% if violationPath %}
  295.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  296.                             {% endif %}
  297.                         {% endblock %}
  298.                     </div>
  299.                 {% endif %}
  300.             {% endblock %}
  301.         </div>
  302.         <div class="{{ formRowClass }} country-and-state-form-elements" data-country-state-select="true">
  303.             {% block component_address_form_country %}
  304.                 <div class="form-group col-md-6">
  305.                     {% set initialCountryId = null %}
  306.                     {% if data.get('countryId') %}
  307.                         {% set initialCountryId = data.get('countryId') %}
  308.                     {% elseif page.countries|length == 1 %}
  309.                         {% set initialCountryId = (page.countries|first).id %}
  310.                     {% endif %}
  311.                     {% if formViolations.getViolations("/countryId") is not empty %}
  312.                         {% set violationPath = "/countryId" %}
  313.                     {% elseif formViolations.getViolations("/#{prefix}/countryId") is not empty %}
  314.                         {% set violationPath = "/#{prefix}/countryId" %}
  315.                     {% endif %}
  316.                     {% block component_address_form_country_label %}
  317.                         <label class="form-label"
  318.                                for="{{ idPrefix ~ prefix }}AddressCountry">
  319.                             {{ "address.countryLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  320.                         </label>
  321.                     {% endblock %}
  322.                     {% block component_address_form_country_select %}
  323.                         <select class="country-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  324.                                 id="{{ idPrefix ~ prefix }}AddressCountry"
  325.                                 name="{{ prefix }}[countryId]"
  326.                                 required="required"
  327.                                 data-initial-country-id="{{ initialCountryId }}">
  328.                             {% if not initialCountryId %}
  329.                                 <option disabled="disabled"
  330.                                         value=""
  331.                                         selected="selected">
  332.                                     {{ "address.countryPlaceholder"|trans|sw_sanitize }}
  333.                                 </option>
  334.                             {% endif %}
  335.                             {% for country in page.countries %}
  336.                                 <option {% if country.id == initialCountryId %}
  337.                                         selected="selected"
  338.                                         {% endif %}
  339.                                         value="{{ country.id }}"
  340.                                         data-vat-id-required="{{ country.vatIdRequired }}"
  341.                                         {% if feature('FEATURE_NEXT_15707') and  not country.shippingAvailable and disableNonShippableCountries %}
  342.                                             disabled="disabled"
  343.                                         {% endif %}>
  344.                                     {{ country.translated.name }}{% if feature('FEATURE_NEXT_15707') and showNoShippingPostfix and not country.shippingAvailable %} {{ "address.countryPostfixNoShipping"|trans|sw_sanitize }}{% endif %}
  345.                                 </option>
  346.                             {% endfor %}
  347.                         </select>
  348.                     {% endblock %}
  349.                 </div>
  350.                 <div class="form-group col-md-6  d-none">
  351.                     {% if formViolations.getViolations("/countryStateId") is not empty %}
  352.                         {% set violationPath = "/countryStateId" %}
  353.                     {% elseif formViolations.getViolations("/#{prefix}/countryStateId") is not empty %}
  354.                         {% set violationPath = "/#{prefix}/countryStateId" %}
  355.                     {% endif %}
  356.                     {% block component_address_form_country_state_label %}
  357.                         <label class="form-label"
  358.                                for="{{ idPrefix ~ prefix }}AddressCountry">
  359.                             {{ "address.countryStateLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  360.                         </label>
  361.                     {% endblock %}
  362.                     {% block component_address_form_country_state_select %}
  363.                         <select class="country-state-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  364.                                 id="{{ idPrefix ~ prefix }}AddressCountryState"
  365.                                 name="{{ prefix }}[countryStateId]"
  366.                                 data-initial-country-state-id="{{ data.get('countryStateId') }}">
  367.                             <option value=""
  368.                                     selected="selected"
  369.                                     data-placeholder-option="true">
  370.                                 {{ "address.countryStatePlaceholder"|trans|sw_sanitize }}
  371.                             </option>
  372.                         </select>
  373.                     {% endblock %}
  374.                     {% block component_address_form_country_error %}
  375.                         {% if violationPath %}
  376.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  377.                         {% endif %}
  378.                     {% endblock %}
  379.                 </div>
  380.             {% endblock %}
  381.         </div>
  382.         <div class="{{ formRowClass }}">
  383.             {% block component_address_form_phone_number %}
  384.                 {% if config('core.loginRegistration.showPhoneNumberField') %}
  385.                     <div class="form-group col-md-6">
  386.                         {% if formViolations.getViolations("/phoneNumber") is not empty %}
  387.                             {% set violationPath = "/phoneNumber" %}
  388.                         {% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
  389.                             {% set violationPath = "/#{prefix}/phoneNumber" %}
  390.                         {% endif %}
  391.                         {% block component_address_form_phone_number_label %}
  392.                             <label class="form-label"
  393.                                    for="{{ idPrefix ~ prefix }}AddressPhoneNumber">
  394.                                 {{ "address.phoneNumberLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.phoneNumberFieldRequired') ? "general.required"|trans|sw_sanitize }}
  395.                             </label>
  396.                         {% endblock %}
  397.                         {% block component_address_form_phone_number_input %}
  398.                             <input type="text"
  399.                                    class="form-control"
  400.                                    id="{{ idPrefix ~ prefix }}AddressPhoneNumber"
  401.                                    placeholder="{{ "address.phoneNumberPlaceholder"|trans|striptags }}"
  402.                                    name="{{ prefix }}[phoneNumber]"
  403.                                    value="{{ data.get('phoneNumber') }}"
  404.                                 {{ config('core.loginRegistration.phoneNumberFieldRequired') ? 'required="true"' }}>
  405.                         {% endblock %}
  406.                         {% block component_address_form_phone_error %}
  407.                             {% if violationPath %}
  408.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  409.                             {% endif %}
  410.                         {% endblock %}
  411.                     </div>
  412.                 {% endif %}
  413.             {% endblock %}
  414.         </div>
  415.     {% endblock %}
  416. {% endblock %}