Post by thanos74 » Tue Mar 17, 2020 3:48 pm

Hello, i created at Customers a Custom Field, VAT.
I want to search (at admin) Customers by VAT.
Any suggestion or plugin ?

Thank you

Newbie

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by paulfeakins » Tue Mar 17, 2020 6:29 pm

I had a very quick search in the extension store and couldn't see anything obvious so you might have to pay a developer from Commercial Support to build this if you really need it: viewforum.php?f=88

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by chrisranjana.com » Sat Mar 21, 2020 5:12 pm

thanos74 wrote:
Tue Mar 17, 2020 3:48 pm
Hello, i created at Customers a Custom Field, VAT.
I want to search (at admin) Customers by VAT.
Any suggestion or plugin ?

Thank you
There seems to be discussion regarding this issue here viewtopic.php?t=157954

Chris, Opencart Developers and Programmers,
Opencart Developers Opencart Programmers
https://www.chrisranjana.com


User avatar
Active Member

Posts

Joined
Thu Feb 26, 2009 2:23 am
Location - chennai, India

Post by straightlight » Sat Mar 21, 2020 8:15 pm

Should be pretty simple on that side. Tested on OC v3.0.3.2 release.

In admin/controller/customer/customer.php file,

find all instances of:

Code: Select all

if (isset($this->request->get['filter_ip'])) {
				$url .= '&filter_ip=' . $this->request->get['filter_ip'];
			}
add after all of them:

Code: Select all

if (isset($this->request->get['filter_tax_rate_id'])) {
				$url .= '&filter_tax_rate_id=' . $this->request->get['filter_tax_rate_id'];
			}
Then, find:

Code: Select all

if (isset($this->request->get['filter_ip'])) {
			$filter_ip = $this->request->get['filter_ip'];
		} else {
			$filter_ip = '';
		}
add below:

Code: Select all

if (isset($this->request->get['filter_tax_rate_id'])) {
			$filter_tax_rate_id = $this->request->get['filter_tax_rate_id'];
		} else {
			$filter_tax_rate_id = '';
		}
Then, find:

Code: Select all

'filter_ip'                => $filter_ip,
add below:

Code: Select all

'filter_tax_rate_id'	   => $filter_tax_rate_id,
Then, find:

Code: Select all

$data['filter_ip'] = $filter_ip;
add below:

Code: Select all

$data['filter_tax_rate_id'] = $filter_tax_rate_id;
Then, find:

Code: Select all

$this->load->model('setting/store');

		$stores = $this->model_setting_store->getStores();
add below:

Code: Select all

$this->load->model('localisation/tax_rate');
		
		$data['tax_rates'] = $this->model_localisation_tax_rate->getTaxRates();
In admin/model/customer/customer.php file,

find all instances of:

Code: Select all

if (isset($data['filter_status']) && $data['filter_status'] !== '') {
			$implode[] = "c.status = '" . (int)$data['filter_status'] . "'";
		}
add below all:

Code: Select all

if (!empty($data['filter_tax_rate_id'])) {
			$implode[] = "c.customer_id IN (SELECT ct.customer_id FROM " . DB_PREFIX . "customer_transaction ct LEFT JOIN `" . DB_PREFIX . "order_product` op ON (op.`order_id` = ct.`order_id`) LEFT JOIN " . DB_PREFIX . "tax_rule tr ON (tr.tax_class_id = op.tax_class_id) LEFT JOIN " . DB_PREFIX . "tax_rate tr1 ON (tr1.tax_rate_id = tr.tax_rate_id) WHERE ct.customer_id = c.customer_id AND tr1.tax_rate_id = '" . (int)$data['filter_tax_rate_id'] . "'";
		}
In admin/language/en-gb/customer/customer.php file,

find:

Code: Select all

entry_ip
add below:

Code: Select all

$_['entry_tax_rate']			= 'Tax Rates';
In admin/view/template/customer/customer_list.twig file,

find:

Code: Select all

<div class="form-group">
              <label class="control-label" for="input-status">{{ entry_status }}</label>
add above:

Code: Select all

<div class="form-group">
              <label class="control-label" for="input-tax-rate">{{ entry_tax_rate }}</label>
              <select name="filter_tax_rate_id" id="input-tax-rate" class="form-control">
                <option value=""></option>
                {% for tax_rate in tax_rates %}
                {% if tax_rate.tax_rate_id == filter_tax_rate_id %}
                <option value="{{ tax_rate.tax_rate_id }}" selected="selected">{{ tax_rate.name }}</option>
                {% else %}
                <option value="{{ tax_rate.tax_rate_id }}">{{ tax_rate.name }}</option>
                {% endif %}
                {% endfor %}
              </select>
            </div>
Then, find:

Code: Select all

var filter_status = $('select[name=\'filter_status\']').val();
add above:

Code: Select all

var filter_tax_rate_id = $('select[name=\'filter_tax_rate_id\']').val();
    if (filter_tax_rate_id !== '') {
      url += '&filter_tax_rate_id=' + encodeURIComponent(filter_tax_rate_id); 
    }
Then, follow this FAQ: viewtopic.php?f=134&t=215776#p718325 . This should resolved the issue.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Sat Mar 21, 2020 8:27 pm

Small instruction updated for the admin/controller/customer/customer.php file (last step).

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by kestas » Sat Mar 21, 2020 9:28 pm

thanos74 wrote:
Tue Mar 17, 2020 3:48 pm
Hello, i created at Customers a Custom Field, VAT.

Code: Select all

I want to search (at admin) Customers by VAT.
Any suggestion or plugin ?

Thank you
What you mean by VAT? You mean by VAT number?

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: pprmkr, thekrotek and 23 guests