Keyword

how to convert k2 items to default joomla articles

More
11 years 1 month ago #75120 by Davor
sorry for bumping old topic but still nobody find a solution for this

so I'm using j3.1.5 and I want to move K2 items to joomla content
I'm unsuccessfully using this sql query command but no luck, what am I doing wrong?

insert into `ZZZ_content` (id, title, alias, catid, introtext, fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, modified, modified_by, publish_up, publish_down, access, featured, hits, language) select id, title, alias, catid, introtext, fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, modified, modified_by, publish_up, publish_down, access, featured, hits, language from `ZZZ_k2_items`

- where ZZZ is prefix
- error I get: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext, created, created_by, created_by_alias, checked_out, checked_out_time, ' at line 1

Please Log in or Create an account to join the conversation.

More
11 years 1 month ago #75121 by Davor
this query worked for me!! I'm using joomla 3.1.5, k2 2.6.7

INSERT INTO `yourDBname`.`prefix_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`
FROM `yourDBname`.`prefix_k2_items`

Please Log in or Create an account to join the conversation.

More
11 years 1 month ago #75122 by Davor
and DON'T FORGET to fix asset_id. Here's how docs.joomla.org/Fixing_the_assets_table otherwise you will have indexing problems at home page, categories and so on. Fix asset

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #75123 by karlo
How can you move images, and tags from K2 into Joomla articles? I have 3000 articles with pictures... :(

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #75124 by Davor
I don't know about tags, I didn't move them but I moved images this way:

1. Found out URL of K2 images, e.g. /media/k2/items/cache/319a6b58175c8348e5b537a311344d30_S.jpg

2. Put any image into Joomla article to see structure in database. And I saw the structure is like this:
{"image_intro":"images\/some_folder\/e0a70f72bdae9885bfc32d7cd19a26a1_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
Notice that link is images \ / some_folder \ / (without empty spaces, so backslash and slash)

3. Copied all images from old website from old folder /media/k2/items/cache/ to my new website and new folder /images/some_folder/

4. I than open xxx_content (where xxx is db prefix) table in my database and put that code from #2 inside all articles (450) but without url of image, so I put it like this:
{"image_intro":"images\/some_folder\/_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
Notice that there isn't url of image, structure is images \ / some_folder \ / _S.jpg

5. And than I opened 2 tabs (or explorer windows) and
a) opened first K2 item, copy url
b) opened database of new website and paste name of that picture inside xxx_content, not the whole url, just the image name (if url is /media/k2/items/cache/319a6b58175c8348e5b537a311344d30_S.jpg I copied just 319a6b58175c8348e5b537a311344d30 without _S.jpg and rest of the url) along with images field structure in #4
c) and now inside database the whole structure of images field of that first article is:
{"image_intro":"images\/some_folder\/319a6b58175c8348e5b537a311344d30_S.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}

6. Again paste that structure in images filed in database of new website and copy-paste image name in url.

It's a bit complicated but it will took you just 30 sec when you know what are you doing. Do this or let cms2cms do this for you for 200-300 $ (price depends on how many articles you have). OR when you have all your articles migrated from K2 to joomla, using method I posted above, you can open every article and upload image. You see how this will be hard to do? It's simpler to follow my steps

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago - 11 years 3 weeks ago #75125 by karlo
Thank you, Davor!!!
I'll try what you offer. I think I understand. I moved articles, categories and tags using MYSQL. I could only picture and synchronizing tags with articles.

That's how I moved tags, but I changed the table structure jos_k2_tags

TAGS
INSERT INTO `DBNAME_news`.`jos_tags` (`id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`) 
SELECT `id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`
FROM `DBNAME_news`.`jos_k2_tags`

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #75126 by Flavia Silveira
Replied by Flavia Silveira on topic Re: how to convert k2 items to default joomla articles
I'm going to attempt this daunting move with a 2.5 site. Can someone post the SQL queries for moving the content, categories and tags here?

Thank you in advance,

Flavia

Flavia
Geek. Author. Role Player.

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #75127 by karlo
I used these, but before that I changed a few of the fields of k2 tables to suit those in PREFIX_content ...PREFIX_categories
I advise if items are few, transfer them manually
I hope you understand?


CATEGORIES

INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_categories` (`id`, `title`, `alias`, `published`, `access`, `parent_id`, `language`, `extension`, `level`, `path`, `params`, `asset_id`)
SELECT `id`, `title`, `alias`, `published`, `access`, `parent_id`, `language`, `extension`, `level`, `path`, `params`, `asset_id`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_categories`



Articles

INSERT INTO `DATABASENAME_PREFIX`.`PREFIX_content` (`id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`)
SELECT `id`, `title`, `alias`, `catid`, `introtext`, `fulltext`, `created`, `created_by`, `created_by_alias`, `checked_out`, `checked_out_time`, `modified`, `modified_by`, `publish_up`, `publish_down`, `access`, `featured`, `hits`, `language`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_items`


TAGS

INSERT INTO `DATABASENAME_PREFIX`.PREFIX_tags` (`id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`)
SELECT `id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `title`, `alias`, `published`, `access`, `language`
FROM `DATABASENAME_PREFIX`.`PREFIX_k2_tags`

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #75128 by Andreas A
Thank you guys, your input proved invaluable!

I managed to move my K2 items succefully, with no intro image though.

Davor, I tried to understand your steps, and I'm not sure I did. It is still a manual task that has to be done in each article seperately, right?

I was wondering if it could be done with a query or something. But looking into the k2 items db, I wasn't able to see anything relevant to the intro image. I found cells about everything else, but not for the main item image. Should I be looking somewhere else?

Davor wrote: I don't know about tags, I didn't move them but I moved images this way:

Please Log in or Create an account to join the conversation.

  • thongtran
  • thongtran's Avatar
  • Offline
  • New Member
  • CEO at foobla.com
More
10 years 8 months ago - 10 years 8 months ago #75129 by thongtran
K2 is a great CCK for Joomla.
However, sometimes people need to convert back to Joomla articles because of template stuff or something.
In that case, you can use one click solution by foobla > K2 to Joomla Articles converter , it works the same way K2 import items from Joomla Content.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum