Page 1 of 3

[vQmod] Remove Add to Compare

Posted: Fri Dec 23, 2011 6:33 pm
by olimax
Quick vQmod to Remove all 'Add to Compare' links
Tested on 1.5.1.3
Obviously you have to change 'default' to your theme if you are using a different one
I think I have caught all instances. Let me know if not.

Remove Add to Compare for 1.5.1.3

Code: Select all

<modification>

	<id>Remove Add to Compare</id>
	<version>1.0.0</version>
	<vqmver>1.2.3</vqmver>
	<author>Olimax</author>

	<file name="catalog/view/theme/default/template/product/category.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[ ]]>
            </add>
        </operation>
	</file>

	<file name="catalog/view/theme/default/template/product/manufacturer_info.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[ ]]>
            </add>
        </operation>
	</file>
	
	<file name="catalog/view/theme/default/template/product/product.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<a onclick="addToCompare('<?php echo $product_id; ?>');"><?php echo $button_compare; ?></a>]]>
            </search>
            <add>
            	<![CDATA[ ]]>
            </add>
        </operation>
        
        <operation>
            <search position="replace">
            	<![CDATA[<a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a><br />]]>
            </search>
            <add>
            	<![CDATA[<span><a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a></span>]]>
            </add>
        </operation>        
          
	</file>
	
	<file name="catalog/view/theme/default/template/product/search.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[ ]]>
            </add>
        </operation>
	</file>
	
	<file name="catalog/view/theme/default/template/product/special.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[ ]]>
            </add>
        </operation>
	</file>      
	
		
</modification>

Re: [vQmod] Remove Add to Compare

Posted: Mon Jan 02, 2012 4:53 pm
by Wallimann
Nice job.
I have a problem though, when applying this instead of removing the "add to compare" I get a "null" text...
Any idea?

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 03, 2012 2:41 pm
by stewiek
same here, it does removed the "add to compare" but its replaced by "null"

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 03, 2012 6:57 pm
by olimax
Curious.
Try this

Code: Select all

<modification>

	<id>Remove Compare</id>
	<version>1.0.0</version>
	<vqmver>2.1.3</vqmver>
	<author>Olimax</author>

	<file name="catalog/view/theme/default/template/product/category.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[<!-- -->]]>
            </add>
        </operation>
	</file>
	
	
	
	
	<file name="catalog/view/theme/default/template/product/manufacturer_info.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[<!-- -->]]>
            </add>
        </operation>
	</file>
	

	<file name="catalog/view/theme/default/template/product/product.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<a onclick="addToCompare('<?php echo $product_id; ?>');"><?php echo $button_compare; ?></a>]]>
            </search>
            <add>
            	<![CDATA[<!-- -->]]>
            </add>
        </operation>
        
        <operation>
            <search position="replace">
            	<![CDATA[<a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a><br />]]>
            </search>
            <add>
            	<![CDATA[<span><a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a></span>]]>
            </add>
        </operation>        
        
        
	</file>
	
	<file name="catalog/view/theme/default/template/product/search.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[<!-- -->]]>
            </add>
        </operation>
	</file>
	
	<file name="catalog/view/theme/default/template/product/special.tpl">
        <operation>
            <search position="replace">
            	<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
            </search>
            <add>
            	<![CDATA[<!-- -->]]>
            </add>
        </operation>
	</file>      
	
	
		
</modification>

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 03, 2012 7:04 pm
by olimax
Please note this is for vQmod Version 2 if that makes any difference

Re: [vQmod] Remove Add to Compare

Posted: Sun Jan 08, 2012 6:29 am
by merrydukaan
olimax wrote:Please note this is for vQmod Version 2 if that makes any difference
Hi, Same 'null' here too.
Another css workaround here: http://forum.opencart.com/viewtopic.php?f=20&t=46951

>>Opencart v1.5.1.3 fresh install, php 5.1.6, Apache/2.2.3 (CentOS)

Re: [vQmod] Remove Add to Compare

Posted: Mon Jan 09, 2012 11:01 am
by olimax
merrydukaan wrote: Hi, Same 'null' here too.
>>Opencart v1.5.1.3 fresh install, php 5.1.6, Apache/2.2.3 (CentOS)
did you use the updated version above?
where do you see the null?
do you have a live example?

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 10, 2012 6:21 pm
by merrydukaan
Hi Olimax,
Yes, I used the updated version. The null appears on product list page, an example:
http://www.indivineinterest.com/shop/T- ... uman%20Tee

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 10, 2012 6:54 pm
by olimax
hmmm
well that has stumped me
as i am just replacing the line with a blank comment I cant see where you are getting that from
it should either find the line and replace iit or not
that looks like a php empty variable

are you running any other vqmods that may interfere with it?
try removing all others (just temporarily stick them all in a subdirectory called REMOVED or something)
do you get any errors in the vqmod logs?

oli

Re: [vQmod] Remove Add to Compare

Posted: Tue Jan 10, 2012 7:39 pm
by merrydukaan
Hi
Nope, no other mods.
The last entry I got in the logs with my custom theme on:
Could not resolve path for [catalog/view/theme/shopidi/template/product/category.tpl]
Similarly for: manufacturer_info.tpl, search.tpl, special.tpl. I have copied only product.tpl in my custom folder. But should OC not fallback to defaults?
. . .
Checked with default theme, 'null' again.
The vqmod seems to work on individual product pages although!
No recent errors.
. . .
Copied all those .tpl's to custom folder, 'null' again.
No errors.

Re: [vQmod] Remove Add to Compare

Posted: Wed Jan 11, 2012 11:15 pm
by someguy9
I got this working, I'm not going to write the vqmod script for it, but I was getting the null error also. I found if you keep the div it doesnt show the error, so where's what I replaced it with

Code: Select all

<div class="compare"><?php /* <a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a> */ ?></div>

Re: [vQmod] Remove Add to Compare

Posted: Thu Jan 12, 2012 5:25 am
by takahashi1973
indeed; the null is caused before you remove the div all togther but ...
it gets "rendered" at the end in function:
function display(view) {

$('.product-grid').attr('class', 'product-list');

$('.product-list > div').each(function(index, element) {
html = '<div class="right">';
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';
html += ' <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';

always possible to extend the search and replace including these lines
//comment it html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';
but leaving the div empty works too although in some cases you might end up with to much whitespace for instance.

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 2:32 am
by smitch6
how does this actually work?
have i got to make my own tpl file from the code above? or just find it somewhere and change it?
thanks

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 2:41 am
by olimax
you need to have vQmod installed ( do a search ) - this is a very good thing
then just drop the file into the xml directory XML in vqmod
and Fanny's your aunt
...hopefully

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 3:07 am
by smitch6
what file????? ??? sorry
so i presume i make my own file from that code you posted
yes i have vqmod installed :)
i noticed you said you couldn't upload a file
any particular format for the homemade file?

thanks :)

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 3:41 am
by smitch6
sorted sort of
i saved it as an xml file and uploaded it via VQmod after i changed all the default to my current theme
and it has removed most of the compares apart from the main page with the feature images
the theme i use shows a compare on there and it's still there :( any ideas pls :)

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 3:47 am
by smitch6
i tried adding this code to the file
<file name="catalog/view/theme/theme46/template/product/feature.tpl">
<operation>
<search position="replace">
<![CDATA[<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>]]>
</search>
<add>
<![CDATA[<!-- -->]]>
</add>
</operation>
</file>
but with no joy
this is the problem i'm facing see attached image
Screen Shot 2012-01-20 at 19.46.57.png

Screen Shot 2012-01-20 at 19.46.57.png (38.92 KiB) Viewed 18938 times


Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 6:36 am
by olimax
Sorry
My mistate.
I have added it to the original post now

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 5:30 pm
by smitch6
Sorry it doesn't work with my theme on the latest .3 version :(

Re: [vQmod] Remove Add to Compare

Posted: Sat Jan 21, 2012 5:40 pm
by olimax
you have to change the files tag to point to your theme

eg

Code: Select all

<file name="catalog/view/theme/default/template/product/category.tpl">
change to:

Code: Select all

<file name="catalog/view/theme/YOURTHEME/template/product/category.tpl">