2

Consider there are two CCK's Products and Reviews(reviews for a product) how to relate them?

There can be any number of reviews for a product. Hence i may want to retrieve all the reviews that belongs to a particular product OR Create a Review OR Delete OR Update.

Is there any module in drupal to accomplish this?

UPDATE

I tried this using Entity Reference module

First I created a REVIEWS CCK with the following fields Name, Email, Review, Rating, Product(This is the Entity Reference, So that it helps to determine the Product to which the review is belonged to).

Products CCk

Product Name, Product Description, Product Cost

Consider there are 3 products A, B, C and i want to review for Product A. I must add all the fields such as Name, email etc and have to select a Product from Drop down

This is Better. But the interesting point is How can i Retrieve all the reviews that belongs to Product A ?

If i create a VIEW to list all the Products i cannot get It's reviews.
Similarly if i create a view to list all Reviews i will get only product name but not its details.

Do any one have any Idea how to solve this?

Many Thanks.

3 Answers 3

1

It looks like you need Entity reference module:

Provides a field type that can reference arbitrary entities

Just add product reference to review content type.

4
  • So, the flow must be like this. add content of type REVIEWS and in that select a product(entity reference node) from drop down list(list of products which are already created). Am i right?
    – Ramaraju.d
    Jul 1, 2013 at 15:48
  • @Ramarajudantuluri sounds right :)
    – Mołot
    Jul 1, 2013 at 18:30
  • Hi, Please see the Update. I tried with Entity Reference Module. It is similar to node reference.
    – Ramaraju.d
    Jul 3, 2013 at 12:39
  • Using relationships in views was evaluated here. I'll try to add excerpt of that to my answer. Remind me in a day or two if I didn't.
    – Mołot
    Jul 3, 2013 at 12:42
0

Entity reference is preferred choice as it's in D8 core and uses entity's architecture. For some reason Entity Reference module has less functionality then References module. I needed to filter referenced users by role and this can only be done with References.

0

In view add a relationship of product entity and select as required, after this add fields of product cck and select use the relation ship dropdown in field settings and in this way you should get all the needed data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.