Hi all,

I've got a Views page and would like the AddThis button to show up on that page. The AddThis button currently shows up on all the other node pages. How can I get AddThis on a Views page?

Thanks in advance.

Comments

vesapalmu’s picture

Status: Active » Fixed

You have two options with views. If you want to display AddThis on every node in your view you can use existing views integration and add "Node: AddThis" field to your view. If you want to display just one button and share the entire view you can enable AddThis block from admin/build/block.

Hope this helps.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ethan.han777’s picture

Version: 6.x-2.8 » 7.x-2.1-beta1

Hi I'm using addthis 7.x-2.1 beta1
I don't see 'node:addthis' in views fields.
is this feature gone in this version?
thank you,

ehalber’s picture

Status: Closed (fixed) » Active

I don't see this option anywhere. I was thinking that I would just create an additional field in views and copy and paste the code into a rewrite textbox there. I think that will do it. I will post again if this solution is viable.

TelFiRE’s picture

I know that this was changed to "Content: Share"

However, on one of my sites I am now not seeing even that...

Update: Okay, I discovered why it is not showing up. It is now based on the name of the field and my old field happened to be called "Share". I didn't realize you had to add a field to the content type first.

Pretty please add this to your documentation or something like it:

Quick-Setup for Views:
1. Enable the AddThis and AddThis Displays modules.
2. Add an AddThis field to a new or existing content type.
3. Add the field to your view.

andreoman’s picture

When I set "YES" for Views settings Advanced -> Other -> Use AJAX
my VIEW stopped working correctly. The first page displays addthis toolbox, but when I click to another page (the content of the page is updated with AJAX) toolbox is not displayed.
But when set Use AJAX = "NO" VIEW works correctly.
What is wrong ?

matglas86’s picture

I know we fixed this in 7.x-4.x its in this commit. http://drupalcode.org/project/addthis.git/blobdiff/176c5c3385c78e1da3023...

Its related to this issue #1381470: Button not working on ajax pages

Maybe you can backport it. We don't support the 2.x branch anymore but if you have a port I can add it to the dev version. Thats it, no release or garentees. Sorry.

andreoman’s picture

It dosen't work !

andreoman’s picture

After hours of searching and trying I wrote the following,
changed the text in the addthis.js:

(function ($) {

  Drupal.behaviors.addthis = {
    attach: function(context, settings) {
      $.getScript(
        Drupal.settings.addthis.widget_url,
        function(data, textStatus) {
          addthis.init();
        }
      );
      if (context != window.document && window.addthis != null) {
	  window.addthis = null;  	
          window._ate = null;   
      }
    }
  };
}(jQuery));
matglas86’s picture

Did this do the trick for you? How did you came up with this solution?

andreoman’s picture

It helped me, but it does not work in IE9 :(
row 9 : 'addthis' is null or not an object

leymannx’s picture

Version: 7.x-2.1-beta1 » 7.x-4.0-alpha2
Component: Miscellaneous » Documentation

For me views support worked in 4.0-alpha2. I first had to add a AddThis field to the content type and then were able inside the view to add a field content: AddThis and finally just had to chose a formatter (button or toolbox).

Block support: For all using the block and wondering why the block doesn't appear anymore after updating the module: In the block config you now have to chose a display type (button or toolbox).

see15_aug’s picture

Thanks for ur post.. #12
u saved my time... :)

zJoriz’s picture

Not quite sure if this question belongs here, seems like a good bet though.

On the documentation homepage it says

If you use ajax features like in views, buttons may not appear because the content is loaded with ajax. The following code fixes that.

(function ($) {
    Drupal.behaviors.slider = {
        attach:function(context) {
            var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
            if (window.addthis) {
                window.addthis = null;
            }
            $.getScript(script);
        }
    };
}(jQuery));

However, it isn't clear to me where I should insert this snippet. addthis.js? a tpl.php file?
I'm off to try suggestion #12 now (installing 7.x-4.0-alpha2 despite the recommendation not to).

In the meantime, thanks for your hard work so far! This module is very neat and super handy.

matglas86’s picture

Issue summary: View changes
Status: Active » Fixed

To the previous commenter I suggest to download alpha3 that has this fix in it. And with the rest of this issue I believe its fixed all in alpha3.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

anandbej’s picture

#5 worked like a charm. Thanks

After adding the display field it didnt work for me. I then changed the format of the share field. Just pointing this out. Maybe it'll help someone.

slinky’s picture

Thanks for the comment about how to add addthis to a page re comment #5. I upgraded and lost addthis and couldn't re-enable. It was an impossible mission to figure out what was missing as the js was loading but I didn't see the widget. Re-adding a new field in the manage views on pages added the widget back. It's great to use for precision placement but if you don't mention how to implement, it doesn't show! Thanks for taking the time to explain and hope my explanation also adds further clarity.