Im trying to display some fields from my products on my product kit page. Im also trying to allow users to buy the products individually as well as in a kit.

Ive made some progress with the sub-product module. However it would be far easier if I could use views to show the products' fields while on the product kit page. This would allow me to show what I want, and also use the normal product kit features (like adding all the products at once, calculating the total price, etc).

My understanding is that I can only do this if products in a kit have a node reference (or node referrer maybe) to the kit. Is their a way of doing this? Its beyond my scope but if this could be made as a patch or module then it would really open up some views/cck functionality to product kits.

Just as an FYI, I made some progress using custom theming to print product field values from the array on the product kit page. I managed to get some of the fields I needed, but not all of them are in the array and I dont know how to load them.

Thanks a lot

Comments

micheleannj’s picture

Hello,

I'm faced with a similar issue, but I'm working on a module to create a node hierarchy relationship between product kits and products. Let me know if you think this solution would work for you as well. This is probably a good candidate for a new contributed module...

jdln’s picture

Yes that would be great!

My work around was to use the product kit and the sub product module and manually make node references so i could use features from both modules. This is fine for me at the moment as I only have 5 products of this type in my store but its impractical for a very large store.

micheleannj’s picture

Hi,

Sorry for the delay -- I was out-and-about over the holidays!
Here's the module code as I now have it:


/* 
* function to unrequire products in product kit creation (since they'll be added from the child nodes)
*/
function uc_product_kit_hierarchy_form_alter(&$form, &$form_state, $form_id) {

        if ($form_id == 'product_kit_node_form'){
                $form['base']['products']['#required'] = 0;
                $form['base']['#collapsed'] = 'TRUE';
        }

}


/*
* function to make child nodes products in a parent kit
* Redirect to child page after creating  new product kit
* TODO: Deal with changes to either the parent (ie removing a product) or the children (ie changing parent) -- but this doesn't happen much (ever?) for us so can just be manual for now...
*/

function uc_product_kit_hierarchy_nodeapi(&$node, $op){

        if (($op == 'insert') && ($node->type == 'product_kit')){
                $_REQUEST['destination'] = "/node/" . $node->nid . "/children";
        }

        if ($op == 'insert'){
                $parent = node_load($node->parent);
if ($op == 'insert'){
                $parent = node_load($node->parent);

                if($parent->type == 'product_kit'){
                        $parent->products[] = $node;  #how to avoid duplicates?
                        node_save($parent);
                        drupal_set_message("$node->title added as product in $parent->title");
                }
        }
}

HTH.

jdln’s picture

Thanks Majnoona Im using my less than perfect work around at the moment but im sure ill have need for your module at some point.

longwave’s picture

Status: Active » Closed (duplicate)