New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing hierarchical categories doesn't work #131

Closed
wpsmort opened this Issue Jan 20, 2017 · 12 comments

Comments

Projects
None yet
4 participants
@wpsmort
Copy link
Member

wpsmort commented Jan 20, 2017

When you export from an existing site that has locations in hierarchical categories and then import that into a new site, the categories all become top level categories with no hierarchy.

I tested this in v2.4.8 and it didn't work in that version. It's possible that this never worked. We should test back through old versions and see if we ever supported importing of hierarchical categories.

This was identified whilst testing #98.

@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Jan 20, 2017

@arnaudbroes Do you want to have a go at testing this. Let me know if you need my help.

If you set up some hierarchical Location categories and add some locations to them and then export all locations, delete your locations by using the "remove all locations" link on the General Options screen and then import from your export file.

@michaeltorbert

This comment has been minimized.

Copy link
Member

michaeltorbert commented Jan 20, 2017

There should also be testing done with older version of WP... I wonder if the 4.4 changes did it.
@arnaudbroes You may want to keep a spreadsheet of what versions of SimpleMap have been tested with what versions of WordPress

@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Jan 21, 2017

@michaeltorbert I tested with an old back of simplemap-plugin.com from January 2013 which was running WordPress v3.5 and SimpleMap v2.4.5 and confirmed that this did not work then.

@arnaudbroes

This comment has been minimized.

Copy link
Collaborator

arnaudbroes commented Jan 21, 2017

I tested this with WordPress v3.3.1, SimpleMap 2.4.4 and some newer releases of WP and SM, did not work.
Tested some older versions in WordPress 2.0 and those didn't seem to work either.

@arnaudbroes arnaudbroes removed their assignment Jan 21, 2017

@wpsmort wpsmort assigned michaeltorbert and unassigned wpsmort Feb 7, 2017

@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Feb 7, 2017

This may actually have never worked because when I look at the export file there's nothing to distinguish a sub-category. All categories show as a comma delimited list regardless of hierarchy, i.e.

Business, Personal, Family Sub-category

We need to identify a way of denoting category structure in our importer/exporter. For example, the WooCommerce CSV importer uses this format:

Parent Category > Child Category

@contactashish13

This comment has been minimized.

Copy link
Contributor

contactashish13 commented Mar 22, 2017

@wpsmort @michaeltorbert PR: #210

I'm using | (pipe) to separate the parent and child category. I hope that's ok.

I see the PR was rejected but it looks like all the violations are from other pieces of code. I'm not sure how to proceed here. Any pointers would be great.

@michaeltorbert

This comment has been minimized.

Copy link
Member

michaeltorbert commented Mar 22, 2017

In the interest in keeping everything together, Ashish's earlier remarks:

Ok. So I believe the problem is two-fold

  1. While exporting, we are only exporting the term name without the parent. Maybe we should export it in the format "parent term/child term" or add a separate column for the parent
  2. While importing, we set hierarchical = false but it should be true and the parent should also be provided when using wp_insert_term
@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Mar 22, 2017

@contactashish13: I've tested this and found that it only supports two levels - Parent Category | Sub Category. This should support any number of levels, for example:

Parent | Sub Cat | Sub Sub Cat | etc...

@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Mar 22, 2017

I've closed pull request 210

@wpsmort wpsmort assigned contactashish13 and unassigned wpsmort Mar 22, 2017

@wpsmort wpsmort added this to the 2.5.1 milestone Mar 22, 2017

contactashish13 added a commit to contactashish13/simplemap that referenced this issue Mar 23, 2017

@contactashish13

This comment has been minimized.

Copy link
Contributor

contactashish13 commented Mar 23, 2017

@wpsmort I've added support for N levels. PR: #218

@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Mar 23, 2017

This is tested and is good. I tested up to 5 levels deep for sub categories, i.e.

Level 1 | Level 2 | Level 3 | Level 4 | Level 5

michaeltorbert added a commit that referenced this issue Mar 23, 2017

Importing hierarchical categories doesn't work #131 (#218)
* Importing hierarchical categories doesn't work #131

* Importing hierarchical categories doesn't work #131

support N level hierarchy
@wpsmort

This comment has been minimized.

Copy link
Member Author

wpsmort commented Mar 23, 2017

This is tested and is good.

@wpsmort wpsmort closed this Mar 23, 2017

@wpsmort wpsmort modified the milestones: 2.6, 2.5.1 Mar 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment