是否可以为AddThis插件提供自定义URL?

时间:2011-11-01 07:53:35

标签: php magento-1.4 sharing addthis

我有magento心愿单,我想分享它和AddThis插件会很好,因为你可以与所有社交应用分享。但是在Magento中,wishlist url与共享的wishlist地址不同,那么是否可以共享不同于当前url用户的url?

2 个答案:

答案 0 :(得分:0)

我自己设法做到了,这里是代码:

<?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 -->

答案 1 :(得分:0)

有关最新的addthis代码,请使用data-url和data-title。有关详细信息,请参阅here