2013-10-25 58 views
7

我想添加Google plus按鈕。因此用戶可以使用Google plus共享產品。但是當我點擊共享按鈕然後產品名稱,URL一切都是正確的,除了產品圖像。 產品圖像顯示不正確。我寫下面的代碼來創建Google Plus按鈕代碼。Google Plus分享按鈕顯示錯誤圖片

<a href="#" onclick="popUp=window.open('https://plus.google.com/share?url=my_product_url', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a> 

我也嘗試添加一些元標記來解決這個問題,但沒有發生。

<meta property="og:title" content="..."/> 
<meta property="og:image" content="..."/> 
<meta property="og:description" content="..."/> 

在排序我需要顯示當前產品的詳細信息和圖像在谷歌加分享彈出。

請儘快幫助我。

+0

你有多產品上市頁面中的這個問題沒有在單獨的產品權利? – Gowri

+0

不,我面對這個問題是產品詳細信息頁面。當我點擊Google Plus按鈕,然後點擊圖片而不是產品圖片。 – Indian

+0

然後你可以在頁面中添加[rich snippet](https://developers.google.com/+/web/snippet/) – Gowri

回答

2

它會更容易分不清什麼是錯的,如果你舉了一個例子URL,但它聽起來像您在產品詳細信息頁面上有多個實體的標記。當發生這種情況時,代碼片段獲取器將從頁面中的第一個實體獲取圖像。

使用此工具:http://www.google.com/webmasters/tools/richsnippets測試您的代碼段標記並確定代碼段獲取器正在查看的實體。

您還應該看看:https://developers.google.com/+/web/snippet/這表明我們更喜歡使用schema.org標記來描述頁面中的實體。

+0

謝謝ade。使用這個工具,我解決了我的問題。 – Indian

+0

太好了。你能告訴我們什麼是錯的嗎? – ade

+0

我有同樣的問題。但是當我使用你的工具時,它告訴我一切都是正確的。這是我的分享網址:https://plus.google.com/share?url=http://www.emmeline.mottet.org/actualite/afficher/8有什麼想法? – emottet

0

hello添加以下代碼產品詳細頁面

<?php $productName = $_helper->productAttribute($_product, $_product->getName(), ‘name’); ?> 
<?php $productUrl = $_helper->productAttribute($_product, $_product->getProductUrl(), 'product_url'); ?> 
<?php $productImage = $_product->getImageUrl() ?> 

<a href="#" onclick="popUp=window.open('https://plus.google.com/share?url=<?php echo urlencode($productUrl); ?>', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a> 

希望這有助於你...

+0

感謝MagikVishal爲您的答案,但你在哪裏使用$ productImage代碼? – Indian