我目前正在开发一个Magento驱动的在线商店,允许用户在Facebook上分享产品并获得其他人的意见。它非常适合共享一个产品,但我也是网站上的一个比较功能,它允许用户选择一些产品然后进行比较。我希望用户能够分享他们正在考虑的所有产品并获得他们Facebook好友的意见。
通过Facebook Feed对话框发布到Facebook用户墙时是否可以有多个附件,如果是这样,有人可以请我指向相应的位置。
以下是我用来与一个附件共享产品的当前代码。
function post_to_fb()
{
FB.ui(
{
method: 'stream.publish',
attachment: {
name: '<?php echo $_product->getName() ?>',
description: (
'<?php echo $_product->getShortDescription() ?>'
),
source: '<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(100,100);?>',
href: '<?php echo Mage::helper('core/url')->getCurrentUrl() ?>'
},
action_links: [
{ text: 'View the Product', href: '<?php echo Mage::helper('core/url')->getCurrentUrl() ?>' }
],
user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
答案 0 :(得分:2)
不久前,我已经回答了类似的问题here。这是关于自定义发布到Facebook的Feed,答案是否定的。
但Facebook只是做了很多改变,包括发布Feed的一些变化。我注意到了新的“属性”参数。虽然文档不清楚,但您可以使用document about FB.ui here中的“属性”测试您的运气。