Page 1 of 1

Hide user-filled fields based on shipping method?

PostPosted: Wed Oct 07, 2020 4:17 pm
by fale
Hello!
How to hide user-filled fields depending on the delivery method? :?:
I have an important question about a component.
Example: When choosing a delivery method by postal service, the client fills in the fields - country, address, zip code, name, surname.
These fields are needed to send goods through the postal service.
When choosing a delivery (picking up a product from a pick-up point) - the client has to fill in a lot of unnecessary unnecessary fields.
Question: Can you use your component to hide user-filled fields when choosing this delivery method?
That is, when choosing a delivery method from a self-pickup point, you need to hide some customer fields.
This is necessary to simplify the order form from the pickup point.
1. For sending products by mail - the form is shown in full.
2. Pickup of products - some of the customer fields are hidden
I have not found such a function in your component.
I would be glad if you could explain. Thanks! Vitaly

Оригинал:

Здравствуйте!
У меня есть важный вопрос по компоненту.
Пример: При выборе способа доставки почтовой службой - клиенту заполняет поля - страна, адрес, индекс, имя, фамилия .
Эти поля нужны для отправки товаров через почтовую службу.
При выборе доставки ( забор продукта из пункта самовывоза) - клиенту приходится заполнять много лишних ненужных полей.
Вопрос: Можно ли с помощью вашего компонента скрыть поля заполняемые пользователем, при выборе такого метода доставки?
То есть, при выборе метода доставки из пункта самовывоза - нужно скрыть некоторые поля заказчика.
Это нужно что бы упростить форму заказа с пункта самовывоза.
1.Для отправки почтой продуктов - форма показывается полностью.
2. Самовывоз продуктов - часть полей заказчика скрыты
Я не нашёл такой функции в вашем компоненте.
Буду рад если вы обьясните. Спасибо! Виталий

Re: Hide user-filled fields based on shipping method?

PostPosted: Fri Mar 05, 2021 1:56 pm
by admin
hello, i suggest to modify your tabcontent.js

and add a code:
Code: Select all
function filterFields() {
  var ship_id = Onepage.getInputIDShippingRate();
    if (ship_id == 'shipment_id_2') {
        jQuery('#address_2_div').parent().hide();
    }
   else {
      jQuery('#address_2_div').parent().hide();
   }
}
addOpcTriggerer('callAfterShippingSelect', filterFields);


you can adjust the above as needed and per the number of child elements within the section which wraps your fields.
the exaple is per shipping ID = 2

best regards, stan