How to copy a complete category tree with content?

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
mkroeks
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Wed Jul 12, 2006 7:08 am

How to copy a complete category tree with content?

Post by mkroeks » Fri Aug 31, 2012 8:33 pm

I wonder how it is possible with Joomla 2.5 to make a copy of a category tree with their content also. So when I have a structure with top category 2012 under which there are categories for english and german in which further categories are, in which various articles are, then I would like to copy that whole tree to a top category "history" and rename the original 2012 to 2013.
Apparently I can move category trees with the article manager (category manager), but the articles in it, do not get copied, so I would have to copy each of them individually.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25975
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How to copy a complete category tree with content?

Post by Per Yngve Berg » Fri Aug 31, 2012 9:16 pm

Have you tried the Archive function?

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37287
Joined: Sat Apr 05, 2008 9:58 pm

Re: How to copy a complete category tree with content?

Post by Webdongle » Fri Aug 31, 2012 9:29 pm

If
You rename Category from 2012 to 2013
Then
Articles assigned to 2013

Because Articles display the names of the Categories but are set to the Category ID.
Therefore when you rename a Category it's ID remains the same. Thus the Categories will still be assigned to it and just display the new name(of the Category ID they are assigned to).

Does that help ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

mkroeks
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Wed Jul 12, 2006 7:08 am

Re: How to copy a complete category tree with content?

Post by mkroeks » Sat Sep 01, 2012 9:32 am

No. I would like to be able to make a copy of the tree WITH content. So that afterwards I have TWO category trees with the same articles in each. Articles and categories in copied tree then have each new IDs.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25975
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: How to copy a complete category tree with content?

Post by Per Yngve Berg » Sat Sep 01, 2012 9:53 am

Do an archive yearly. You will have 2009, 2010, 2011 etc. and the current issue.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37287
Joined: Sat Apr 05, 2008 9:58 pm

Re: How to copy a complete category tree with content?

Post by Webdongle » Sat Sep 01, 2012 11:14 am

mkroeks wrote:No. I would like to be able to make a copy of the tree WITH content. So that afterwards I have TWO category trees with the same articles in each. Articles and categories in copied tree then have each new IDs.
One Article assigned to 2 Categories .

Best I can suggest is Save each Category as 'Copy' or export from the database edit then import again. Then something like http://extensions.joomla.org/extensions ... tion/12374 so each Article can be assigned to more than one Category ???
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

mkroeks
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Wed Jul 12, 2006 7:08 am

Re: How to copy a complete category tree with content?

Post by mkroeks » Sat Sep 01, 2012 11:59 am

I am sorry, I seem not to be making myself clear.

Programmatically it would mean:
Example:
|
--- 2012 --- category1 ---
| . . . . . |
| . . . . . .--- category2 --- etc.
|
--- History --- 2011 --- etc.
. . . . . . . |
. . . . . . . .--- 2010 --- etc.

(dots are for spacing only)

Question:
Each year I want to make a COPY of the tree 2012 into HISTORY. The articles and categories in HISTORY can get new IDs, but the ones in the 2012 original should keep the same IDs. Then I rename the 2012 into 2013 and I adjust the articles, but do not have to write them all anew.
How can I create this copy? (Just like when you copy a folder in your favorite OS and paste it somewhere else, the original remains and you get new files and structure elsewhere.)

Given:
The top node of the tree I want to copy, eg. "2012"
The destination "History" where the tree should be hung under.

Sollution: (How I imagine it should be done)
1. Copy the category tree in the database, with new IDs, keeping a table with source->destination IDs
2. Copy the files from the source to the destination using the table into the newly created categories, with new IDs.

Thats all.
Then I can use Category List to show the categories in History and all is taken care of.

How to do this with Joomla?

Archiving does not leave me the source articles and does not give the tree structure in frontend display.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37287
Joined: Sat Apr 05, 2008 9:58 pm

Re: How to copy a complete category tree with content?

Post by Webdongle » Sat Sep 01, 2012 4:55 pm

Create the Category 'History'
Move Category '2012' to the 'History' Category
If the subCategories of '2012' do not move with it then move them after.

That Articles will still be associated with the same Categories as before because the Category ID's(of the original Categories will be the same

You could have

Main Category
--- Current
. . . . . . . .--- 2012 --- etc.
--- History
. . . . . . . .--- 2011 --- etc.
. . . . . . . |
. . . . . . . .--- 2010 --- etc.

Then at the end of the year move 2012 to History
Main Category
--- Current
. . . . . . . .--- 2013 --- etc.
--- History
. . . . . . . .--- 2012 --- etc.
. . . . . . . |
. . . . . . . .--- 2011 --- etc.
. . . . . . . |
. . . . . . . .--- 2010 --- etc.

Having a main Category that Current and History Categories are in IMHO makes for a more logical structure. You can then move the year Category to History and the Articles will still be associated correctly.

You menu structure would also be correct because you can have menu items to 'Current' and 'History. And they would always point correctly.

Once moved to History, you can make a copy of 2012 and it's subCategories to Current'. The Copies in Current will have their own (newly created) ID's to which you can assign the new 2013 Articles to.

To summarise:

If you want Articles to be associated with the same Category then just move the Category. And then make a copy to it's old place(in hierarchy) for new Articles to be assign to the new Category.

If you want many Articles to be associated with a Category of a different name ... then just rename the Category. And then make a copy(of the Category) to another place in the hierarchy ready for new Articles to be assigned to it.

Hope that helps.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

mkroeks
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Wed Jul 12, 2006 7:08 am

Re: How to copy a complete category tree with content?

Post by mkroeks » Sat Mar 04, 2017 9:06 pm

Just like c you were to make a copy of a folder on your filesystem, you would just copy the folder and paste it somewhere else and everything in it, including subdirectories and their content, would be copied. I want to do that with a Joomla category.


Locked

Return to “Administration Joomla! 2.5”