我试图将"Pin it" button from Pinterest添加到我们网站上的产品详细信息页面。Magento:在产品详细信息页面添加Pinterest“Pin it”按钮
到目前为止,我已经试过:
<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>
与任何这些,我可以得到项目Service items的网址和产品的名字,但我不能让产品的形象。所以,后不工作(它需要所有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)。
有关如何在我的产品详细信息页面中实现此按钮的任何想法?
我试图获取当前的商品网址,但是当我使用的代码“引脚为”脚本没有拿到产品形象。 如果我使用绝对URL,例如:http://domain.com,那么脚本将获取产品图像。 我也试过'<?php echo $ this - > _ data ['urlKey']?>'但它仍然不起作用。 – jmanson 2012-02-01 14:01:04
@jmanson如果你不介意,可否请在这里发布错误和正确的URL样本? – 2012-02-01 16:00:31
你检查过pinit.js吗?该脚本希望将网址除以'&' – 2012-02-01 16:02:01