Magento 1 Live Feed v1.x Developer Guide & API Reference

Using Plumrocket Magento Live Feed and Faves extensions with third-party module AddThis

If at some point you will need to track the activity using Live Feed extension and Faves extension together with third-party module AddThis – minor modifications to the code are required to be made. You will need to open the according template that you use, and once you see this part of java script code that was added by AddThis extension:

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js"></script>

please add the following code:

Code Example

<?php
    $faveButtonsHeader = $this->getLayout()->createBlock('fave/buttons_head');
    if ($faveModuleEnabled = !empty($faveButtonsHeader)) {
        $faveButtonsHeader
            ->setPageType('product')
            ->addButton('google_plus_button')
            ->addButton('tweet_button')
            ->addButton('fb_like')
            //->addButton('pin_it_button')
            ->toHtml();
    ?>
        <script type="text/javascript">
            addthis.addEventListener('addthis.menu.share', function(evt) {
                var u = evt.data.url;
                var p = u.indexOf('#');
                if (p != -1) {
                    u = u.substr(0, p);
                }
    
                switch (evt.data.service) {
                    case 'facebook_lile':
                    case 'facebook':
                        plumrocketFaveObserveEvent(u, 'fb_like');
                        break;
                    case 'tweet':
                    case 'twitter':
                        plumrocketFaveObserveEvent(u, 'tweet_button');
                        break;
                    case 'google_plusone_share':
                    case 'google':
                        plumrocketFaveObserveEvent(u, 'google_plus_button');
                        break;
                }
    
            });
        </script>
    <?php } ?>

Was this article helpful?