Is there a module to copy a content type node into a different content type node?

taote - October 13, 2009 - 09:45

The scenario is:

  1. There is a Content Type A node.
  2. I want to create a Content Type B node.
  3. Copy the content of the fields from node type A to the new node type B, including node references.
  4. Delete the original Content Type A node.

Is there a module to achieve at least the step 3? What is the best way to achieve this?

Thanks!!

The Nodetype module works

fmesco - October 13, 2009 - 11:00

The Nodetype module works great for this assuming your Content Type A and Content Type B share the same fields. The module does not allow you to map which fields from Content Type A get mapped to Content Type B however, so any fields from Content Type A that aren't shared in Content Type B will be lost during the switch.

Also, no need to delete the original node from Content Type A since the switch is based on the original node...that node is changed from Content Type A to Content Type B...no "copy" is made. Good luck!

http://drupal.org/project/nod

adam_b - October 13, 2009 - 10:56

http://drupal.org/project/nodetype is the only alternative I know of - but I don't think it'll do the node references, and it won't delete the original type A node.

Nodetype doesn´t migrate CCK fields

taote - October 13, 2009 - 11:13

Thanks, but the problem with NodeType is that it doesn´t migrate CCK fields, I guess only title, body and taxonomy.

Does anyone know the best way to do this programatically?

untrue...I use this module to

fmesco - October 13, 2009 - 11:21

untrue...I use this module to change nodes between 5 different very lengthy cck based content types and it moves the data between the shared cck fields seamlessly.

I should clarify that "move"

fmesco - October 13, 2009 - 11:40

I should clarify that "move" is actually incorrect. Nodetype doesn't really move anything, it changes the content type in the database. But if you have Content Type A with fields 1, 2 and 3 and Content Type B with fields 1, 2, 3 and 4, the data in fields 1, 2 and 3 will be there in Content Type B after you change the nodetype and you'll have field 4 in the content now too.

It´s in the specifications

taote - October 13, 2009 - 11:42

I tried and it didn´t work, and in the specifications it says:

Note: This module is extremely simple and *only* changes the node type in the database column. That is all. It does not convert any CCK fields or change other things about the node.

Are you sure is not Node Convert the module you use?

positive...I've used this way

fmesco - October 13, 2009 - 12:15

positive...I've used it this way for over a year on several different installs and it works beautifully. But as you note in your last comment, it won't take two different content types and merge them into a third.

What were the specifics of what you tried that didn't work?

Node Convert is the module

taote - October 13, 2009 - 11:35

Thanks to the previous comments, I got to know Node Convert, I think it does what I was looking for.

But know I have a different scenario:

  1. There are Content Type A and Content Type B nodes.
  2. I want to create a Content Type C node with some date from Content Type A node and some from Content Type B node.

Obviously this cannot be achieve with any existing module, so I need to do it programatically. Can anyone some orientation or links for the best practices to achieve that? I mean hooks, best way to create nodes and copy content via PHP in Drupal 6, etc...

Thanks again

 
 

Drupal is a registered trademark of Dries Buytaert.