Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Sep 2005
    Location
    Ocala, FL
    Posts
    494
    Plugin Contributions
    0

    Default Unable To Delete Country

    Hi Friends,
    We are no longer shipping to Canada (Only United States) and I am unable to delete the country.
    I get the following
    ERROR: Cannot delete selected country because it is connected to customer records.

    I have over 1000 registered users, what would be the best way to find the canada customers so I cant delete canada?

    Thanks for helping.

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Unable To Delete Country

    Instead of deleting it, you could just disable it using this plugin:
    http://www.zen-cart.com/downloads.php?do=file&id=1424

    I've been using it for a long time, should be a core feature (IMHO).
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #3
    Join Date
    Sep 2005
    Location
    Ocala, FL
    Posts
    494
    Plugin Contributions
    0

    Default Re: Unable To Delete Country

    Quote Originally Posted by torvista View Post
    Instead of deleting it, you could just disable it using this plugin:
    http://www.zen-cart.com/downloads.php?do=file&id=1424

    I've been using it for a long time, should be a core feature (IMHO).
    I checked out the module and it looks like it's for 1.50. I am using 1.39h. Will it still work for me? Maybe a different mod?
    Any other ideas on how I can delete Canada?
    thanks

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Unable To Delete Country

    I took a peek at the code for Selectable Countries and it won't work for your 1.3.9h store since the Zen Cart admin code was revamped for the v1.5.0 release and converted most of the form-related variables from GET to POST ones.

  5. #5
    Join Date
    Sep 2005
    Location
    Ocala, FL
    Posts
    494
    Plugin Contributions
    0

    Default Re: Unable To Delete Country

    Quote Originally Posted by lat9 View Post
    I took a peek at the code for Selectable Countries and it won't work for your 1.3.9h store since the Zen Cart admin code was revamped for the v1.5.0 release and converted most of the form-related variables from GET to POST ones.

    Thanks for checking.
    What do you recommend I need to do in MyphpAdmin to delete all canadian customers properly so that I can remove Canada successfully?
    All appreciated.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Unable To Delete Country

    Quote Originally Posted by spawnie69 View Post
    Thanks for checking.
    What do you recommend I need to do in MyphpAdmin to delete all canadian customers properly so that I can remove Canada successfully?
    All appreciated.
    I don't recommend that you delete anything with phpmyadmin. The database records (addresses, orders, etc.) are all intertwined in the database and just brute-forcing the customers out using phpmyadmin pretty much guarantees that you'll have database issues in the future.

    You could try a two-prong approach:
    1. Use phpmyadmin to run this query: SELECT customers_id FROM address_book WHERE entry_country_id=38; ... if your database uses a non-empty value, e.g. zen_, for the DB_PREFIX, prepend that value to address_book (e.g. zen_address_book).
    2. Using the customer_id values returned from phpmyadmin, use your Zen Cart admin to delete those customers. That will ensure that all appropriate records are deleted.

    Please note also that the above will not only delete customers whose primary address is in Canada, but any customer who has used a ship-to or bill-from address in Canada.

    Remember to backup your database before you start!

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Unable To Delete Country

    One thing to think about ...

    Are you wanting to just prevent shipping outside the US or purchasing from outside the US ...

    As in, can Grandma who lives in Canada buy little tiny Tim his new cruch, providing Tim lives in the US?

    If so, you could just add a Zone Definition for the US and add that to your shipping module(s) ... now, purchases can be made from anywhere but must be sent to an address in the US ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Sep 2005
    Location
    Ocala, FL
    Posts
    494
    Plugin Contributions
    0

    Default Re: Unable To Delete Country

    Quote Originally Posted by lat9 View Post
    I don't recommend that you delete anything with phpmyadmin. The database records (addresses, orders, etc.) are all intertwined in the database and just brute-forcing the customers out using phpmyadmin pretty much guarantees that you'll have database issues in the future.

    You could try a two-prong approach:
    1. Use phpmyadmin to run this query: SELECT customers_id FROM address_book WHERE entry_country_id=38; ... if your database uses a non-empty value, e.g. zen_, for the DB_PREFIX, prepend that value to address_book (e.g. zen_address_book).
    2. Using the customer_id values returned from phpmyadmin, use your Zen Cart admin to delete those customers. That will ensure that all appropriate records are deleted.

    Please note also that the above will not only delete customers whose primary address is in Canada, but any customer who has used a ship-to or bill-from address in Canada.

    Remember to backup your database before you start!
    Ok, I tried that approach and deleted all customers with Canada addresses.
    When I tried to delete the Country in my admin I still get the message:

    Cannot delete selected country because it is connected to customer records.

    Any ideas why? Thanks again.

  9. #9
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,262
    Plugin Contributions
    3

    Default Re: Unable To Delete Country

    Quote Originally Posted by spawnie69 View Post
    Any ideas why? Thanks again.
    Probably because of what AJEH says above...

    ... and the remainder of her advice is probably the best solution...
    19 years a Zencart User

  10. #10
    Join Date
    Sep 2005
    Location
    Ocala, FL
    Posts
    494
    Plugin Contributions
    0

    Default Re: Unable To Delete Country

    Quote Originally Posted by Ajeh View Post
    One thing to think about ...

    Are you wanting to just prevent shipping outside the US or purchasing from outside the US ...

    As in, can Grandma who lives in Canada buy little tiny Tim his new cruch, providing Tim lives in the US?

    If so, you could just add a Zone Definition for the US and add that to your shipping module(s) ... now, purchases can be made from anywhere but must be sent to an address in the US ...
    I did exactly as you mentioned and it worked! Thanks again Ajeh, you are always shedding the light for us all.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Unable to delete customer
    By plc613 in forum General Questions
    Replies: 30
    Last Post: 23 Apr 2014, 11:07 AM
  2. Unable to delete country
    By RiverCity in forum Basic Configuration
    Replies: 4
    Last Post: 21 Apr 2014, 02:57 PM
  3. Customer country, can't delete it
    By esl25 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Sep 2008, 03:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR