Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Managing Customers and Orders / Can I change the Country to a State at the "customers" page?

Can I change the Country to a State at the "customers" page?

Locked
This thread is locked. New replies are disabled.
23 Apr 2008, 2:24 AM
#1
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Post #1 by daneh

I sell a product that requires me to pre-program a timer that is used for plant propagation. It requires specific settings depending on geographical location and time zone.
Some of my customers want settings that are the same or similar to fellow grower in the same state. The only problem with that, is that there is no way for me to locate a customer from the same state as the new customer easily. I have to go to Admin/customers, and "edit" each customer just to view the state they are from. I do this for ALL customers until I find the one I need. VERY time consuming!!!:bangin:
I was thinking that if I could change the Country: to State: in Admin/Customers, (to be specific, the greyish box to the right) I could quickly scan all my customers from the Admin, and find someone that is in the same state as the new customer.
Is this possible? Is it as simple as changing the Country: to State: in the customers.php file?
Or is there a better way do do this?

Please forgive me...I know very little about coding.:smile:

23 Apr 2008, 3:32 AM
#2
get_em_fast avatar

get_em_fast

Totally Zenned

Join Date:
Dec 2006
Location:
Seligman, MO U.S.A.
Posts:
2,072
Plugin Contributions:
1

Post #2 by get_em_fast

Admin>Configuration>Minimum Values........State..........should already be set on 2

Admin>Configuration>Customer Details.........State-Always display as pulldown?
Set to pulldown for a pulldown list of states, or not for them to type their state in.

Hope this helps. But it won't will it. Just noticed that your are talking about displaying the state of the customer in the ADMIN area, right?

Teach them to shop and they will shop today;
Teach them to Zen and they will OWN a shop tomorrow!

23 Apr 2008, 10:39 AM
#3
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Post #3 by daneh

Correct.
In the Admin/customers. There is a box on the right that displays information about the customer...Name, GV balance, country, etc. I don't need the country, I need the state.

23 Apr 2008, 10:53 AM
#4
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Post #4 by fairestcape

Unfortunately, it's not just a case of changing the "label" of the field, because structure of the database and much of the operational side of the site (country ISO codes), shipping, billing, taxes, etc... are factored into this complex structure.

You may need to get some custom coding done so that you can get a report out of the dbase that reflects the STATE, and not the country.

Alternatively, in:-

admin/customers.php, around lines 1178 to 1198, there is this code:-

        $heading[] = array('text' => '<b>' . TABLE_HEADING_ID . $cInfo->customers_id . ' ' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');

        $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=confirm', 'NONSSL') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br />' . ($customers_orders->RecordCount() != 0 ? '<a href="' . zen_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id, 'NONSSL') . '">' . zen_image_button('button_orders.gif', IMAGE_ORDERS) . '</a>' : '') . ' <a href="' . zen_href_link(FILENAME_MAIL, 'origin=customers.php&mode=NONSSL&selected_box=tools&customer=' . $cInfo->customers_email_address.'&cID=' . $cInfo->customers_id, 'NONSSL') . '">' . zen_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');
        $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_CREATED . ' ' . zen_date_short($cInfo->date_account_created));
        $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . zen_date_short($cInfo->date_account_last_modified));
        $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_LAST_LOGON . ' '  . zen_date_short($cInfo->date_last_logon));
        $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons);

        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customers_orders->fields['amount']));

        $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $customers_orders->RecordCount());
        if ($customers_orders->RecordCount() != 0) {
          $contents[] = array('text' => TEXT_INFO_LAST_ORDER . ' ' . zen_date_short($customers_orders->fields['date_purchased']) . '<br />' . TEXT_INFO_ORDERS_TOTAL . ' ' . $currencies->format($customers_orders->fields['order_total'], true, $customers_orders->fields['currency'], $customers_orders->fields['currency_value']));
        }
        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name);
        $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews);
        $contents[] = array('text' => '<br />' . CUSTOMERS_REFERRAL . ' ' . $cInfo->customers_referral);
      }
      break;
  }

(This is the bit that renders the grey box on the right hand side of the screen in your admin console for customers).

... if you look at the line:-

        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name);

I don't see why this can't be tweaked to throw back the STATE, instead of the COUNTRY.

(As I am not familiar with the dbase reference, I can't help, but I would imagine it's simply a case of changing:-

TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name);

to something like:-

TEXT_INFO_STATE . ' ' . $cInfo->state_name);

In other words, make sure you choose the correct identifier for STATE...

Perhaps someone like Kuroi can help us here :yes:

23 Apr 2008, 10:57 AM
#5
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Post #5 by fairestcape

Okay.. I just tried a quick edit on my site, changing COUNTRY to STATE, and it's not the right identifier...

But if you find the right identifier, it should work...

23 Apr 2008, 1:22 PM
#6
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,194
Plugin Contributions:
0

Post #6 by haredo

Fair,
Nice try, you are very close,
I played with this last night and got close, but not cigar.
I tried to place it On the Data Table Sheet beside the Last Name, so he can

  1. admin panel/ customers/ customers
  2. I tried to replace Country with State here on the Data Table Sheet.
  3. So he can scan the entire sheet at once, instead on individual clicks for each customer

It's just a little more intensive of .php knowledge..

Oh, where are you at Ajeh, Dr. Bytes, Kim, Kuroi, Kobra, Gjh42, Dbltoe, Yellow1912 & I can't forget Clydejones

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

23 Apr 2008, 2:58 PM
#7
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Post #7 by barco57

ok my 2 cents.....after looking at the customer.php....might it be easier to add to the a.entry_state into the search query. Than you could just search for the state......than you don't have to try and build a new spot to display the state, they can just be grouped on a search......ok if you ask me how, I'll be hiding over there under that rock.....

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

23 Apr 2008, 11:11 PM
#9
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Post #9 by daneh

I guess I am on a hunt.
Nope not this rock.
How about this one? Nope.
HMM, I think I see something. Yep, It is Barco....

Question for ya...What the hell are you talking about?...LOL.
What search string?
My total knowledge of PHP programming is where the letters PHP are located on the keyboard:smartalec:

24 Apr 2008, 3:00 AM
#10
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Post #10 by barco57

This section of customers.php ```
$search = '';
if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
$keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
$search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike ':keywords:' or a.entry_company rlike ':keywords:' or a.entry_street_address rlike ':keywords:' or a.entry_city rlike ':keywords:' or a.entry_postcode rlike ':keywords:'";
$search = $db->bindVars($search, ':keywords:', $keywords, 'regexp');
}
$new_fields=', c.customers_telephone, a.entry_company, a.entry_street_address, a.entry_city, a.entry_postcode, c.customers_authorization, c.customers_referral';
$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_group_pricing, a.entry_country_id, a.entry_company, ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created " . $new_fields . ",
cgc.amount
from " . TABLE_CUSTOMERS . " c
left join " . TABLE_CUSTOMERS_INFO . " ci on c.customers_id= ci.customers_info_id
left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id " . "
left join " . TABLE_COUPON_GV_CUSTOMER . " cgc on c.customers_id = cgc.customer_id " .
$search . " order by $disp_order";


Notice the lack of state......you can search your customer list by any of the others listed but state is absent.....I just cant figure out how to put it in there


*now to go back under my rock*

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

24 Apr 2008, 4:27 AM
#11
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,194
Plugin Contributions:
0

Post #11 by haredo

Bump :smile:

		 				Oh, where are you at Ajeh, Dr. Bytes, Kim, Kuroi, Kobra, Gjh42, Dbltoe, Yellow1912 & I can't forget Clydejones

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

26 Apr 2008, 7:15 PM
#12
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Post #12 by daneh

No one else has suggestions?
I'll keep waiting patiently till someone comes along....:smile:

26 Apr 2008, 8:41 PM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #13 by drbyte

daneh:

I was thinking that if I could change the Country: to State: in Admin/Customers, (to be specific, the greyish box to the right) I could quickly scan all my customers from the Admin, and find someone that is in the same state as the new customer.

To do that, change the following sections of code as shown:

Starting at line 1043, add the indicated text:```
$new_fields=', c.customers_telephone, a.entry_company, a.entry_street_address, a.entry_city, a.entry_postcode, [B]a.entry_zone_id, [/B]c.customers_authorization, c.customers_referral';


And starting at line 1091 (in v1.3.8), make the indicated changes:```
      if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $customers->fields['customers_id']))) && !isset($cInfo)) {
        $country = $db->Execute("[B]select zone_name as countries_name
                                 from " . TABLE_ZONES . "
                                 where zone_country_id = '" . (int)$customers->fields['entry_country_id'] . "'
                                 and zone_id = '" . (int)$customers->fields['entry_zone_id'] . "'"[/B]);

        $reviews = $db->Execute("select count(*) as number_of_reviews
                                 from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers->fields['customers_id'] . "'");

        $customer_info = array_merge($country->fields, $info->fields, $reviews->fields);

        $cInfo_array = array_merge($customers->fields, $customer_info);
        $cInfo = new objectInfo($cInfo_array);
      }

This is a quick hack to prevent having to change things elsewhere as well. There are more elegant, more complicated ways of doing it.

You'll have to change the word "Country:" as desired via the language file in your admin folders.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Apr 2008, 12:15 AM
#14
daneh avatar

daneh

Zen Follower

Join Date:
Dec 2007
Location:
Southern Maine
Posts:
268
Plugin Contributions:
0

Post #14 by daneh

Dr. Byte you are AWESOME!!!!:smartalec:
I knew one of you masters could figure it out.
You have just saved me a lot of time.
Off to the donation page I go.
Thanks.