Question

I know the ideal place to ask is at . I posted my question in the drupal support forum and under the nodecomments module as an issue. I have also consecutively posted this question once a day for the past 3 days in the drupal support IRC channel.

No answer.

Hence, I have decided to try my luck here. I am running on the current setup on shared hosting for testing purposes:

drupal-6.12
fivestar-6.x-1.15
nodecomment-6.x-1.2rc2
cck-6.x-2.3
votingapi-6.x-2.0-rc2
views-6x-2.6

I followed the instructions in http://drupal.org/node/234681 even though the modules they used were a bit outdated. I got what I wanted working. I have a product node type and a review node type. Then I used nodecomment so that the review node type appears as a comment for product.

So far so good.

Now when I go view the review node by itself, I cannot find the link back to the product node -- the parent of the review node. I tried searching and came across this patch, but I am not sure how to use it. in fact I am not even sure if it solves my issue.

I don't mind having the parent node (the product node) appear as a breadcrumb, so long as there is a link back to the product node. I bought the "Using drupal" book, but I dislike the way it taught you to select a list of products in order to create a review. I tried searching for some time and came across nodecomment, node hierarchy and node relativity. After much experimenting, i have settled on nodecomment, but I need the parent link.

Please advise.

Was it helpful?

Solution

You may be able to adapt the method in this tutorial to your needs: http://www.lullabot.com/articles/photo-galleries-views-attach

Instead of using nodecomment, have a 'review' content type with a CCK nodereference field to the 'product' node (nodereference URL will add a handy link on the product node to the add review form with the product node reference already set). The node reference will appear as a field in your review node with the name of the product linked to the product's node.

Views Attach will allow you to add a listing of reviews to the product node.

OTHER TIPS

The patch you were pointing at is for the 6.x-2.x-dev version (what's going to be nodecomment 2.0 for Drupal 6 someday), and is thus of little use in your case, sorry.

You could simply do something like

<?php print l('Back to product', 'node/' . $node->comment_target_nid); ?>

in your node-comment.tpl.php to get a link back to the product.

If you want to do more advanced stuff (like load the product node to get its title or other attributes), I'd suggest you make a preprocess function in your theme (or even create a module, depending how great your needs are).

Here's a good resource on preprocess functions: Setting up variables for use in a template (preprocess functions).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top