I have created a field in backend where using radio button am selecting the rating of product as 1 star, 2 star, 3 star, 4 star and 5 Star
In front end when displaying s
First, make sure $this->prodDet->v_child_safety
only returns a number. So instead of 1 star, 2 star, it should just return 1, 2, 3 etc. Then replace your code with this:
prodDet->v_child_safety;
$count = 1;
$result = "";
for($i = 1; $i <= 5; $i++){
if($stars >= $count){
$result .= "★";
} else {
$result .= "☆";
}
$count++;
}
?>
If you want to use images of a star instead, use this code:
prodDet->v_child_safety;
$result = "";
for($i = 1; $i <= $stars; $i++){
$result .= "";
}
?>