【发布时间】:2012-01-27 15:00:32
【问题描述】:
我正在尝试将"Pin it" button from Pinterest 添加到我们网站的产品详细信息页面中。
到目前为止我已经尝试过:
<a href="http://pinterest.com/pin/create/button/?url=<?php echo trim(Mage::registry('current_product')->getProductUrl()) ?>&media;=<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(265) ?>&description;=<?php echo Mage::registry('current_product')->getName(); ?>" class="pin-it-button" count-layout="none">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
和
<a href="http://pinterest.com/pin/create/button/?url=<?php echo trim(Mage::registry(\'current_product\')->getProductUrl()) ?>&media;=<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(900,900);?>&description;=<?php echo Mage::registry('current_product')->getName(); ?>" class="pin-it-button" count-layout="none">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
通过其中任何一个,我可以获得产品的 URL 和产品的名称,但我无法获得产品的图像。所以帖子不起作用(它需要所有 3 项才能起作用:URL、媒体和描述)
当我尝试这个时:
<a href="http://pinterest.com/pin/create/button/?url=http://eberjey.com&media;=<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(900,900);?>&description;=<?php echo Mage::registry('current_product')->getName(); ?>" class="pin-it-button" count-layout="none">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
我可以发布产品的图片,但 URL 不是动态的(我只是使用网站的绝对 URL)。
关于如何在我的产品详细信息页面中实现此按钮的任何想法?
【问题讨论】: