Page 1 of 1

Customer List Sort or Filter by Custom Field

Posted: Mon Feb 08, 2016 2:49 pm
by TurboTechie
I am trying to find a way to sort customer list and/or filter it by using a custom field that I added to customer contact. I need to find a way to sort or filter the customer list in admin view in order to quickly locate customers by the custom field.
If anyone knows a way to do this or has any suggestions I would be gratefully appreciated.

Thank you.

Posted: Mon Feb 08, 2016 3:13 pm
by madimar
Hi, I think the only way is to develop a specific mod for it. I don't think there's anything ready on the market. You could even try to develop by your self if you have some programming knowledge, simply amalyzing current code.

Regards,

M

Inviato dal mio Find 5 utilizzando Tapatalk

Re: Customer List Sort or Filter by Custom Field

Posted: Mon Feb 08, 2016 4:16 pm
by TurboTechie
I have already traced down the files that need to be edited however for some reason custom fields are stored as an array in open cart. I have no problem editing the source codes from the php's and tpl's with standard fields but whenever I try to call an array it doesn't work. According to all the code I have analyzed nothing in Open Cart calls an array field anywhere so not sure of the coding to be honest. Not sure exactly what I am doing wrong. Been messing with it for almost 12 hours to no avail. I am either missing something or doing something wrong but I cant figure it out. One of my problems mainly seems to stem from the language file. When ever I add an entry or make any modifications to the language file it just crashes which is extremely odd for some reason. But I need to edit the language file for it to pull the text values for all appropriate pages. At this point I am just stuck. So thought I would seek some help here.

Here is a few sections of code that would need to be modified.

from opencart\admin\view\template\customer\customer_list.tpl

Code: Select all

<div class="form-group">
<label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
<input type="text" name="filter_name" value="<?php echo $filter_name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
</div>
When ever I edit the language file to include an entry_custom_company = 'Company Name' the system crashes. I could hard code this part I guess. How ever trying to edit the rest with filter_(name of field) nothing works since it is a stupid array. It doesn't crash just doesn't work.

from opencart\admin\controller\customer\customer.php

Code: Select all

if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}
Same here trying to edit the filter_(field Name) to call an array fails. It doesn't crash just doesn't work.
Seems like the only time the site will crash is when the language file is modified.

Looking at the way it displays in the web source however is even more confusing.

from source code from customers showing data field.

Code: Select all

<div class="form-group custom-field custom-field1" data-sort="0">
<label class="col-sm-2 control-label" for="input-custom-field1">Company Name</label>
<div class="col-sm-10">
<input type="text" name="custom_field[1]" value="tts" placeholder="Company Name" id="input-custom-field1" class="form-control" />
</div>
</div>
looking at the name and input it seems to call an array to display the data. Which is interesting and confusing.

Attached is a few screen shots of what I am trying to accomplish as well as a screenshot from phpMyAdmin showing how the value is stored.

Thank you.

Re: Customer List Sort or Filter by Custom Field

Posted: Thu Jul 27, 2017 7:32 pm
by mupcku
Im searching for the same thing, but about products filtering