Skip to content

Commit 8cd5775

Browse files
committed
MAGETWO-91805: Product URLs in front-end Customer Account "My Product Reviews" section are not SEO friendly
- Replaced product view URL by SEO friendly link=
1 parent 137fcbf commit 8cd5775

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

app/code/Magento/Review/Block/Customer/ListCustomer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ public function getProductLink()
154154
/**
155155
* Get product URL
156156
*
157-
* @param \Magento\Review\Model\Review $review
157+
* @param \Magento\Catalog\Model\Product $product
158158
* @return string
159159
* @since 100.2.0
160160
*/
161-
public function getProductUrl($review)
161+
public function getProductUrl($product)
162162
{
163-
return $this->getUrl('catalog/product/view', ['id' => $review->getEntityPkValue()]);
163+
return $product->getProductUrl();
164164
}
165165

166166
/**

app/code/Magento/Review/view/frontend/templates/customer/list.phtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@
2222
</tr>
2323
</thead>
2424
<tbody>
25-
<?php foreach ($block->getReviews() as $_review): ?>
25+
<?php foreach ($block->getReviews() as $review): ?>
2626
<tr>
27-
<td data-th="<?= $block->escapeHtml(__('Created')) ?>" class="col date"><?= $block->escapeHtml($block->dateFormat($_review->getReviewCreatedAt())) ?></td>
27+
<td data-th="<?= $block->escapeHtml(__('Created')) ?>" class="col date"><?= $block->escapeHtml($block->dateFormat($review->getReviewCreatedAt())) ?></td>
2828
<td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
2929
<strong class="product-name">
30-
<a href="<?= $block->escapeUrl($block->getProductUrl($_review)) ?>"><?= $block->escapeHtml($_review->getName()) ?></a>
30+
<a href="<?= $block->escapeUrl($block->getProductUrl($review)) ?>"><?= $block->escapeHtml($review->getName()) ?></a>
3131
</strong>
3232
</td>
3333
<td data-th="<?= $block->escapeHtml(__('Rating')) ?>" class="col summary">
34-
<?php if ($_review->getSum()): ?>
34+
<?php if ($review->getSum()): ?>
3535
<div class="rating-summary">
3636
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
37-
<div class="rating-result" title="<?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%">
38-
<span style="width:<?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%;"><span><?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%</span></span>
37+
<div class="rating-result" title="<?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%">
38+
<span style="width:<?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%;"><span><?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%</span></span>
3939
</div>
4040
</div>
4141
<?php endif; ?>
4242
</td>
4343
<td data-th="<?= $block->escapeHtmlAttr(__('Review')) ?>" class="col description">
44-
<?= $this->helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?>
44+
<?= $this->helper('Magento\Review\Helper\Data')->getDetailHtml($review->getDetail()) ?>
4545
</td>
4646
<td data-th="<?= $block->escapeHtmlAttr(__('Actions')) ?>" class="col actions">
47-
<a href="<?= $block->escapeUrl($block->getReviewUrl($_review)) ?>" class="action more">
47+
<a href="<?= $block->escapeUrl($block->getReviewUrl($review)) ?>" class="action more">
4848
<span><?= $block->escapeHtml(__('See Details')) ?></span>
4949
</a>
5050
</td>

0 commit comments

Comments
 (0)