Jump to content

AddThis - Smart Layers


vidmarc
 Share

Recommended Posts

Poor choice of words on my part when I said version. I've not seen their site in a long time, so Smart Layers didn't mean anything to me.

 

It says you put the code wherever you want it to show on your site, so it would seem logical that you comment out the section from your skin/templates/content.product.php

{if $SHARE}
  		{foreach from=$SHARE item=html}
  		{$html}
  		{/foreach}
      {/if}

And replace it with the Smart Layer code. Since I'm guessing, be sure to save a good copy of the file before you try it. I'll be interested to see what you find out.

 

I would assume you disable the CC plugin.

Link to comment
Share on other sites

If you don't mind paying someone to do it, you might be able to get someone on the 3rd party forum to edit the existing plugin code to use the Smart Layer version. It might be simple enough to do that Bsmither, or another knowledgeable poster, could tell you what to do here, since that plugin is provided by CC.

Link to comment
Share on other sites

<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51ed4555069430e7"></script>
<script type="text/javascript">
  addthis.layers({
    'theme' : 'transparent',
    'share' : {
      'position' : 'left',
      'numPreferredServices' : 5
    }, 
    'follow' : {
      'services' : [
        {'service': 'facebook', 'id': 'Nucleus-Films'},
        {'service': 'twitter', 'id': 'nucleusfilms'}
      ]
    },  
    'whatsnext' : {},  
    'recommended' : {} 
  });
</script>
<!-- AddThis Smart Layers END -->
Link to comment
Share on other sites

The guy at AddThis just said:

 

 

Everything appears to be set up correctly on your end, and shares are showing up in the live view. You should, however, change this:

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=ra-51ed4555069430e7"></script>

to this:

<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51ed4555069430e7"></script>

 

 

 

Does this mean CC is adding something incorrectly?

Link to comment
Share on other sites

I tried it on our plushcatalog blueprint skin store, with my facebook and twitter account info included in the code, and I'm getting an error that has something to do with the facebook profile part of the code:

 

[Exception] /home3/butter01/public_html/plushcatalog/includes/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php:665 - Syntax Error in template "/home3/butter01/public_html/plushcatalog/skins/blueprint/templates/content.product.php" on line 310 "{'service': 'facebook', 'id': 'pages/Dirty-Butter-Plush-Animal-Shoppe/115434421845432'}," - Unexpected ": ", expected one of: "}" , " " , ATTR

 

Here's my whole AddThis SmartLayer Code:

<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-524305117d3cbe99"></script>
<script type="text/javascript">
  addthis.layers({
    'theme' : 'transparent',
    'share' : {
      'position' : 'left',
      'numPreferredServices' : 5
    }, 
    'follow' : {
      'services' : [
        {'service': 'facebook', 'id': 'pages/Dirty-Butter-Plush-Animal-Shoppe/115434421845432'},
        {'service': 'twitter', 'id': 'search4lovies'}
      ]
    }   
  });
</script>
<!-- AddThis Smart Layers END -->
Link to comment
Share on other sites

You are adding this directly to a Smarty template.

 

Smarty {$placeholders} and {code} are surrounded by braces with no white space.

 

This sequence:

{'service':

will cause Smarty to try to interpret it.

 

Rewrite the added code so that there will always be white space (space, tab, return) on the inside of the braces:

'service': (and at the end of the line)



@vidmarc: did you choose all the options? Or just that which was applicable to you?

 

By choosing all the options, I can then update the AddThis module correctly, and thus make the whole thing be as it should.

Link to comment
Share on other sites

Per what I understood your instructions to be, I changed the code to:

<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-524305117d3cbe99"></script>
<script type="text/javascript">
  addthis.layers({
    'theme' : 'transparent',
    'share' : {
      'position' : 'left',
      'numPreferredServices' : 5
    }, 
    'follow' : {
      'services' : [
        {
'service': 'facebook', 'id': 'pages/Dirty-Butter-Plush-Animal-Shoppe/115434421845432'
},
        {
'service': 'twitter', 'id': 'search4lovies'
}
      ]
    }   
  });
</script>
<!-- AddThis Smart Layers END -->

I've disabled the CC Addthis plugin, and I added this to both our stores. The error messages have stopped, but it's not showing on either store, even though I've cleared cache. I realize the estates store has the wrong facebook url at this point - just trying to get the code right at the moment.

Link to comment
Share on other sites

If the module is upgraded correctly (as opposed to pasting generated code directly into the main template), the AddThis Smart Layers code joins any other social module's code where the $SOCIAL placeholder is located -- site-docs and/or prod-detail pages. (Having pasted the code into the main template will display the effect on all pages.)

 

That said: whatever it is that the javascript wants to do is up to it.

Link to comment
Share on other sites

The SITE url's seem to be hard coded into this new code. I don't want to lose the plugin's ability to send the link to the actual product to FB and Twitter. Anyway, I'd never even heard of this until vidmark asked for help with it. I only attempted to install it to help him. I don't intend to leave it on my sites.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...