Support

Account

Home Forums General Issues Multiple Reviews, is it possible?

Solving

Multiple Reviews, is it possible?

  • Hey there guys,

    I’m having a fairly hard time wrapping my head around what is needed, although I’m not even sure if it’s possible.

    I have 2 Post types – Worker – Company

    There is a relationship between the two, on the Worker page I can display the Companies (more than one) related to the Worker. This works perfectly.

    However, I now need to be able to add a review for the related companies. Example: Worker 11 had a 3-star rating for company 1 and a 5-star rating for company 2.

    My biggest concern is that the companies can have multiple workers linked to them. Example: company 1 has 2 ratings linked to it. Worker 11 with a 3-star rating and worker 12 with a 1-star rating. All this while only showing the individual ratings on the worker pages for their companies.

    Hope this makes sense?
    Really hope someone can help me out here.

  • The review post type needs to be related to both the worker and the company selected or populated when a review is submitted.

  • So I should create a review post type and then create a relation to both worker and company?

    Would the star rating field be linked to the review post type I’m guessing?

  • The star rating would be for the review.

    I recently built a review system. It is not related to multiple things, however, it is related to products.

    If you want to show reviews then each review has a star rating, on top of this the “Worker” will have an aggregate (average) for the company. You might also want to show an overall aggregate for all companies for the worker.

    You need to think about how your going to show the aggregate? Are you going to calculate this every time? That is get all the reviews for the worker for the company and then calculate the aggregate on the fly? This could be extremely slow if there are many reviews. If you think that you’ll be showing hundreds of reviews then the aggregates need to be per-calculated (probably using some type of a cron triggered when a new review is submitted) and stored somewhere.

    But yes, I would have a review post type that is related to both the worker and the company. More than likely if it is the company that is submitting the review then I would not allow them to choose the company. On the other hand if these won’t be submitted by the company then you’ll need to allow for this to be selected.

    To be honest, there are many ways that this could be done depending on how you need to show them.

  • Thanks for the feedback so far hey, I truly appreciate it.

    At the end of the day the ratings will only be displayed on the Worker pages. The Company pages will only show the workers linked to them in cards.

    I basically only need cards on the Worker page that displays the company Name, Image, and a rating based on that user. Each worker would have a few company cards at the end of the day.

    This will only be captured by internal staff, neither the company nor the workers load their own posts. Hope that makes sense?

  • I created a review post type with two fields: Relationship and Rating.

    The Relationship is a link between the company and the worker.

    As for the Rating field, this is displayed on the Worker post type (Is this correct?)

    This is not making sense though to me, how will I be capturing ratings for more than one company if I only have one rating option and how do I link this rating option between the Worker and the Company?

    I do apologize if I’m missing something you explained.


    @hube2

  • I’m not sure exactly what you are doing, all I can say is what I would do.

    
    Company Post Type
        relationship field => Workers
        relationship field => Reviews
    Worker Post Type
        relationship field => Company
        relationship field => Reviews
    Review Post Type
        post object field => Worker
        post object field => Company
    

    I would se the relationship and post object fields to be bidirectional

    When a review is submitted there would be 2 fields for the worker and company the review is for.

    These fields would be hidden if I did not want the person filling in the review to be able to select. If this was the case then I would generate the value that needs to be submitted using an acf/prepeare_field filter.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.