Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
SOLVED - How to dynamically get product image URL and page title outside of main page content? 
 
gamezone1
Jr. Member
 
Total Posts:  1
Joined:  2012-05-16
 
tzyganu - 04 May 2010 01:53 AM

This should work if you modify t a little

<?php echo $this->helper('catalog/image')->init($_product'small_image')->resize(100100); ?>
Instead of $this->helper() use Mage::helper()
and instead of $_product use Mage::registry(’current_product’).
The variable $_product is not visible outside the block you got this code from
you can do something like this:
<?php if (Mage::registry('current_product')) : ?>
<meta property="og:image" content="<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(100,100);?>" />
<
meta property="og:title" content="<?php echo Mage::registry('current_product')->getMetaTitle()?>" /> 
<?php endif;?>

Good luck,
Marius.

IS THIS POSSIBLE FOR MAGENTO GO AND HOW?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ffio
Jr. Member
 
Total Posts:  2
Joined:  2011-07-02
 

ScottG’s solution almost worked for me with 1.7.  I could see in the rendered page source the correct path to the image was being called, but the FB like wasn’t grabbing it.  I ran my site’s URL through the FB debugger and found that I that had to change the the small image size to 200x200. After that, it would pull the correct image.

<?php if (Mage::registry('current_product')) : ?>
<meta property="og:image" content="<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(200,200);?>" />
<
meta property="og:title" content="<?php echo Mage::registry('current_product')->getName();?>" /> 
<?php endif;?>

The FB debugger:
https://developers.facebook.com/tools/debug/

Some good info here too:
https://developers.facebook.com/docs/insights/

There are some additional tags that need to be added for better click-through.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cod3gen
Jr. Member
 
Total Posts:  7
Joined:  2012-08-13
 

Great!

Got it working now that i found this post.
Still, im missing a couple tags:

Inferred Property:  The ‘og:url’ property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property:  The ‘og:description’ property should be explicitly provided, even if a value can be inferred from other tags.

Does anyone have the code to add this in?
And for the description, what Open Graph is picking out now includes <p> </br> and more html tags like that, is it possible to strip those, and maybe use smalldescription instead of description?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jorgb
Jr. Member
 
Total Posts:  9
Joined:  2011-01-21
 

Its working but the only problem left is that when you use “ for example in your product title then it goes wrong! How can we convert that character to for example

&quot;
 
Magento Community Magento Community
Magento Community
Magento Community
 
greekcollective
Jr. Member
 
Total Posts:  2
Joined:  2013-07-07
 

Hello I know this is quite an old post but I am really struggling to properly connect Facebook to all my products. I have successfully integrated the like button to each page but once on facebook, the image, product name, and description do not appear correctly. Could someone please explain how to fix this problem to someone who does not know much about coding, website developing, etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
prashant1234
Jr. Member
 
Total Posts:  4
Joined:  2011-11-29
 

Hello,
I am facing issue facebook share button on product detail page. I have pass all necessary things but not getting product image on facebook shar. Here is my code

This code is put in product detail page. page/html/view.html

<?php $product Mage::registry('current_product');
if (
$product): ?>
<meta property="og:title" content="<?php echo $product->getName(); ?>" />
<
meta property="og:type" content="product" />
<
meta property="og:url" content="<?php echo $this->helper('catalog/product')->getProductUrl($product); ?>" />
<
meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(100, 100); ?>" />
<
meta property="og:description" content="<?php echo strip_tags($product->getShortDescription()); ?>" />
<
meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>" />
<?php endif; ?>

This code is put in product detail page. catalog/product/view.html

<a href="[removed]popWin('http://www.facebook.com/share.php?u=<?php echo urlencode($_product->getProductUrl()); ?>&t;=<?php echo urlencode($_product->getName()); ?>', 'facebook', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Share on Facebook') ?>">Facebook</a>

Please help me asap.
Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
daniel147
Jr. Member
 
Total Posts:  1
Joined:  2013-11-20
 

With this VB.NET imaging SDK, developers and end users are able to download, view and save the bulk of image files from any desired website URL; quickly and conveniently in VB imaging project. Users just need to define the web link, and then download what they want, including a single image and multiple image galleries.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jase007
Guru
 
Total Posts:  388
Joined:  2013-11-05
 

Hi,

thanks for the code tzyganu, works perfetly for me.

Thanks

iLoveMage

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2