It looks like the operations I listed above worked.
For the benefit of anyone who has accidentally deleted the standard, HikaShop-defined values of a zone, here is an outline of the restoration, using example values.
The following information is for illustration purposes only: I assume no responsibility for anything you may do to any websites. By reading the following you agree and affirm that you assume all liabiility for any of your actions that may mimic, reference or be influenced by the information given below, and for any and all correlative or derivative actions, conditions or situations. D*mned American lawyers.
Example values:
local table prefix (yours should vary): xxxx4
(the following are system-standard or system-generated values)
Deleted zone_id: state_Texas_4307
Created zone_id: state_Texas_2042366762
Example values will be italicized below.
BACKUP YOUR DATABASE FIRST!
Take your shop offline so no one can step on the database while you're working on it.
- Locate the data entry for the zone in administrator/components/com_hikashop/helpers/update.php and write down those standard values. (Do not ever edit this file!)
- To help verify the SQL steps below, go ahead and recreate the zone inside the HikaShop admin using as many of the standard values (from the step above) as the entry form allows.
- Check the drop down list for the zones as displayed in the address fields' drop-downs. (e.g., HikaShop admin=>Display=>Custom Fields=>address_state=>Default value) Your new entry should be there, but you may have to search for it because the list will no longer be sorted in exactly the same way because it is (apparently) done on the zone_id column, and your new entry will have a zone_id that no longer fits within the sorted range of values of those already in the built-in list.
- Go to your site's SQL database control, hopefully this is phpMyAdmin.
- Verify that your new entry is in the zone table: SELECT * FROM 'xxxx4_hikashop_zone' WHERE 'zone_name'='Texas' You should get one row. Write down the values from all the columns.
- Verify that your new entry is in the zone-linking table: SELECT * FROM 'xxxx4_hikashop_zone_link' WHERE 'zone_child_namekey'='state_Texas_2042366762' You should get one row. Write down its data entries.
- Verify that the entry of the original zone is still in the zone-linking table: SELECT * FROM 'xxxx4_hikashop_zone_link' WHERE 'zone_child_namekey'='state_Texas_4307' You should get one row.
- Go back to the zone table and insert the original row's values: INSERT INTO xxxx4_hikashop_zone (zone_id, zone_namekey, zone_name, zone_name_english, zone_code_3, zone_type, zone_published, zone_currency_id) VALUES (4307, 'state_Texas_4307', 'Texas', 'Texas', 'TX', 'state', 1, 0)
(Note: if your zone's data has a zone_code_2 entry, add that column name to the VALUES list, and put its value in the same relative position in the actual value list as the column name is in the VALUES list. Any column for which there is no data can be omitted from both lists.)
- Now delete the row of the new zone that you created: DELETE FROM xxxx4_hikashop_zone WHERE zone_namekey='state_Texas_2042366762'
- Return to the zone-link table and delete the link to the row you just deleted: DELETE FROM xxxx4_hikashop_zone_link WHERE zone_child_namekey='state_Texas_2042366762'
This should have those two tables reset to their original data values.
I realize that this is a daunting set of operations, particularly for those who haven't used SQL before. However, it is important that you get some experience with SQL and familiarity with its basic operations at the least. The HikaShop team can't possibly cover every exigency that might arise, so you may have to get your hands dirty, working in the grime of the SQL engine to fix things as they hit your site.
Ed