我想在 category-product-view 中添加 Facebook like 按钮。
我在 head.phtml 中添加了以下部分:
<?php
$product = Mage::registry('current_product');
if($product)
{
?>
<meta property="og:title" content="<?php echo trim($product->getName()); ?>"/>
<meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>"/>
<meta property="og:type" content="product"/>
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'image') ;?>"/>
<?php
}
?>
并在 addto.phtml (template/catalog/product/view/addto.phtml)(line:31) 中添加以下代码:
<ul class="add-to-links">
<li>
<div class="fb-like" data-href="<?php echo $this->helper('core/url')->getCurrentUrl();?>" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true">
</div>
</li>
我得到了点赞按钮,但点击它会在图像部分显示问号,而点赞部分没有效果(即点赞未完成)。
它一次又一次地要求确认。
在我的 fb 个人资料中添加同一页面没有更新。
我想要图像、标题、描述单击按钮并在 fb 个人资料页面中反映相同。
提前致谢。