2 replies [Last post]
wastrilith2k's picture
Offline
Joined: 05/15/2009
Juice: 29
Was this information Helpful?

I'm trying to create a module that will create product classes for Ubercart when it's installed and enabled. I receive the error in the subject line when using Drupal 6.14 and 6.15 If I leave out the hook_node_info() I do not receive the errors. Below is the code for the hook_node_info() which I actually copied from the uc_product module.

/**
* Implementation of hook_nodeapi().
*
*/
function dd_node_info($reset = FALSE) {
  $types = array();
  $types['base_product'] = array(
    'name' => t('base product'),
    'module' => 'dd',
    'description' => t("use to create base products"),
  );
  $types['scented_product'] = array(
    'name' => t('scented product'),
    'module' => 'dd',
    'description' => t("DO NOT USE"),
  );
  return $types;
}

I have the following installed:

Drupal 6.15
Administration menu 6.x-1.5
Content 6.x-2.6
FileField 6.x-3.2
ImageField 6.x-3.2
Menu 6.15
Path 6.15
Taxonomy 6.15
Update status 6.15
ImageAPI 6.x-1.6
ImageAPI GD2 6.x-1.6
ImageCache 6.x-2.0-beta10
ImageCache UI 6.x-2.0-beta10
Pathauto 6.x-1.2
Token 6.x-1.12
Cart 6.x-2.2
Conditional Actions 6.x-2.2
Order 6.x-2.2
Product 6.x-2.2
Store 6.x-2.2
Attribute 6.x-2.2
Catalog 6.x-2.2
Payment 6.x-2.2
Shipping 6.x-2.2
Shipping Quotes 6.x-2.2
Taxes 6.x-2.2
PayPal 6.x-2.2
Views 6.x-2.8
Views UI 6.x-2.8

I only have issues when I enable this module. It seems like it may be creating the node types, but they don't show up on the node creation form. Could this be because I am also adding these to the uc_product_classes table and the uc_product module's hook_node_info then returns all product classes as node types in the uc_product_classes table? I'm thinking this could be causing issue as maybe Drupal is trying to create multiple copies of the same content type and therefore when it's retrieved, it retrieves it as an array rather than a string?

Any help is appreciated!

James

PreviewAttachmentSize
Zipped up module files3.24 KB
wastrilith2k's picture
Offline
Joined: 05/15/2009
Juice: 29
Solved

I had to not use my own hook_node_info. Rather, I add the product types to the uc_product_classes table and then call node_types_rebuild() and it works correctly.

James

ldweeks's picture
Offline
Joined: 01/14/2009
Juice: 30
Re: Solved

Thanks very much for posting the solution. I've been trying to figure this out for about a day!

Lucas