Community Forums

[vQmod] Remove Add to Compare

Put any free vQmod scripts here.
vQmod details

[vQmod] Remove Add to Compare

Postby olimax » Fri Dec 23, 2011 10:33 am

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.
olimod_remove_addto_compare.xml
Remove Add to Compare for 1.5.1.3
(2.6 KiB) Downloaded 588 times


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>
Last edited by olimax on Fri Jan 20, 2012 10:35 pm, edited 1 time in total.
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby Wallimann » Mon Jan 02, 2012 8:53 am

Nice job.
I have a problem though, when applying this instead of removing the "add to compare" I get a "null" text...
Any idea?
Guitar Backing Tracks and Video Lessons at http://www.guitarplayback.com
Wallimann
 
Posts: 85
Joined: Thu Oct 28, 2010 5:38 pm
Location: Colorado

Re: [vQmod] Remove Add to Compare

Postby stewiek » Tue Jan 03, 2012 6:41 am

same here, it does removed the "add to compare" but its replaced by "null"
stewiek
 
Posts: 24
Joined: Mon Nov 09, 2009 8:04 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Tue Jan 03, 2012 10:57 am

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>
Last edited by olimax on Tue Jan 03, 2012 11:11 am, edited 1 time in total.
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby olimax » Tue Jan 03, 2012 11:04 am

Please note this is for vQmod Version 2 if that makes any difference
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby merrydukaan » Sat Jan 07, 2012 10:29 pm

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)
>> search before you post and [solved] when solved
>>Opencart v1.5.1.3, php 5.1.6, Apache/2.2.3 (CentOS)
merrydukaan
 
Posts: 47
Joined: Sun Jan 01, 2012 7:26 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Mon Jan 09, 2012 3:01 am

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?
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby merrydukaan » Tue Jan 10, 2012 10:21 am

Hi Olimax,
Yes, I used the updated version. The null appears on product list page, an example:
http://www.indivineinterest.com/shop/T-shirts/Hanuman%20Tee
>> search before you post and [solved] when solved
>>Opencart v1.5.1.3, php 5.1.6, Apache/2.2.3 (CentOS)
merrydukaan
 
Posts: 47
Joined: Sun Jan 01, 2012 7:26 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Tue Jan 10, 2012 10:54 am

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
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby merrydukaan » Tue Jan 10, 2012 11:39 am

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.
>> search before you post and [solved] when solved
>>Opencart v1.5.1.3, php 5.1.6, Apache/2.2.3 (CentOS)
merrydukaan
 
Posts: 47
Joined: Sun Jan 01, 2012 7:26 am

Re: [vQmod] Remove Add to Compare

Postby someguy9 » Wed Jan 11, 2012 3:15 pm

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>
oh.
User avatar
someguy9
 
Posts: 9
Joined: Wed Jan 11, 2012 3:14 pm
Location: College Park, MD

Re: [vQmod] Remove Add to Compare

Postby takahashi1973 » Wed Jan 11, 2012 9:25 pm

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.
takahashi1973
 
Posts: 140
Joined: Thu Oct 13, 2011 3:41 pm

Re: [vQmod] Remove Add to Compare

Postby smitch6 » Fri Jan 20, 2012 6:32 pm

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
smitch6
 
Posts: 155
Joined: Sat Sep 17, 2011 6:46 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Fri Jan 20, 2012 6:41 pm

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
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby smitch6 » Fri Jan 20, 2012 7:07 pm

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 :)
smitch6
 
Posts: 155
Joined: Sat Sep 17, 2011 6:46 am

Re: [vQmod] Remove Add to Compare

Postby smitch6 » Fri Jan 20, 2012 7:41 pm

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 :)
smitch6
 
Posts: 155
Joined: Sat Sep 17, 2011 6:46 am

Re: [vQmod] Remove Add to Compare

Postby smitch6 » Fri Jan 20, 2012 7:47 pm

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 5414 times
smitch6
 
Posts: 155
Joined: Sat Sep 17, 2011 6:46 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Fri Jan 20, 2012 10:36 pm

Sorry
My mistate.
I have added it to the original post now
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Re: [vQmod] Remove Add to Compare

Postby smitch6 » Sat Jan 21, 2012 9:30 am

Sorry it doesn't work with my theme on the latest .3 version :(
smitch6
 
Posts: 155
Joined: Sat Sep 17, 2011 6:46 am

Re: [vQmod] Remove Add to Compare

Postby olimax » Sat Jan 21, 2012 9:40 am

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">
User avatar
olimax
 
Posts: 77
Joined: Thu Dec 22, 2011 9:08 am
Location: Barcelona & London

Next

Return to vQmods

Who is online

Users browsing this forum: No registered users and 9 guests

Hosted by Arvixe Web Hosting