@@ -72,30 +72,30 @@ |
||
| 72 | 72 | $starsAmount = 0; |
| 73 | 73 | $IDs = []; |
| 74 | 74 | if (isset( $this->detailProductItem )) { |
| 75 | - $IDs[] = $this->detailProductItem->getId(); |
|
| 76 | - $amountOfStarred = 0; |
|
| 77 | - if ($this->detailProductItem->getRatings()) { |
|
| 78 | - $reviewsAmount += $this->detailProductItem->getRatings(); |
|
| 79 | - if($this->detailProductItem->getRating() > 0) { |
|
| 80 | - $amountOfStarred++; |
|
| 81 | - $starsAmount += $this->detailProductItem->getRating(); |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - $refs = $this->detailProductItem->getRefItems(); |
|
| 85 | - if(isset($refs['product'])) { |
|
| 86 | - |
|
| 87 | - foreach ($refs['product'] as $variant_id => $variant){ |
|
| 88 | - $IDs[] = $variant_id; |
|
| 89 | - if($variant->getRatings()){ |
|
| 90 | - $reviewsAmount += $variant->getRatings(); |
|
| 91 | - if ($variant->getRating() > 0) { |
|
| 92 | - $amountOfStarred++; |
|
| 93 | - $starsAmount += $variant->getRating(); |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - $starsAmount = $starsAmount / $amountOfStarred; |
|
| 98 | - } |
|
| 75 | + $IDs[] = $this->detailProductItem->getId(); |
|
| 76 | + $amountOfStarred = 0; |
|
| 77 | + if ($this->detailProductItem->getRatings()) { |
|
| 78 | + $reviewsAmount += $this->detailProductItem->getRatings(); |
|
| 79 | + if($this->detailProductItem->getRating() > 0) { |
|
| 80 | + $amountOfStarred++; |
|
| 81 | + $starsAmount += $this->detailProductItem->getRating(); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + $refs = $this->detailProductItem->getRefItems(); |
|
| 85 | + if(isset($refs['product'])) { |
|
| 86 | + |
|
| 87 | + foreach ($refs['product'] as $variant_id => $variant){ |
|
| 88 | + $IDs[] = $variant_id; |
|
| 89 | + if($variant->getRatings()){ |
|
| 90 | + $reviewsAmount += $variant->getRatings(); |
|
| 91 | + if ($variant->getRating() > 0) { |
|
| 92 | + $amountOfStarred++; |
|
| 93 | + $starsAmount += $variant->getRating(); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + $starsAmount = $starsAmount / $amountOfStarred; |
|
| 98 | + } |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | ?> |
@@ -71,24 +71,24 @@ discard block |
||
| 71 | 71 | $reviewsAmount = 0; |
| 72 | 72 | $starsAmount = 0; |
| 73 | 73 | $IDs = []; |
| 74 | -if (isset( $this->detailProductItem )) { |
|
| 74 | +if( isset( $this->detailProductItem ) ) { |
|
| 75 | 75 | $IDs[] = $this->detailProductItem->getId(); |
| 76 | 76 | $amountOfStarred = 0; |
| 77 | - if ($this->detailProductItem->getRatings()) { |
|
| 77 | + if( $this->detailProductItem->getRatings() ) { |
|
| 78 | 78 | $reviewsAmount += $this->detailProductItem->getRatings(); |
| 79 | - if($this->detailProductItem->getRating() > 0) { |
|
| 79 | + if( $this->detailProductItem->getRating() > 0 ) { |
|
| 80 | 80 | $amountOfStarred++; |
| 81 | 81 | $starsAmount += $this->detailProductItem->getRating(); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | $refs = $this->detailProductItem->getRefItems(); |
| 85 | - if(isset($refs['product'])) { |
|
| 85 | + if( isset( $refs['product'] ) ) { |
|
| 86 | 86 | |
| 87 | - foreach ($refs['product'] as $variant_id => $variant){ |
|
| 87 | + foreach( $refs['product'] as $variant_id => $variant ) { |
|
| 88 | 88 | $IDs[] = $variant_id; |
| 89 | - if($variant->getRatings()){ |
|
| 89 | + if( $variant->getRatings() ) { |
|
| 90 | 90 | $reviewsAmount += $variant->getRatings(); |
| 91 | - if ($variant->getRating() > 0) { |
|
| 91 | + if( $variant->getRating() > 0 ) { |
|
| 92 | 92 | $amountOfStarred++; |
| 93 | 93 | $starsAmount += $variant->getRating(); |
| 94 | 94 | } |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | <?php if( $this->detailProductItem->getRating() > 0 ) : ?> |
| 157 | 157 | <div class="rating" itemscope itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating"> |
| 158 | - <span class="stars"><?= str_repeat( '★', (int) round( $starsAmount) ?></span> |
|
| 159 | - <span class="rating-value" itemprop="ratingValue"><?= $enc->html( (int) round( $starsAmount) ) ?></span> |
|
| 158 | + <span class="stars"><?= str_repeat( '★', (int) round( $starsAmount ) ?></span> |
|
| 159 | + <span class="rating-value" itemprop="ratingValue"><?= $enc->html( (int) round( $starsAmount ) ) ?></span> |
|
| 160 | 160 | <span class="ratings" itemprop="reviewCount"><?= $reviewsAmount ?></span> |
| 161 | 161 | </div> |
| 162 | 162 | <?php endif ?> |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | <div class="tab-pane fade" id="nav-review" role="tabpanel" aria-labelledby="nav-review-tab" |
| 511 | 511 | aria-label="<?= $enc->attr( $this->translate( 'client', 'Product reviews' ) ) ?>"> |
| 512 | 512 | |
| 513 | - <div class="reviews container-fluid block" data-productid="<?= $enc->attr( implode(',', $IDs) ) ?>"> |
|
| 513 | + <div class="reviews container-fluid block" data-productid="<?= $enc->attr( implode( ',', $IDs ) ) ?>"> |
|
| 514 | 514 | <div class="row"> |
| 515 | 515 | <div class="col-md-4 rating-list"> |
| 516 | 516 | <div class="rating-numbers"> |