Post by stonehinged » Tue Jul 24, 2012 4:10 am

I think that would be a sweet addition! Agree wholeheartedly!

STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/


User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:10 am
Location - US

Post by adzeds » Sun Aug 12, 2012 5:09 pm

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:

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>
Is working great on mine, let me know if you find any bugs.

Newbie

Posts

Joined
Wed May 16, 2012 4:26 am

Post by shaunycc » Wed Aug 22, 2012 1:25 am

Does this mod make all product tabs html? I'd like to have both my reviews and my attribute tabs to be readable by the search engines. Does anyone know how I would do this? Thanks

Newbie

Posts

Joined
Mon May 21, 2012 5:22 pm

Post by dantheman50_98 » Wed Aug 22, 2012 9:06 pm

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

Active Member

Posts

Joined
Sat Sep 18, 2010 2:18 am

Post by hsankor » Sun May 19, 2013 6:48 pm

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 } ?>

Newbie

Posts

Joined
Sun May 19, 2013 6:39 pm

Post by hsankor » Sun May 19, 2013 8:50 pm

Is there any update for this? I have OC 1.5.4.1 and I can't make this method work for my review

Newbie

Posts

Joined
Sun May 19, 2013 6:39 pm

Post by Iamdbat » Wed Sep 11, 2013 7:11 am

Can we have a product page WITHOUT product tabs? - just a plain table like sheet that search engines can crawl? - This seem like an obvious choice - no point in having a fancy template if nobody ever sees or finds it?

Active Member

Posts

Joined
Sat Jan 28, 2012 7:32 am

Post by mattreigle » Wed Mar 05, 2014 6:12 pm

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

Newbie

Posts

Joined
Wed Feb 20, 2013 1:21 pm

Post by xdomofab » Sun Apr 26, 2015 5:15 pm

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>
.
Thank you for your contribution, and How to apply it to Opencart 2.0? Thank you for your reply. :)

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


New member

Posts

Joined
Wed Jun 05, 2013 11:03 am

Post by vl2 » Mon Jul 04, 2016 4:40 pm

Did anyone apply this to opencart version 2.1.0.2?

vl2
Newbie

Posts

Joined
Mon Apr 16, 2012 5:14 pm

Post by Qphoria » Tue Jul 05, 2016 11:54 pm

It was actually created as vQmod for 1.5.x and 2.x
http://www.opencart.com/index.php?route ... n_id=24009

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: Google [Bot] and 139 guests