how to change a existing multi menu type into a category type

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 3, 2010   (RSS)

Re: [drewh01] how to change a existing multi menu type into a category type

By Chris - November 3, 2010

Hi drewh01,

That's not exactly easy! Our consulting team could do this for you, but if you want to do it yourself, here's an approach that should work:

1. Back up your database!

2. Write down or take screenshots of how you've got all your fields configured. You'll need this information after you've deleted your section and are recreating it!

3. Make sure you have the [url http://www.interactivetools.com/add-ons/detail.php?MySQL-Console-1011]MySQL Console Add On[/url] or some other way to run arbitrary SQL on your database.

4. Figure out the full name of your section's table. In the section editor, this is the Table Name in the General tab including the prefix outside of the text field. For my example, this will be cms_my_section.

5. Create a new table in SQL to copy your records to:

CREATE TABLE cms_temp LIKE cms_my_section;

6. Copy your records to the new table:

INSERT INTO cms_temp SELECT * FROM cms_my_section;

7. Delete the section from CMS Builder.

8. Create a new Category Menu with the same name as your old section. You want to use the same name to preserve relationships with the uploads table.

9. Add all your fields to your new section using the Section Editor.

10. Copy all the records back. You'll need to adjust this query to include all your fields. In my example, my only "non-system" fields are title and content:

INSERT INTO cms_new_category_menu (
num, globalOrder, siblingOrder, lineage, depth, parentNum, breadcrumb, createdDate, createdByUserNum, updatedDate, updatedByUserNum,
title, content
)
SELECT
num, 0 as globalOrder, 0 as siblingOrder, "" as lineage, 0 as depth, 0 as parentNum, "" as breadcrumb, createdDate, createdByUserNum, updatedDate, updatedByUserNum,
title, content
FROM cms_my_section


11. Finally, edit and save any record in your new Category Menu. This should force all those special fields you just added to fill with meaningful data.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] how to change a existing multi menu type into a category type

By drewh01 - November 3, 2010

oh boy - I am not sure I can take something like that on right now.

I suppose the other method would be to just create a new category menu and copy and paste the data in the fields.