I just tried copying the Product node type (created by ubercart) by exporting and then importing it, and changing the Node Name and Type. I got the following error:

An error has occurred adding the content type eventproduct.
Please check the errors displayed for more details.

The thing is, there are no errors displayed, so I don't know where to go from here.

Thanks for any help,
Jugney

Comments

KarenS’s picture

Status: Active » Fixed

If the error was creating the content type, it's something in the regular core content type creation process that went awry, and that's really outside the scope of CCK. There is no API for creating content types and no system to use to tell what will or won't work, so we're limited in what we can do about giving you useful information.

If you exported it from another site, make sure that all modules it uses are available and enabled on the site you're moving it to. It's also possible that it is a 'locked' content type that can't be copied.

I'm not familiar with ubercart, so you might post a question on their forums about exporting and importing their content types to see if it's possible and what, if any, special considerations there are to make it work.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

fp’s picture

I haven't look seriously under the hood but I think that content import is looking at the module through which the content type is imported to get the widgets associated with it. Maybe KarenS can confirm this.

If you export a product from ubercart the array will look like this:

$content['type']  = array (
  'name' => 'Product',
  'type' => 'product',
[... snip ...]
  'old_type' => 'product',
  'orig_type' => 'product',
  'module' => 'uc_product',
  'custom' => '0',
[... snip ...]
);

uc_product doesn't provide the widgets to correctly import the data.

You should be able to import this changing the 'name', type', 'old_type', 'orig_type' to whatever new content type you want to create (below I have used "book") and by changing the value of the 'module' key to 'node':

$content['type']  = array (
  'name' => 'Book',
  'type' => 'book',
[... snip ...]
  'old_type' => 'book',
  'orig_type' => 'book',
  'module' => 'node',
  'custom' => '0',
[... snip ...]
);

Then you can import your new content type, after which you will need to set the content type module back to uc_product:

mysql> update node_type set module="uc_product" where type="book";

If you are creating a new product class you will also need to do something like this in your db:

mysql> insert into uc_product_classes (pcid,name,description) values ("book","Book","A description");

I am just working with this right now, so I can't assure you that it's a recipe to blindly follow and expect consistent results. However, it might help you progressing along with your project...

ergophobe’s picture

Thanks fp.

It's a bit of an involved process, but it sure beats adding the fields 1 x 1.

A couple of notes:
- you have to use fp's method. You can't add it and then use the Manage Classes interface. It will fail
- you have to change the 'module', but you can leave widgets like 'uc_image' or whatever and that seems to work fine

thirstysix’s picture

Thanks a lot fp...

jlopez’s picture

I was able to avoid the issue by creating the product content type through store administration and then applying the CCK import.

Ubercart product content types should be created through 'Manage classes' under 'Products'. Once the content type is create, you have the option of importing your CCK fields as usual through the available export/import process.

guschilds’s picture

I ran into this issue when duplicating a content type stored in features. Changing 'module' from 'feature' to 'node', similar to the technique described in #3, fixed the errors and allowed for a successful import. There was no need for the other two steps, as those are only relevant to ubercart types.