Jump to content

[Solved] Compare on Other Pages


Recommended Posts

Normally , Product compare do not load products-comparison.js on other page. Which handel the product compare functionality with check box. I have try to solve this issue. And able to do this. You need to do by this way.

 

Paste this code in your product.tpl

 <p class="compare checkbox choices-thin clearfix">
			<input type="checkbox"  class="comparator" id="comparator_item_{$product->id}" value="comparator_item_{$product->id}"
			{if isset($compareProducts) && in_array($product->id, $compareProducts)}checked="checked"{/if} />
<label for="comparator_item_{$product->id}">{l s='Select to compare'}</label></p>

 

After that you need to load the products-comparison.js on product.tpl like this way.

<script type="text/javascript" src="{$js_dir}/products-comparison.js"></script>

 

So now when you click on the product.tpl page's check box it will add the product on compare page like bellow image.

 

Hope your problem is solve. So please change the title as [solved] and like the post :)

post-460779-0-14327300-1372525093_thumb.png

post-460779-0-79275100-1372525101_thumb.png

  • Like 1
Link to comment
Share on other sites

Normally , Product compare do not load products-comparison.js on other page. Which handel the product compare functionality with check box. I have try to solve this issue. And able to do this. You need to do by this way.

 

Paste this code in your product.tpl

 <p class="compare checkbox choices-thin clearfix">
			<input type="checkbox"  class="comparator" id="comparator_item_{$product->id}" value="comparator_item_{$product->id}"
			{if isset($compareProducts) && in_array($product->id, $compareProducts)}checked="checked"{/if} />
<label for="comparator_item_{$product->id}">{l s='Select to compare'}</label></p>

 

After that you need to load the products-comparison.js on product.tpl like this way.

<script type="text/javascript" src="{$js_dir}/products-comparison.js"></script>

 

So now when you click on the product.tpl page's check box it will add the product on compare page like bellow image.

 

Hope your problem is solve. So please change the title as [solved] and like the post :)

 

Thank you! I've made some code edits so it was a touch more complicated, but you put me on the right path and this code would be perfect as-is for anybody using the default compare code.

Edited by AnonymousUser (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...