Thank you for this. I was nearly there with my efforts that were causing errors. Now I compare the two, I can see where I was going wrong.heatherbell wrote: ↑Tue Feb 27, 2024 8:02 amCode: Select all
<div class="text-center mt-2 ' . $i . '">' . $rating . ' (' . $review_count . ')</div>
Star Rating on Product Card?
-
14Steve14
- Senior Contributor
- Posts: 923
- Joined: Fri Oct 25, 2019 7:01 pm
- Phoenix Version: v1.0.9.1
- Has thanked: 17 times
- Been thanked: 103 times
Re: Star Rating on Product Card?
- burt
- Core Team
- Posts: 4560
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 413 times
Re: Star Rating on Product Card?
1.0.7.18 does not use the product_card component everywhere like more modern Phoenix (I believe [not 100% sure] that the product_card component went live everywhere from 1.0.8.6 onwards).
I *think* only the left/right sideboxes in 1.0.7.18 use the product_card (so it had been introduced but not everywhere).
In 1.0.7.18 you would need to override individual template files to add in your star ratings.
I *think* only the left/right sideboxes in 1.0.7.18 use the product_card (so it had been introduced but not everywhere).
In 1.0.7.18 you would need to override individual template files to add in your star ratings.
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Star Rating on Product Card?
"show Stars twice" is not entirely accurate because it actually shows:burt wrote: ↑Mon Feb 26, 2024 6:07 pmThis is something that needs to be solved at the Core Level to make changes to "product card" more straightforward.heatherbell wrote: ↑Mon Feb 26, 2024 5:35 pm Beware that this will show Stars twice on Reviews Box Module if that is installed.
I have the perfect solution which I'll commit in the 1.0.9.x series.
You do not have the required permissions to view the files attached to this post.
- burt
- Core Team
- Posts: 4560
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 413 times
Re: Star Rating on Product Card?
Strange it shows two different star rating values though.
One or the other is not correct.
One or the other is not correct.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Star Rating on Product Card?
It shows the output from the inserted code (an average of the 2 reviews which is 3 Star in this case).
It then shows the output from the core code (a random review which is a 5 Star in this case).
They are both correct and as expected.
Of course, if the code in previous post and the box module is used, a tweak to the display in the box module to differentiate would be required.
- burt
- Core Team
- Posts: 4560
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 413 times
Re: Star Rating on Product Card?
heatherbell wrote: ↑Wed Feb 28, 2024 3:09 pm It shows the output from the inserted code (an average of the 2 reviews which is 3 Star in this case).
It then shows the output from the core code (a random review which is a 5 Star in this case).
-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Star Rating on Product Card?
In 1.0.7.18, I noticed that product cards in places such as advanced search results are displayed using templates/default/includes/components/product_listing.php.
How to get the star ratings to appear there?
How to get the star ratings to appear there?
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Star Rating on Product Card?
With a lot of work
The code for the reviews is different in 1.0.7.18
https://github.com/CE-PhoenixCart/Phoen ... _stars.php
And other template files that output cards need to be edited besides product_listing
Kudos to Core Developers for making these modifications so much easier in recent versions.
-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Star Rating on Product Card?
I tried the following. Lol.heatherbell wrote: ↑Thu Feb 29, 2024 8:27 amWith a lot of work
The code for the reviews is different in 1.0.7.18
https://github.com/CE-PhoenixCart/Phoen ... _stars.php
And other template files that output cards need to be edited besides product_listing
Kudos to Core Developers for making these modifications so much easier in recent versions.
Code: Select all
<?php
$review_stars_array = [];
if ($review_average['count'] > 0) {
$review_stars_array[] = tep_draw_stars((int)$review_average['average']);
}
foreach ($review_stars_array as $i => $rating) {
echo '<div class="pl-3 ' . $i . '">' . $rating . ' (' . $review_average['count'] . ')</div>';
}
?>