Search code examples
phpmagento-1.4sharingaddthis

Is it possible to give custom url for AddThis plugin?


I have magento wishlist and I want to share it and AddThis plugin would be good, because you can share it with all social apps. But in Magento wishlist url is different to shared wishlist address, so is it possible to share different url than current url user is?


Solution

  • I managed to do it myself, here is code:

    <?php
    // app/design/frontend/base/default/template/wishlist/view.phtml (override this in your template)
    
    $wishlist = $this->_getWishlist();
    $shareWishListUrl = Mage::getUrl('*/shared/index', array('code' => $wishlist->getSharingCode()));
    $shareAttributes = "addthis:url='$shareWishListUrl' addthis:title=" . $this->__('My Wishlist') . " addthis:description='' ";
    ?>
    <!-- AddThis Button BEGIN -->
    <div class="addthis_toolbox addthis_default_style " style="float: left;">
    <div class="text-align: left !important;"><?php echo $this->__('Share My Wishlist'); ?>:</div>
    <a class="addthis_button_preferred_1" <?php echo $shareAttributes; ?>></a>
    <a class="addthis_button_preferred_2" <?php echo $shareAttributes; ?>></a>
    <a class="addthis_button_preferred_3" <?php echo $shareAttributes; ?>></a>
    <a class="addthis_button_preferred_4" <?php echo $shareAttributes; ?>></a>
    <a href="http://www.addthis.com/bookmark.php" class="addthis_button_compact" <?php echo $shareAttributes; ?>></a>
    <a class="addthis_counter addthis_bubble_style"></a>
    </div>
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
    <!-- AddThis Button END -->