I think that would be a sweet addition! Agree wholeheartedly!
STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/
Hi,
I have added the rich snippets schema to my reviews so that it shows stars next to my listings in Google for products with reviews.
Here is an updated xml for anyone else who is looking to do the same:
Is working great on mine, let me know if you find any bugs.
I have added the rich snippets schema to my reviews so that it shows stars next to my listings in Google for products with reviews.
Here is an updated xml for anyone else who is looking to do the same:
Code: Select all
<modification>
<id>Make User Reviews Indexable</id>
<version>1.0.0</version>
<vqmver>2.1</vqmver>
<author>countzer0 - Modified by adzeds</author>
<file name="catalog/controller/product/product.php">
<operation>
<search position="before"><![CDATA[$this->data['tags'] = array();]]></search>
<add><![CDATA[ $this->data['reviews_array'] = array();
$review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']);
$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], 0, 20);
foreach ($results as $result) {
$this->data['reviews_array'][] = array(
'author' => $result['author'],
'text' => strip_tags($result['text']),
'rating' => (int)$result['rating'],
'reviews' => sprintf($this->language->get('text_reviews'), (int)$review_total),
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
);
}
]]></add>
</operation>
</file>
<file name="catalog/view/theme/default/template/product/product.tpl">
<operation>
<search position="replace"><![CDATA[<div id="review"></div>]]></search>
<add><![CDATA[ <div id="review">
<?php if ($reviews_array) { ?>
<?php foreach ($reviews_array as $review) {
$metadate = strtotime($review['date_added']);
$metadates = date('Y-m-d', $metadate);
?>
<div class="content">
<span itemprop="review" itemscope itemtype="http://schema.org/Review"><b><span itemprop="author"><?php echo $review['author']; ?></span></b> | <img src="catalog/view/theme/default/image/stars-<?php echo $review['rating'] . '.png'; ?>" alt="<?php echo $review['reviews']; ?>" /><br />
<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"><meta itemprop="ratingValue" content = "<?php echo $review['rating']; ?>"><meta itemprop="bestRating" content = "5"></span>
<meta itemprop="datePublished" content="<?php echo $metadates ; ?>"><?php echo $review['date_added']; ?><br />
<br />
<span itemprop="description"><?php echo $review['text']; ?></span>
</span>
</div>
<?php } ?>
<?php } else { ?>
<div class="content"></div>
<?php } ?>
</div>
]]></add>
</operation>
</file>
</modification>
Hi Adzeds,
I've added your xml code, and it's working nicely so thanks for that.
I thought I'd point out one thing I've noticed though, and it relates to the date. Here's an example of the date that is inserted for a review:
<meta itemprop="datePublished" content="1970-01-01">22/08/2012
The problem is that the meta date data is constantly set to 01/01/1970 - which is obviously not the case, so have you found a way to get this date working accurately?
Thanks,
Dan
I've added your xml code, and it's working nicely so thanks for that.
I thought I'd point out one thing I've noticed though, and it relates to the date. Here's an example of the date that is inserted for a review:
<meta itemprop="datePublished" content="1970-01-01">22/08/2012
The problem is that the meta date data is constantly set to 01/01/1970 - which is obviously not the case, so have you found a way to get this date working accurately?
Thanks,
Dan
Hi guys! I tried to fix my product reviews as described by countzer0 but without success. Can it be because my OC is 1.5.4.1? I'm a novice in codes and html, so what I did was just to copy the code on page 1 and post in notebook and then renaming the file from .txt to .xml and loading into my vqmod on a site - did I make any mistake, cause my reviews still don't show in a page code. I beg anyone to help me on this. There's another solution for this problem in Russian SERPS but it doesn't work for me as I can't manage to use it without breaking the styles of the theme I bought (sellya)
catalog/view/theme/your_theme/template/product/product.tpl
find a line:
<div id="review"></div>
substitute it with:
<?php
$reviews = $this->model_catalog_review->getReviewsByProductId($product_id);
if ($reviews) {
foreach ($reviews as $review) {
echo '<div class="content"><p><strong>'.$review['author'].'</strong> – ';
$date = strtotime($review['date_added']);
echo date('d M Y',$date); ?><br />
<img src="catalog/view/theme/default/image/stars_<?php echo $review['rating'] ?>.png" alt="<?php echo $review['rating'] ?> из 5 звёзд!" /><br />
<?php echo $review['text'].'</p></div>';
}
} else { ?>
<div class="content"><?php echo "Нет отзывов"; ?></div>
<?php } ?>
Yeah, is there any way to make the reviews just appear beneath the product description in plain HTML? This has seemed like a no-brainer for me.
I keep seeing more and more sites with a long list of reviews ranking high on Google. Google is liking content pages with 2000+ words and having a bunch of reviews at the bottom will definitely help. Sort of like this:
http://www.comforthouse.com/playhouses.html
I keep seeing more and more sites with a long list of reviews ranking high on Google. Google is liking content pages with 2000+ words and having a bunch of reviews at the bottom will definitely help. Sort of like this:
http://www.comforthouse.com/playhouses.html
Thank you for your contribution, and How to apply it to Opencart 2.0? Thank you for your reply.countzer0 wrote:Ah, I found the change I made: I had mistakenly used $reviews as an array in product.php which was overwriting the text string $reviews containing the number of reviews. Here is the corrected vqmod:
.Code: Select all
<modification> <id>Make User Reviews Indexable</id> <version>1.0.0</version> <vqmver>2.1</vqmver> <author>countzer0</author> <file name="catalog/controller/product/product.php"> <operation> <search position="before"><![CDATA[$this->data['tags'] = array();]]></search> <add><![CDATA[ $this->data['reviews_array'] = array(); $review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']); $results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], 0, 20); foreach ($results as $result) { $this->data['reviews_array'][] = array( 'author' => $result['author'], 'text' => strip_tags($result['text']), 'rating' => (int)$result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int)$review_total), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])) ); } ]]></add> </operation> </file> <file name="catalog/view/theme/default/template/product/product.tpl"> <operation> <search position="replace"><![CDATA[<div id="review"></div>]]></search> <add><![CDATA[ <div id="review"> <?php if ($reviews_array) { ?> <?php foreach ($reviews_array as $review) { ?> <div class="content"><b><?php echo $review['author']; ?></b> | <img src="catalog/view/theme/default/image/stars-<?php echo $review['rating'] . '.png'; ?>" alt="<?php echo $review['reviews']; ?>" /><br /> <?php echo $review['date_added']; ?><br /> <br /> <?php echo $review['text']; ?></div> <?php } ?> <?php } else { ?> <div class="content"></div> <?php } ?> </div> ]]></add> </operation> </file> </modification>
Opencart Development & Consult:
All in One SEO Package: making your Opencart SEO friendly
Product Rich Snippets: Breadcrumb, Product & Product Reviews
Custom Titile H1 Tag: custom category title, h1, bottom description and product title
Optimize Site URL Architecture: unique url w/breadcrumb, seo friendly url architecture
It was actually created as vQmod for 1.5.x and 2.x
http://www.opencart.com/index.php?route ... n_id=24009
http://www.opencart.com/index.php?route ... n_id=24009
Who is online
Users browsing this forum: Google [Bot] and 139 guests