AnonymousUser Posted June 28, 2013 Share Posted June 28, 2013 (edited) By default the product compare only works for products on category pages. What would have to be done in order to add products to the compare from the home page and directly from product pages? Edited July 1, 2013 by AnonymousUser (see edit history) Link to comment Share on other sites More sharing options...
SmartDataSoft Posted June 29, 2013 Share Posted June 29, 2013 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 1 Link to comment Share on other sites More sharing options...
AnonymousUser Posted July 1, 2013 Author Share Posted July 1, 2013 (edited) 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 July 1, 2013 by AnonymousUser (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts