When adding fields to the Sub product display fields created for product classes were not being displayed. So instead of limiting fields to content from products using:

content_types('product')

I took all content types and then limited them to content which are uc products by checking for:

$type_info['module'] == 'uc_product'

I made a patch for this change (only a few lines in two functions).

Comments

larowlan’s picture

Status: Needs review » Needs work
+++ uc_subproduct.module	2011-05-17 08:43:18.523773014 -0600
@@ -247,9 +247,13 @@ function uc_subproduct_form_alter(&$form
-  $type_info = content_types('product'); //we only care about uc_product nodes
...
+	if ($type_info['module'] == 'uc_product') {

We should retain the existing code, the $node is passed as an argument - we should use

if (uc_product_is_product($node)) {

then

$type_info = content_types($node->type);
+++ uc_subproduct.module	2011-05-17 08:43:18.523773014 -0600
@@ -281,12 +285,16 @@ function uc_subproduct_uc_subproduct_fie
-  $type_info = content_types('product'); //we only care about uc_product nodes

we can use the existing code here but change it from
$type_info = content_types('product');
to
$type_info = content_types($node->type);

+++ uc_subproduct.module	2011-05-17 08:43:18.523773014 -0600
@@ -281,12 +285,16 @@ function uc_subproduct_uc_subproduct_fie
-  $type_info = content_types('product'); //we only care about uc_product nodes