D
D
Dmax992022-01-29 14:33:43
opencart
Dmax99, 2022-01-29 14:33:43

How to make the Partner field required?

Hello! Please tell me how to make the Partner field mandatory when editing an order in the admin panel.
Opencart 3

In the admin\view\template\sale\order_form.twig file,
I found an adjax script that is probably responsible for processing this field, but I didn’t find any examples of how to add a mandatory...

Here is this script

// Affiliate
$('input[name=\'affiliate\']').autocomplete({
  'source': function(request, response) {
    $.ajax({
      url: 'index.php?route=customer/customer/autocomplete&user_token={{ user_token }}&filter_affiliate=1&filter_name=' +  encodeURIComponent(request),
      dataType: 'json',
      success: function(json) {
        json.unshift({
          customer_id: 0,
          name: '{{ text_none }}'
        });

        response($.map(json, function(item) {
          return {
            label: item['name'],
            value: item['customer_id']
          }
        }));
      }
    });
  },
  'select': function(item) {
    $('input[name=\'affiliate\']').val(item['label']);
    $('input[name=\'affiliate_id\']').val(item['value']);
  }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question