Obsługa dodatkowych danych teleadresowych
W tym artykule dowiesz się jak zmodyfikować swój szablon, aby obsługiwać w nim dodatkowe dane teleadresowe. W pliku common/address-form.html wyszukaj frazę {% if addressVisible -%}. Wszystko nad linijką z tą frazą zamień na ten kod: {% if include contains 'retail' or include == 'company' -%} {% assign cityRequired = config.Countries[countryISOCode].RequiredFields.City -%} {% if include contains 'inv-add' or page.QueryString contains 'invoice-address' -%} Następnie w pliku order/delivery-partials/address-form.html podmień całą jego zawartość na ten kod: {% comment -%} {% if addressesAmount > 1 %} {% if type == 'inv-add' -%} {% else -%} {% endif -%}
Teraz w pliku order/delivery-partials/address-list-item.html znajdź frazę {{address.State}}. Linijkę z tą frazą zastąp poniższym kodem: Następnie w pliku w pliku order/delivery-partials/address-presentation.html całą zawartość pliku zastąp tym kodem: {% if type == 'orderDa' -%} {% assign areCountries = false -%} {% comment -%} {% if addressesAmount > 1 %} {% if settings.blockAddingAndEditingDeliveryAddress == 'no' -%} {% assign noBorder = false -%}
{{address.Name}}
{% if address.Name2 != '' %}
{{address.Street}}
{{address.ZipCode}} {{address.City}}
{{address.State}} {{address.Country}}
{% if type == 'inv-add' and order.Customer.TIN != '' -%} {{order.Customer.TIN}} {% if type == 'orderDa' or type == 'buyerAddress' -%} {% if address.PhoneNo != '' -%} {% endif -%} {% endif %}
Teraz w pliku order/delivery-partials/delivery-section.html znajdź frazę {% assign index = 0 -%}. Wszystko nad linijką z tą frazą zastąp poniższym kodem: {% if customer-profile != null -%} Dalej w pliku order/delivery-partials/delivery-section.html znajdź frazę delivery-address-lq. W podmień kod w tym divie na te poniżej: {% else %}
{% if order.SelectedDelivery.CollectionPointTypeId == 0 -%} {% endif %} {% if order.SelectedDelivery.PhoneRequired and deliveryAddress.PhoneNo == '' -%} {% if page.Cookies.delivCountryChanged == 'true' -%} {% if deliveryAddress.Name == '' or lackOfPhone or countryMismatch -%} {% if showForm -%} Następnie w pliku order/cart.html znajdź frazę forms-container-ui forms-container-lq. Zamień wszystko w tym divie na ten kod: {% else %} {% if config.CompanyOnly == false -%} {% endif -%} {% endif -%} Teraz w pliku __settings.liquid dodaj analogicznie do pozostałych kolejną sekcję field: Teraz w pliku js/init-ui1.js znajdź frazę function Order(configObj) {. Linijkę niżej dodaj poniższy kod: Dalej w pliku js/init-ui1.js znajdź frazę this.confirmAddress. Całą zawartość znalezionej funkcji podmień poniższym kodem: if (isValid) { if (!errorClass) { if (addressType === 0) { if (templateUrl) { data.push({ name: '__csrf', value: __CSRF }); var thisRef = this; if (addressType == 0) { if (!thisRef.deliveryAddresFilled || (thisRef.isInvoice && !thisRef.invoiceAddresFilled)) { if (addressType == 0 || addressType == 2) { if (callback) { return confirmPromise; Następnie nadal w pliku js/init-ui1.js znajdź frazę Order/DeliveryAddressUpdate. Linijkę z tą frazą zamień na poniższy kod: Dalej w pliku js/init-ui1.js znajdź frazę //ORDER’s binding. Wszystko pod tym komentarzem aż do komentarza //confirm address zamień na poniższy kod: $(document).ajaxSuccess(function(a, b, c, d) { // //hide doubled delivery methods if($('.products-table-lq').index() != -1){ //add coupon //update delivery and payment matrix //redraw points after update if needed //change address template (from presentation to edition) //change address presentation template to addresses list //change address list to single address presentation Teraz w pliku js/init-ui1.js dodaj kod: function toggleOrderAddress(e) { $('body').on('click', '.order-address-data-tab-lq:not(.active-lq)', function (e) { function toggleOrderAddressNotAuthenticated(e) { $('body').on('click', '.order-address-data-tab-not-authenticated-lq:not(.active-lq)', function (e) { Następnie w pliku js/init-ui2.js znajdź frazę saveDeliveryDataPopup(e) {. Podmień kod tej funkcji na ten: '); Dalej w pliku js/init-ui2.js znajdź frazę setOrderDeliveryDataPopupRadio(e) {. Podmień kod tej funkcji na ten: Teraz w pliku scss/globals/_globals2.scss dodaj kod:
Szafir
{% assign emailReadonly = false -%}
{% assign emailRequired = false -%}
{% assign TINTooltipVisible = false -%}
{% if include == 'company' -%}
{% assign chosenType = config.Registration.Company -%}
{% assign company = true -%}
{% assign TINVisible = true -%}
{% assign tin = customer.TIN -%}
{% assign vateu = customer.VATEU -%}
{% assign countryISOCode = config.Countries[0].ISOCode -%}
{% else -%}
{% assign chosenType = config.Registration.Retail -%}
{% if include contains '=' -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% else -%}
{% assign countryISOCode = config.Countries[0].ISOCode -%}
{% endif -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.sign-up-address-lq' -%}
{% assign dataInclude = 'retail=' -%}
{% endif -%}
{% assign addressVisible = chosenType.AddressVisible -%}
{% assign addressRequired = chosenType.AddressRequired -%}
{% assign phoneVisible = chosenType.PhoneVisible -%}
{% assign phoneRequired = chosenType.PhoneRequired -%}
{% assign address = customer.Address -%}
{% elseif include contains 'add-da' -%}
{% if customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = true -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.add-da-lq' -%}
{% assign dataInclude = 'add-da=' -%}
{% elseif include == 'orderDa' -%}
{% if order.Customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% if usr.Authenticated -%}
{% assign emailReadonly = true -%}
{% endif -%}
{% if order != '' -%}
{% assign emailRequired = true -%}
{% assign email = order.Customer.Email -%}
{% assign address = order.Customer.DeliveryAddress -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% elseif include == 'buyerAddress' -%}
{% if order.Customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% if usr.Authenticated -%}
{% assign emailReadonly = true -%}
{% endif -%}
{% if order != '' -%}
{% assign emailRequired = true -%}
{% assign email = order.Customer.Email -%}
{% assign address = order.Customer.Buyer -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% elseif include contains 'inv-add' or page.QueryString contains 'invoice-address' -%}
{% if page.QueryString contains 'invoice-address'-%}
{% if page.QueryString contains 'company' -%}
{% assign companyCheck = true -%}
{% endif -%}
{% else -%}
{% if order.Customer.Company -%}
{% assign companyCheck = true -%}
{% endif -%}
{% endif -%}
{% if companyCheck -%}
{% assign company = true -%}
{% endif -%}
{% assign TINVisible = true -%}
{% if order.Customer.TIN != '' -%}
{% assign tin = order.Customer.TIN -%}
{% assign vateu = order.Customer.VATEU -%}
{% else -%}
{% assign tin = customer.TIN -%}
{% assign vateu = customer.VATEU -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = false -%}
{% assign phoneRequired = false -%}
{% if order == null -%}
{% assign address = customer.Address -%}
{% else -%}
{% assign address = order.Customer.InvoiceAddress -%}
{% endif -%}
{% if include contains 'inv-add=' -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.ia-lq' -%}
{% assign dataInclude = 'inv-add=' -%}
{% else -%}
{% if address.Country != '' -%}
{% assign countryISOCode = address.Country -%}
{% else -%}
{% assign countryISOCode = config.DefaultCountry -%}
{% endif -%}
{% endif -%}
{% assign autoPost = true -%}
{% if usr.Authenticated -%}
{% assign emailReadonly = true -%}
{% endif -%}
{% elseif include == 'order-da-popup-ret' -%}
{% assign TINVisible = false -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% assign emailRequired = true -%}
{% assign email = order.Customer.Email -%}
{% if order != '' -%}
{% assign address = order.Customer.DeliveryAddress -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% assign dontShowCountry = true -%}
{% elseif include == 'order-da-popup-comp' -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% assign emailRequired = true -%}
{% assign email = order.Customer.Email -%}
{% if order != '' -%}
{% assign address = order.Customer.DeliveryAddress -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% assign dontShowCountry = true -%}
{% elseif include == 'order-buyer-popup-ret' -%}
{% assign TINVisible = false -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% assign emailRequired = false -%}
{% assign email = order.Customer.Email -%}
{% if order != '' -%}
{% assign address = order.Customer.Buyer -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% assign dontShowCountry = true -%}
{% elseif include == 'order-buyer-popup-comp' -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = order.SelectedDelivery.PhoneRequired -%}
{% assign emailRequired = false -%}
{% assign email = order.Customer.Email -%}
{% if order != '' -%}
{% assign address = order.Customer.Buyer -%}
{% elseif customer.DeliveryAddress.Name != '' -%}
{% assign address = customer.DeliveryAddress -%}
{% else -%}
{% assign address = customer.Address -%}
{% endif -%}
{% assign countryISOCode = order.Customer.DeliveryAddress.Country -%}
{% if order.SelectedDelivery.CollectionPointTypeId == 2 -%}
{% assign showMapTrigger = true -%}
{% endif -%}
{% assign dontShowCountry = true -%}
{% elseif include == 'order-invoice-popup-ret' or include contains 'inv-country-ret=' -%}
{% assign company = false -%}
{% assign TINVisible = true -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = false -%}
{% assign phoneRequired = false -%}
{% if order == null -%}
{% assign address = customer.Address -%}
{% else -%}
{% assign address = order.Customer.InvoiceAddress -%}
{% endif -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.invoice-address-form-in-popup-lq.retail-lq' -%}
{% assign dataInclude = 'inv-country-ret=' -%}
{% if include contains 'inv-country-ret=' -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% else -%}
{% if address.Country != '' -%}
{% assign countryISOCode = address.Country -%}
{% else -%}
{% assign countryISOCode = config.DefaultCountry -%}
{% endif -%}
{% endif -%}
{% assign autoPost = true -%}
{% assign recipe = true -%}
{% assign showRecipe = true -%}
{% elseif include == 'order-invoice-popup-comp' or include contains 'inv-country-comp=' -%}
{% assign company = true -%}
{% assign TINVisible = true -%}
{% if order.Customer.TIN != '' -%}
{% assign tin = order.Customer.TIN -%}
{% assign vateu = order.Customer.VATEU -%}
{% else -%}
{% assign tin = customer.TIN -%}
{% assign vateu = customer.VATEU -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = false -%}
{% assign phoneRequired = false -%}
{% if order == null -%}
{% assign address = customer.Address -%}
{% else -%}
{% assign address = order.Customer.InvoiceAddress -%}
{% endif -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.invoice-address-form-in-popup-lq.company-lq' -%}
{% assign dataInclude = 'inv-country-comp=' -%}
{% if include contains 'inv-country-comp=' -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% else -%}
{% if address.Country != '' -%}
{% assign countryISOCode = address.Country -%}
{% else -%}
{% assign countryISOCode = config.DefaultCountry -%}
{% endif -%}
{% endif -%}
{% assign autoPost = true -%}
{% if countryISOCode == 'PL' and settings.downloadDataFromGUS == 'yes' and settings.editDataFromGUS == 'no' -%}
{% assign readonly = true -%}
{% endif -%}
{% if countryISOCode == 'PL' and settings.downloadDataFromGUS == 'yes' -%}
{% assign gus = true -%}
{% endif -%}
{% assign recipe = true -%}
{% assign showRecipe = false -%}
{% elseif include contains 'customer-data' -%}
{% if customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = true -%}
{% assign tin = customer.TIN -%}
{% assign vateu = customer.VATEU -%}
{% endif -%}
{% assign emailRequired = true -%}
{% assign email = customer.Address.Email -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = true -%}
{% assign address = customer.Address -%}
{% assign includeArr = include | Split:'=' -%}
{% assign countryISOCode = includeArr[1] -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.customer-data-address-lq' -%}
{% assign dataInclude = 'customer-data=' -%}
{% if countryISOCode == 'PL' and settings.downloadDataFromGUS == 'yes' and settings.editDataFromGUS == 'no' and customer.Company -%}
{% assign readonly = true -%}
{% endif -%}
{% if countryISOCode == 'PL' and settings.downloadDataFromGUS == 'yes' -%}
{% assign gus = true -%}
{% endif -%}
{% elseif include contains '|' -%}
{% comment -%}{% endcomment -%}
{% if customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = false -%}
{% endif -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = true -%}
{% assign incSplit = include | Split:'|' -%}
{% assign daId = incSplit[0] | ToInt -%}
{% assign address = customer.DeliveryAddresses[daId] -%}
{% assign incSplitSize = incSplit | Size -%}
{% if incSplitSize > 1 -%}
{% assign countryISOCode = incSplit[1] -%}
{% endif -%}
{% assign countryChangeReload = true -%}
{% assign dataContainer = '.da-lq' -%}
{% capture dataInclude -%}{{address.Id}}|{% endcapture -%}
{% else -%}
{% if customer.Company -%}
{% assign company = true -%}
{% assign TINVisible = true -%}
{% assign tin = customer.TIN -%}
{% assign vateu = customer.VATEU -%}
{% endif -%}
{% assign emailRequired = true -%}
{% assign email = customer.Address.Email -%}
{% assign addressVisible = true -%}
{% assign addressRequired = true -%}
{% assign phoneVisible = true -%}
{% assign phoneRequired = true -%}
{% assign address = customer.Address -%}
{% assign countryISOCode = config.Countries[0].ISOCode -%}
{% endif -%}
{% assign streetRequired = config.Countries[countryISOCode].RequiredFields.Street -%}
{% assign streetNoRequired = config.Countries[countryISOCode].RequiredFields.StreetNo -%}
{% assign zipCodeRequired = config.Countries[countryISOCode].RequiredFields.ZipCode -%}
{% assign TINRequired = config.Countries[countryISOCode].RequiredFields.TIN -%}
{% if customer.Company -%}
{% assign TINRequired = true -%}
{% else -%}
{% assign TINRequired = false -%}
{% endif -%}
{% endif -%}
{% if include == 'order-invoice-popup-ret' or include contains 'inv-country-ret=' -%}
{% assign TINRequired = false -%}
{% elseif include == 'order-invoice-popup-comp' or include contains 'inv-country-comp=' -%}
{% assign TINRequired = true -%}
{% endif -%}
{% assign type = include -%}
{% assign typeForJS = 0 -%}
{% assign areCountries = false -%}
{% assign addressesAmount = customer.DeliveryAddresses | Size -%}
{% if addressesAmount == 1 -%}
{% if customer.DeliveryAddresses[0].Country == order.Customer.DeliveryAddress.Country -%}
{% assign areCountries = true -%}
{% endif -%}
{% endif -%}
{% endcomment -%}
{% assign countryCode = config.DefaultCountry -%}
{% if order.Customer.DeliveryAddress.Country != '' -%}
{% assign countryCode = order.Customer.DeliveryAddress.Country -%}
{% endif -%}
{% for address in customer.DeliveryAddresses -%}
{% if address.Country == countryCode -%}
{% assign areCountries = true -%}
{% break -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% elseif type == 'inv-add' -%}
{% assign typeForJS = 1 -%}
{% else -%}
{% assign typeForJS = 2 -%}
{% endif -%}
{% if areCountries and order.SelectedDelivery.CollectionPointTypeId == 0 -%}
{% if type == 'orderDa' or type == 'buyerAddress' -%}
{% endif -%}
{% endif -%}
{% assign address = order.Customer.InvoiceAddress -%}
{% if address.Country != '' -%}
{% assign countryISOCode = address.Country -%}
{% else -%}
{% assign countryISOCode = config.DefaultCountry -%}
{% endif -%}
{% capture inc -%}inv-add={{countryISOCode}}{% endcapture -%}
{{address.State}} {{address.Country}}
{% assign type = include -%}
{% if deliveryAddress -%}
{% assign address = deliveryAddress -%}
{% else -%}
{% assign address = order.Customer.DeliveryAddress -%}
{% endif -%}
{% elseif type == 'inv-add' -%}
{% if invoiceAddress -%}
{% assign address = invoiceAddress -%}
{% else -%}
{% assign address = order.Customer.InvoiceAddress -%}
{% endif -%}
{% elseif type == 'buyerAddress' -%}
{% if buyerAddress -%}
{% assign address = buyerAddress -%}
{% else -%}
{% assign address = order.Customer.Buyer -%}
{% endif -%}
{% endif -%}
{% assign addressesAmount = customer.DeliveryAddresses | Size -%}
{% if addressesAmount == 1 -%}
{% if customer.DeliveryAddresses[0].Country != order.Customer.DeliveryAddress.Country -%}
{% assign areCountries = true -%}
{% endif -%}
{% endif -%}
{% endcomment -%}
{% assign countryCode = config.DefaultCountry -%}
{% if order.Customer.DeliveryAddress.Country != '' -%}
{% assign countryCode = order.Customer.DeliveryAddress.Country -%}
{% endif -%}
{% for address in customer.DeliveryAddresses -%}
{% if address.Country == countryCode -%}
{% assign areCountries = true -%}
{% break -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% assign canEditOrAddDeliveryAddress = true -%}
{% elseif settings.blockAddingAndEditingDeliveryAddressFor == 'withLimits' and customer.CreditLimit == null -%}
{% assign canEditOrAddDeliveryAddress = true -%}
{% else -%}
{% assign canEditOrAddDeliveryAddress = false -%}
{% endif -%}
{% if settings.blockCompanyDataEdition == 'no' -%}
{% assign canEditCustomerDetails = true -%}
{% elseif settings.blockCompanyDataEditionFor == 'withLimits' and customer.CreditLimit == null -%}
{% assign canEditCustomerDetails = true -%}
{% else -%}
{% assign canEditCustomerDetails = false -%}
{% endif -%}
{% assign canEditDA = false -%}
{% assign canEditCD = false -%}
{% assign canEditAnything = false -%}
{% assign cantEditSomething = false -%}
{% if canEditOrAddDeliveryAddress and type == 'orderDa' -%}
{% assign canEditDA = true -%}
{% endif -%}
{% if canEditCustomerDetails and type == 'inv-add' -%}
{% assign canEditCD = true -%}
{% endif -%}
{% if canEditDA or canEditCD -%}
{% assign canEditAnything = true -%}
{% endif -%}
{% if canEditDA == false or canEditCD == false -%}
{% assign cantEditSomething = true -%}
{% endif -%}
{% if areCountries and order.SelectedDelivery.CollectionPointTypeId == 0 and usr.Authenticated -%}
{% endif -%}
{% endif -%}
{% unless type == 'inv-add' and order.Customer.CustomerDetailsEditable == false -%}
{% endunless -%}
{% if settings.buyerData == "yes" %}
{% if type == 'orderDa' or type == 'buyerAddress' %}
{% assign noBorder = true -%}
{% endif -%}
{% endif -%}
{{address.Name2}}
{% endif -%}
{{address.StreetNo}}{% if address.UnitNo != ''-%}/{{address.UnitNo}}{% endif -%}
{{translations.TIN}}
{% if config.ENTERPRISE and order.Customer.VATEU != '' -%}
{{order.Customer.VATEU}}
{% endif -%}
{% endif %}
{{order.Customer.Email}}
{{address.PhoneNo}}
{% assign deliveryAddress = order.Customer.DeliveryAddress -%}
{% assign invoiceAddress = order.Customer.InvoiceAddress -%}
{% assign buyerAddress = order.Customer.Buyer -%}
{% assign deliveryAddress = customer-profile.Order.DeliveryAddress -%}
{% assign invoiceAddress = customer-profile.Order.InvoiceAddress -%}
{% assign buyerAddress = customer-profile.Order.Customer.Buyer -%}
{% endif -%}
{% if settings.buyerData == "yes" %}
{% if order.Customer.Buyer == null -%}
{% endif -%}
{{translations.ShippingAddress}}
{% else -%}
{{translations.MyData}}
{% endif -%}
{{translations.ShippingAddress}}
{% else -%}
{{translations.MyData}}
{% endif -%}
{% assign countryMismatch = false -%}
{% assign lackOfPhone = true -%}
{% endif -%}
{% assign countryMismatch = true -%}
{% endif -%}
{% assign showForm = true -%}
{% endif -%}
{% if order.Customer.Company and canEditOrAddDeliveryAddress == false -%}
{% include 'order/delivery-partials/address-presentation.html' with 'orderDa' -%}
{% else -%}
{% include 'order/delivery-partials/address-form.html' with 'orderDa' -%}
{% endif -%}
{% else -%}
{% include 'order/delivery-partials/address-presentation.html' with 'orderDa' -%}
{% endif -%}
{% if order.Customer.Buyer == null -%}
{% endif -%}
{{ translations.DeliveryData }}
{% endif %}
{% if config.CompanyOnly == false -%}
this.buyerAddressReplaceableSelector = configObj.buyerAddressReplaceableSelector;
this.buyerAddressTemplateInclude = configObj.buyerAddressTemplateInclude;
this.buyerAddresFilled = ($(configObj.buyerAddressReplaceableSelector + ' [name="name"]').length == 0) ? true : false;
if (addressType == 0) {
var container = $(this.deliveryAddressReplaceableSelector);
} else if (addressType == 1){
var container = $(this.invoiceAddressReplaceableSelector);
} else {
var container = $(this.buyerAddressReplaceableSelector);
}
var isValid = window.app.validationBeforePost(e) == '' ? true : false;
var form = container.find('.form-lq');
var data = form.find('input:not([disabled]), select:not([disabled]), textarea:not([disabled])').serializeArray();
var errorClass = '';
}
data.push({ name: '__include', value: "'"+this.deliveryAddressTemplateInclude+"'" });
} else if (addressType === 1) {
data.push({ name: '__include', value: "'"+this.invoiceAddressTemplateInclude+"'" });
} else {
data.push({ name: '__include', value: "'"+this.buyerAddressTemplateInclude+"'" });
}
data.push({ name: '__template', value: templateUrl });
}
var confirmPromise;
var confirmResponseFunc = function (res) {
if (res.action.Result) {
app.setCookie('delivCountryChanged', 'true', -1);
if (res.template) {
container.html(res.template);
}
// thisRef.deliveryAddressId = -1;
// window.app.setCookie('deliveryAddressId', -1);
thisRef.deliveryAddresFilled = true;
} else if (addressType == 1) {
thisRef.invoiceAddresFilled = true;
} else {
thisRef.buyerAddresFilled = true;
}
thisRef.orderValidator.removeClass(thisRef.hiddingClass);
} else {
thisRef.orderValidator.addClass(thisRef.hiddingClass);
}
} else {
form.find('input:not([type="hidden"]), select, textarea').each(function() { window.app.validation(null, $(this)) });
}
};
confirmPromise = $.post('', data, function (res) { confirmResponseFunc(res) });
} else {
confirmPromise = thisRef.selectInvoice(form)
.then($.post('', data, function (res) { confirmResponseFunc(res) }));
}
confirmPromise.then(function () { callback(isValid) });
}
} else {
if (callback) {
callback(isValid);
}
return null;
}
if($('.order-address-data-tab-lq + .order-address-data-tab-lq').hasClass('active-lq')){
data['__action'] = 'Order/BuyerUpdate';
} else {
data['__action'] = 'Order/DeliveryAddressUpdate';
}
window.order = new Order(
{
deliveryAddressReplaceableSelector: '.delivery-address-lq .address-template-container-lq.delivery-lq',
deliveryAddressTemplateInclude: 'orderDa',
invoiceAddressReplaceableSelector: '.invoice-address-lq .address-template-container-lq',
invoiceAddressTemplateInclude: 'inv-add',
buyerAddressReplaceableSelector: '.delivery-address-lq .address-template-container-lq.buyer-lq',
buyerAddressTemplateInclude: 'buyerAddress',
collectionPointType: $('[data-type]').data('type'),
collectionPointFormSelector: '#ifMapContainer',
noteReplaceableSelector: '.note-lq',
headerAttributesSetFormSelector: '.header-attributes-set-form-lq',
positionAttributesSetSelector: '.products-table-lq',
addingOrderFormSelector: '.adding-order-form-lq',
needRecalculateClass: 'need-recalculate-lq',
orderValidatorSelector: '.order-validation-lq',
hiddingClass: 'hidden-lq'
}
);
setTimeout(function () {
if(d && d.template != null) {
window.order = new Order(
{
deliveryAddressReplaceableSelector: '.delivery-address-lq .address-template-container-lq.delivery-lq',
deliveryAddressTemplateInclude: 'orderDa',
invoiceAddressReplaceableSelector: '.invoice-address-lq .address-template-container-lq',
invoiceAddressTemplateInclude: 'inv-add',
buyerAddressReplaceableSelector: '.delivery-address-lq .address-template-container-lq.buyer-lq',
buyerAddressTemplateInclude: 'buyerAddress',
collectionPointType: $('[data-type]').data('type'),
collectionPointFormSelector: '#ifMapContainer',
noteReplaceableSelector: '.note-lq',
headerAttributesSetFormSelector: '.header-attributes-set-form-lq',
positionAttributesSetSelector: '.products-table-lq',
addingOrderFormSelector: '.adding-order-form-lq',
needRecalculateClass: 'need-recalculate-lq',
orderValidatorSelector: '.order-validation-lq',
hiddingClass: 'hidden-lq'
}
);
}
}, 1);
});
// order.hideDoubbledMethods($('.delivery-method-lq'), $('[data-products-total-value]').data('products-total-value'));
var productsTable = $('.products-table-lq');
window.UIFeatures.attachElement('.products-table-header-lq', null, productsTable.offset().top + productsTable.height());
}
body.on('click', '.add-coupon-lq', function (e) {
window.order.addCoupon(e);
})
body.on('change', '.change-delivery-lq', function (e) {
window.order.updateDeliveryMatrix(this, '.delivery-form-lq', '.collection-points-lq', e);
});
body.on('deliveryChange', function (e, pointType) {
if (pointType == 1) {
$('[data-type]').data('type', pointType).attr('data-type', pointType);
if(window.google) {
app.getCollectionPoints();
}
}
});
body.on('click', '.other-address-lq', function () {
var container = $(this).parents('.address-template-container-lq');
var addressType = $(this).parents('.address-template-container-lq').data('address-type');
if(addressType == 0){
var templateInclude = 'orderDa';
} else if(addressType == 1){
var templateInclude = 'inv-add';
} else {
var templateInclude = 'buyerAddress';
}
window.order.replacePartialTemplate(container, 'order/delivery-partials/address-form.html', templateInclude);
});
body.on('click', '.change-delivery-address-lq', function (e) {
var container = $(this).parents('.address-template-container-lq');
window.order.replacePartialTemplate(container, 'order/delivery-partials/addresses-list.html', 'orderDa');
});
body.on('click', '.back-to-presentation-lq', function (e) {
var container = $(this).parents('.address-template-container-lq');
if($('.order-address-data-tab-lq + .order-address-data-tab-lq').hasClass('active-lq')){
var include = 'buyerAddress';
} else {
var include = 'orderDa';
}
window.order.replacePartialTemplate(container, 'order/delivery-partials/address-presentation.html', include);
});
$('.order-address-data-tab-lq').toggleClass('active-lq');
$(e.currentTarget).parents('.delivery-address-lq').find('.address-template-container-lq').toggleClass('hidden-lq');
};
toggleOrderAddress(e);
});
$('.order-address-data-tab-not-authenticated-lq').toggleClass('active-lq');
if($('.order-delivery-data-popup-radio-lq[value=true]').prop('checked')){
$('.buyer-address-form-in-popup-lq.company-lq').toggleClass('hidden-lq');
$('.delivery-address-form-in-popup-lq.company-lq').toggleClass('hidden-lq');
} else {
$('.buyer-address-form-in-popup-lq.retail-lq').toggleClass('hidden-lq');
$('.delivery-address-form-in-popup-lq.retail-lq').toggleClass('hidden-lq');
}
};
toggleOrderAddressNotAuthenticated(e);
});
if($('.order-address-data-tab-not-authenticated-lq').length > 0){
var buyerOn = true;
} else {
var buyerOn = false;
}
var company = $('.order-delivery-data-popup-radio-lq:checked').val();
if(company == 'true'){
var DAform = $('.delivery-address-form-in-popup-lq.company-lq');
if(buyerOn){
var buyerForm = $('.buyer-address-form-in-popup-lq.company-lq');
}
} else {
var DAform = $('.delivery-address-form-in-popup-lq.retail-lq');
if(buyerOn){
var buyerForm = $('.buyer-address-form-in-popup-lq.retail-lq');
}
}
var DAdata = DAform.find('input:not([disabled]), select:not([disabled]), textarea:not([disabled])').serializeArray();
DAdata.push({ name: '__csrf', value: __CSRF });
DAdata.push({ name: '__action', value: 'Order/DeliveryAddressUpdate' });
if(buyerOn){
var buyerData = buyerForm.find('input:not([disabled]), select:not([disabled]), textarea:not([disabled])').serializeArray();
buyerData.push({ name: '__csrf', value: __CSRF });
buyerData.push({ name: '__action', value: 'Order/BuyerUpdate' });
buyerData.push({ name: '__template', value: 'order/order-template.html' });
} else {
DAdata.push({ name: '__template', value: 'order/order-template.html' });
}
if(company == 'true'){
var invoiceForm = $('.invoice-address-form-in-popup-lq.company-lq .form-lq:not(.hidden-lq)');
} else {
var invoiceForm = $('.invoice-address-form-in-popup-lq.retail-lq .form-lq:not(.hidden-lq)');
}
if(invoiceForm.hasClass('invoice-lq')){
var invoiceData = invoiceForm.find('input:not([disabled]), select:not([disabled]), textarea:not([disabled])').serializeArray();
invoiceData.push({ name: '__csrf', value: __CSRF });
invoiceData.push({ name: '__action', value: 'Order/InvoiceAddressUpdate' });
invoiceData.push({ name: '__collection', value: 'order.SelectedDelivery.PhoneRequired' });
invoiceData.push({ name: 'company', value: company });
invoiceData.push({ name: 'invoice', value: 'true' });
}
if((buyerOn && (app.validationBeforePost(e, buyerForm) != 'error' || (app.validationBeforePost(e, buyerForm) == 'error' && buyerForm.find('[name=name]').val() == ''))) || !buyerOn){
var buyerValidation = true;
} else {
var buyerValidation = false;
}
if(app.validationBeforePost(e, DAform) != 'error' && app.validationBeforePost(e, invoiceForm) != 'error' && buyerValidation){
$.post('', invoiceData).then(function (result) {
if(result.collection){
var phone = DAform.find('[name=phoneNo]');
phone.prop('required',true);
var error = phone.data('error');
phone.parent().append('
phone.parent().find('label').append(' *');
}
$.post('', DAdata, function (result) {
if(buyerOn){
$.post('', buyerData, function (result) {
$('.order-template-lq').html(result.template);
$('.during-ajax-modal-lq').addClass('hidden-lq');
$('body').removeClass('modal-open-ui');
});
} else {
$('.order-template-lq').html(result.template);
$('.during-ajax-modal-lq').addClass('hidden-lq');
$('body').removeClass('modal-open-ui');
}
});
});
} else if(app.validationBeforePost(e, DAform) == 'error' && buyerOn){
$(e.currentTarget).find('.order-address-data-tab-not-authenticated-lq').eq(0).trigger('click');
} else if(!buyerValidation){
$(e.currentTarget).find('.order-address-data-tab-not-authenticated-lq').eq(1).trigger('click');
}
var company = $(e.currentTarget).val();
if(company == 'true'){
if($('.order-address-data-tab-not-authenticated-lq').eq(1).hasClass('active-lq')){
$('.delivery-address-form-in-popup-lq.company-lq').addClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.company-lq').removeClass('hidden-lq');
} else {
$('.delivery-address-form-in-popup-lq.company-lq').removeClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.company-lq').addClass('hidden-lq');
}
$('.delivery-address-form-in-popup-lq.retail-lq').addClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.retail-lq').addClass('hidden-lq');
$('.invoice-address-form-in-popup-lq.retail-lq').addClass('hidden-lq');
$('.invoice-address-form-in-popup-lq.company-lq').removeClass('hidden-lq');
$('[name=toggle-recipe-and-invoice][value=invoice]').prop('checked', true).trigger('change');
} else {
if($('.order-address-data-tab-not-authenticated-lq').eq(1).hasClass('active-lq')){
$('.delivery-address-form-in-popup-lq.retail-lq').addClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.retail-lq').removeClass('hidden-lq');
} else {
$('.delivery-address-form-in-popup-lq.retail-lq').removeClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.retail-lq').addClass('hidden-lq');
}
$('.delivery-address-form-in-popup-lq.company-lq').addClass('hidden-lq');
$('.buyer-address-form-in-popup-lq.company-lq').addClass('hidden-lq');
$('.invoice-address-form-in-popup-lq.company-lq').addClass('hidden-lq');
$('.invoice-address-form-in-popup-lq.retail-lq').removeClass('hidden-lq');
$('[name=toggle-recipe-and-invoice][value=recipe]').prop('checked', true).trigger('change');
}
.order-address-data-tab-ui{
width: 50%;
line-height: 1;
margin-top: 28px;
padding: 10px;
border: 1px solid $lightBorderColor;
border-bottom: none;
text-align: center;
background: $lightBorderColor;
cursor: pointer;
&.left-ui{
float: left;
}
&.right-ui{
float: right;
}
&.active-lq{
font-weight: 700;
background: #fff;
cursor: default;
}
&.not-authenticated-ui{
line-height: 1.5em;
margin-top: 0;
}
}
.order-ui .not-authenticated-in-order-container-ui .form-title-ui.not-authenticated-ui{
margin-top: -10px;
margin-bottom: 27px;
padding: 0;
}
Czy ten artykuł był pomocny?