Q: How to add Customer Region / State column in admin for Opencart? I'm struggling with OC 2.0.1.1, adding to admin side just a single Region / State column. I found a free vqmod module for customer cities. It's working perfectly using the City data. I even tried to modify for Region-State but could'nt make it.
In my country, we use regions more than cities and I'm stuck here. Any help would be a gold.
Here is the vqmod module what I'm trying to modify : 
    <?xml version="1.0" encoding="UTF-8"?>
<modification>
   <id><![CDATA[<font color="#000000"><b>Customer Cities in Admin</b></font>]]></id>
   <version><![CDATA[1.0<br><b>OC:2.0.3.1</b>]]></version>
   <vqmver><![CDATA[2.5.1]]></vqmver>
   <author><![CDATA[<font color="#0C9603"><b>aljawaid</font><br><font color="#0C9603"><a href="mailto:aljawaid@hotmail.co.uk">aljawaid@hotmail.co.uk</a></font>]]></author>
   <comment><![CDATA[ THIS FILE IS PROVIDED AS-IS WITHOUT ANY WARRANTY OR SUPPORT ]]></comment>

   <!-- THIS EXTENSION WILL SHOW THE CUSTOMER'S SAVED CITIES IN THE CUSTOMER LIST - USEFUL IF ONLY DELIVERING TO ONE COUNTRY -->
   <!-- THIS EXTENSION IS INSPIRED BY: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=21191 -->

<file name="admin/controller/sale/customer.php">

    <operation info="ADD TO CONTROLLER" error="log">
      <search position="before"><![CDATA[
        'ip'             => $result['ip'],
      ]]></search>
      <add><![CDATA[
        'city'        => $result['city'],
      ]]></add>
    </operation>

</file>

<file name="admin/model/sale/customer.php">

    <operation info="ADD TO MODEL" error="log">
        <search position="replace"><![CDATA[
            $sql = "SELECT *, CONCAT(c.firstname, ' ', c.lastname) AS name, cgd.name AS customer_group FROM " . DB_PREFIX . "customer c LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (c.customer_group_id = cgd.customer_group_id) WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
        ]]></search>
        <add><![CDATA[
            $sql = "SELECT *, CONCAT(c.firstname, ' ', c.lastname) AS name, cgd.name AS customer_group ,
                (
                    SELECT GROUP_CONCAT(ctty.city,'=',ctty.city)
                    FROM " . DB_PREFIX . "address addr 
                    LEFT JOIN " . DB_PREFIX . "address ctty 
                    ON (addr.city = ctty.city) 
                    WHERE addr.customer_id = c.customer_id
                ) as city
                    FROM " . DB_PREFIX . "customer c 
                    LEFT JOIN " . DB_PREFIX . "customer_group_description cgd 
                    ON (c.customer_group_id = cgd.customer_group_id)
                    WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
        ]]></add>
    </operation>

</file>

<file name="admin/view/template/sale/customer_list.tpl">
    <operation info="ADD COLUMN TITLE" error="log">
        <search position="before"><![CDATA[
            <td class="text-left"><?php if ($sort == 'customer_group') { ?>
        ]]></search>
        <add><![CDATA[
            <td style="font-weight:normal;" class="text-left">Location(s)</td>
        ]]></add>
    </operation>

<!-- IF CUSTOMER HAS MULTIPLE LOCATIONS SAVED IN THEIR ADDRESS BOOK, THEN ALL CITIES WILL BE SHOWN -->
<!-- IF CUSTOMER HAS NO ADDRESS THEN "NO ADDRESS" WILL BE SHOWN -->
    <operation info="ADD SAVED CITY FOR EACH CUSTOMER" error="log">
        <search position="before"><![CDATA[
            <td class="text-left"><?php echo $customer['customer_group']; ?></td>
        ]]></search>
        <add><![CDATA[          
            <td style="text-align: left;">
            <?php 
                $get_city = explode(',',$customer['city']);
                foreach($get_city as $i =>$key) {
                    //echo $i.' '.$key .'</br>';
                    $separate = explode('=',$key);
                    $city_name = $separate[0];
            ?>

                <span><?php if ($city_name) { ?> <i class="fa fa-map-marker" data-toggle="tooltip" data-placement="left" title="Saved in customer's address book"></i>
                <?php } 
                else { ?><span style="font-style:italic; color:red;" data-toggle="tooltip" data-placement="right" title="This customer has not saved any addresses yet">No address</span>
                <?php } ?>
                <?php echo $city_name; ?></span><br>                
            <?php } ?>
            </td>           
        ]]></add>
    </operation>
</file>     

</modification>


A: You can get zones for each customer and then echo it in tpl file:
$zones = $this->db->query("SELECT zone_id FROM " . DB_PREFIX . "address WHERE customer_id = '" . $result['customer_id'] . "'" );
$zone_info = array();
foreach($zones->rows as $zone){
    $zone_info[] = $this->model_localisation_zone->getZone($zone['zone_id'])['name'];
}
$data['customers'][] = array(
    'zone'        => $zone_info,

I've create a vqmod file:
<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <id>Display customer zone in admin customer list</id>
   <version>1</version>
   <vqmver>2.x</vqmver>
   <author>Mojtaba Sabeti</author>

<file name="admin/controller/sale/customer.php">
    <operation error="log">
      <search position="after"><![CDATA[$results = $this->model_sale_customer->getCustomers($filter_data);]]></search>
      <add><![CDATA[
        $this->load->model('localisation/zone');
      ]]></add>
    </operation>
    <operation error="log">
      <search position="replace"><![CDATA[$data['customers'][] = array(]]></search>
      <add><![CDATA[
            $zones = $this->db->query("SELECT zone_id FROM " . DB_PREFIX . "address WHERE customer_id = '" . $result['customer_id'] . "'" );
            $zone_info = array();
            foreach($zones->rows as $zone){
                $zone_info[] = $this->model_localisation_zone->getZone($zone['zone_id'])['name'];
            }
            $data['customers'][] = array(
                'zone'        => $zone_info,
      ]]></add>
    </operation>
</file>

<file name="admin/view/template/sale/customer_list.tpl">
    <operation error="log">
        <search position="before"><![CDATA[
            <td class="text-left"><?php if ($sort == 'customer_group') { ?>
        ]]></search>
        <add><![CDATA[
            <td style="font-weight:normal;" class="text-left">Zones</td>
        ]]></add>
    </operation>

    <operation error="log">
        <search position="before"><![CDATA[
            <td class="text-left"><?php echo $customer['customer_group']; ?></td>
        ]]></search>
        <add><![CDATA[          
            <td style="text-align: left;">
            <?php
                foreach($customer['zone'] as $zone){
                    echo "<div>$zone</div>";
                }
            ?>
            </td>
        ]]></add>
    </operation>
</file>     

</modification>

