Post by dani888 » Sun Sep 23, 2018 9:18 pm

Hello
Does anyone know how I can make 5 stars for rating
??? ??? ??? ??? ???
Thank you

Attachments

stars.jpg

stars.jpg (22.83 KiB) Viewed 2141 times


Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am

Post by storiqax » Mon Sep 24, 2018 6:00 pm

Go to your's site folder and then \catalog\view\theme\your-theme\template\product and open product.twig.

Then find the following (or something like that, depends from theme to theme):

Code: Select all

<div class="form-group required">
  <div class="col-sm-12">
	<label class="control-label">{{ entry_rating }}</label>
	&nbsp;&nbsp;&nbsp; {{ entry_bad }}&nbsp;
	<input type="radio" name="rating" value="1" />
	&nbsp;
	<input type="radio" name="rating" value="2" />
	&nbsp;
	<input type="radio" name="rating" value="3" />
	&nbsp;
	<input type="radio" name="rating" value="4" />
	&nbsp;
	<input type="radio" name="rating" value="5" />
	&nbsp;{{ entry_good }}</div>
</div>
And change it to:

Code: Select all

<div class="form-group required">
  <div class="col-sm-12">
		<label class="control-label">{{ entry_rating }}</label>
		&nbsp;&nbsp;&nbsp; {{ entry_bad }}&nbsp;
		<div class="star-rating">
			<input id="star-5" type="radio" name="rating" value="5" />
			<label for="star-5" title="5 stars">★</label>
			&nbsp;
			<input id="star-4" type="radio" name="rating" value="4" />
			<label for="star-4" title="4 stars">★</label>
			&nbsp;
			<input id="star-3" type="radio" name="rating" value="3" />
			<label for="star-3" title="3 stars">★</label>
			&nbsp;
			<input id="star-2" type="radio" name="rating" value="2" />
			<label for="star-2" title="2 stars">★</label>
			&nbsp;
			<input id="star-1" type="radio" name="rating" value="1" />
			<label for="star-1" title="1 star">★</label>
		</div>
		&nbsp;{{ entry_good }}
	</div>
</div>	

<style>
.star-rating {
    direction: rtl;
    display: inline-block;
    padding: 20px;
}

.star-rating input[type=radio] {
    display: none;
}

.star-rating label {
    color: #bbb;
    font-size: 35px;
    padding: 0;
    cursor: pointer;
    -webkit-transition: all .3s ease-in-out;
    transition: all .3s ease-in-out;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input[type=radio]:checked ~ label {
    color: #f2b600;
}
</style>
You can put the code inside the <style> </style> to one of your main .css files that your theme using.

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by dani888 » Tue Sep 25, 2018 1:15 pm

Hello
Thanks for the code works very well

Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am

Post by storiqax » Wed Sep 26, 2018 5:31 am

dani888 wrote:
Tue Sep 25, 2018 1:15 pm
Hello
Thanks for the code works very well
You are welcome.
PS: I'm replying to your dm right now :)

User avatar
New member

Posts

Joined
Tue May 29, 2018 10:19 pm
Who is online

Users browsing this forum: paulfeakins and 417 guests