I currently am developing a Magento driven online store which allows for a user to share a product on Facebook and get the opinion of others. It works quite well for sharing one product, however I also a comparison feature on the site which allows a user to choose a few products and then compare them. I would like the ability for a user to share all of the products they’re considering and get the opinion of their Facebook friends.
Is it possible to have multiple attachments when posting to a Facebook users wall through the Facebook feed dialog, if so, could someone please point me to the appropriate location.
Here is the current code I am using to share a product with one attachment.
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.');
}
}
);
}
Not long ago, I have answered a similar question here. It’s about customizing the feed posted to Facebook, and the answer is no.
But Facebook just pull out lots of changes, including some changes in posting feed. I have noticed the new “properties” params. Though document is not clear, you can test your luck with the “properties” in the document about FB.ui here.