Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Best way to set up flexible reviews/testimonials on a travel site


Go to End


3 Posts   1223 Views

Avatar
rrymrrsn

Community Member, 2 Posts

25 November 2015 at 2:03pm

Edited: 25/11/2015 2:09pm

Hello,
I am a relative newcomer to silverstripe and more of a designer than a developer.
Just requesting advice on the best way to set up a flexible review or testimonials system in silverstripe. It is not needed for the review system to be 'live' with user generated content, the reviews will be added by the content editor in the CMS.

The idea is as follows - I am building a travel site which at the root level has holder pages containing listings of available trips and under that detail pages for each trip. The functionality I need to get working is:
- Attach reviews to detail pages (currently I have set up page variables)
- Display those reviews in a reviews section on the parent detail page (so far so easy)
- Display selected reviews on other pages where required

The basic structure of the site is as follows if that helps

ROOT
|-- HOLDER PAGE (listing all child pages)
__| TRIP DETAIL PAGE 1
____| REVIEW 1.1 (set up as a page variable)
____| REVIEW 1.2 (set up as a page variable)
__|TRIP DETAIL PAGE 2
____| REVIEW 2.1 (set up as a page variable)
____| [*REVIEW 1.2]
__|TRIP DETAIL PAGE 3
____| REVIEW 3.1 (set up as a page variable)
____| [*REVIEW 1.2]

Please let me know how you would approach this and in particular how you would best set up the reviews to be available to pages other than the variables own page where required. Please advise if there are any modules that might help as I am not a developer.

Thanks
rrymrrsn

Avatar
helenclarko

Community Member, 166 Posts

25 November 2015 at 3:16pm

Edited: 25/11/2015 3:18pm

Hi rrymrrsn,

I think this is going to get quite complicated haha, but lets see what we can do.

Okay, it might be worth first looking into a premade Testimonials addon (https://github.com/burnbright/silverstripe-testimonials), this could be the grounds for your review system. I believe all Testimonials are added by a content editor, not users of the site.

You could then loop the content of these testimonials on your parent page:

<% loop $Children %>
	$Content, $Name, $Business and $Date
<% end_loop %>

Or to pull Tesimonial content into another page you will need to add the following code to that pages controller or add dirrectly to your Page.php controller so you can call it on any page:

	//Function for getting testimonials
	function getTestimonials(){
		$testimonials = testimonial::get();
		return $testimonials;
	}

you can also filter the above request using the guide below:
https://docs.silverstripe.org/en/3.1/developer_guides/model/data_model_and_orm/

then simply loop $Testimonials and pull $Content, $Name, $Business and $Date.

That should give you somewhere to start.

-helenclarko

Avatar
rrymrrsn

Community Member, 2 Posts

25 November 2015 at 9:23pm

Hi helenclarko,

Thanks a lot for the quick reply. I can't believe I didn't find that testimonials module - for some reason I thought 'review' would be the more common term and was searching on that.

I've installed it and am going to have a play around.

Thanks
rrymrrsn