Page 1 of 1

An SEO Fix for Product Reviews - Bots Cant See JS Loading

Posted: Sat Aug 23, 2014 2:00 am
by Dhaupin
Since reviews are loaded with javascript bots cant see them. This means they dont get indexed and they cant see any RDF for them. Here is a vQmod snippet that will expose your first paginated page of reviews in the actual source:

Code: Select all

<modification>

	<id><![CDATA[PHP reviews loader - destroys the js load except on pagination.]]></id>
	<version><![CDATA[1.0.0]]></version>
	<vqmver><![CDATA[2.4.1]]></vqmver>
	<author><![CDATA[CreadevDotOrg]]></author>

	<!-- makes php load first page of reviews -->
	<file name="catalog/view/theme/*/template/product/product.tpl">

		<operation info="adds reviews PHP loader">
			<search position="replace"><![CDATA[
				<div id="review"></div>
			]]></search>
			<add><![CDATA[
				<div id="review"><?php echo file_get_contents($this->config->get('config_url') . 'index.php?route=product/product/review&product_id=' . $product_id); ?></div>
			]]></add>
		</operation>
		<operation info="kills reviews JS loader">
			<search position="replace"><![CDATA[
				$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
			]]></search>
			<add><![CDATA[
				// js review injector removed and replaced with php get file contents
				// $('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?
			]]></add>
		</operation>

	</file>

</modification>
If you want to adjust the pagination of reviews, to add more, here is another vQ snippet that you can add to that. In this example we will change it to 100 reviews per page (shows 100 reviews in source then). This will make reviews "based on 100 reviews" in SERPS:

Code: Select all

	<!-- Reviews pagination fix at product level -->
	<file name="catalog/controller/product/product.php">

		<operation info="increases ajax pull to 100">
			<search position="replace"><![CDATA[
				$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5);
			]]></search>
			<add><![CDATA[
				$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 100, 100);
			]]></add>
		</operation>
		<operation info="increases pagination limit to 100">
			<search position="replace"><![CDATA[
				$pagination->limit = 5;
			]]></search>
			<add><![CDATA[
				$pagination->limit = 100;
			]]></add>
		</operation>

	</file>
In the RDF mods ive seen, no one seems to fix this causing non loads of snippets. Have fun all

Re: An SEO Fix for Product Reviews - Bots Cant See JS Loadin

Posted: Wed Apr 01, 2015 12:00 am
by anthonyf
This is great! Would this work for 2.0.1.1?
If so, how do i go about installing this?

Thank you,
Anthony

Re: An SEO Fix for Product Reviews - Bots Cant See JS Loadin

Posted: Fri Aug 07, 2015 3:35 am
by dogacankanat
Hello Dhaupin,
Thank you so much for this quick fix. It works perfectly with Opencart 1.5.6.4 and Journal 2 theme.
Cheers!

Re: An SEO Fix for Product Reviews - Bots Cant See JS Loadin

Posted: Fri Jan 27, 2017 7:26 am
by igalsm
Would this work for 2.0.1.1?