PDA

View Full Version : Modified rating plugin with Google microdata



Steffen Buschkemper
May 2, 2013, 05:48 PM
Hi @ All,

In this thread you can download the modified rating plugin.
The modified version is incl. Google Microdata for Listings.

To also show the prices at google, open the following file in
includes - > controllers -> listing_details.inc.php

Search the follow code @ line ~ 29



$sql = "SELECT `T1`.*, `T2`.`Path`, `T2`.`Type` AS `Listing_type`, `T2`.`Key` AS `Cat_key`, `T2`.`Type` AS `Cat_type`, ";


and replaced it with the following code



$sql = "SELECT `T1`.*, `T1`.`price` AS `Listing_price`, `T1`.`description_add` AS `Listing_info`, `T2`.`Path`, `T2`.`Type` AS `Listing_type`, `T2`.`Key` AS `Cat_key`, `T2`.`Type` AS `Cat_type`, ";


Now search following code @ line ~ 43 and after this line



$rlSmarty -> assign_by_ref('listing_data', $listing_data);


add the following code



/* Listing Description for google rich snippets */
$listing_info = $listing_data['Listing_info'];
$listing_info = preg_replace('#\{.*?\}#m' , '' , $listing_info);
$listing_info = strip_tags($listing_info);
$listing_info = preg_replace("/[^ ]*$/", '', substr($listing_info, 0, 160));
$rlSmarty -> assign_by_ref('listing_info', $listing_info);

/* Listing Price and Currency for google rich snippets */
$listing_pval = $listing_data['Listing_price'];
$key1str = "data_formats+name+";
$key2str = preg_replace('/[^A-Za-z]/', '', $listing_pval);
$keystr = $key1str.$key2str;
$gprice = preg_replace('/[^0-9\.\,]/', '', $listing_pval);
$csign = mysql_query("SELECT `Value` FROM `" . RL_DBPREFIX . "lang_keys` WHERE `Key` = '{$keystr}'");
$listing_currency = mysql_result($csign, 0);
$listing_price = $gprice;
$rlSmarty -> assign_by_ref('listing_currency', $listing_currency);
$rlSmarty -> assign_by_ref('listing_price', $listing_price);


Save and close.

Attention!!! The original rating plugin must before uninstalled and removed from plugin folder.
All existing reviews will be lost!

Download, extract and install the modified rating plugin. -> 498

Now you just need to use the ISO 4217 currency code. Also Google rating accepts only 5 stars!

497

Here is also a List of ISO 4217 currency code -> Link (http://www.xe.com/iso4217.php)

The results of the search requests with google after this modification can you see in follow image...

499

Thats all....

Best regards
Steffen

Oslo
May 2, 2013, 08:50 PM
I did every step, but doesn't appear when I test it on Google webmaster tools (http://www.google.de/webmasters/tools/richsnippets), even doesn't appear stars.

Steffen Buschkemper
May 3, 2013, 05:50 AM
Hi Oslo,

It takes a while until it is shown so in search engines as of the picture
The search engine must revisit your side incl. microcode.
Only then the pages are displayed in the search results with stars.
Of course only if an rating has been made.

In THIS (http://www.flynax.com/forum/showthread.php?1167-How-to-show-ratings-on-Google-search) thread we have all discussed and implemented.
Because you have attended in this thread. LoL
> HERE < (https://www.google.de/#q=ESAB+EyeTech+svetshj%C3%A4lm) you see a search result of the first page indexing with microcode of Morgans page.
And > HERE < (http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fwww.fyndklippet.se%2 Fannonser%2Fdatorer%2Ftangentbord%2Fmini-tangentbord-tradlost-i8-2-4-rii-med-touchpad-452.html&html=) a result of a page from Morgan in google rich snippet test tool.

Best regards
Steffen

Oslo
May 3, 2013, 05:06 PM
I mean in Google rich snippet test tool, doesn't appear.

and is that OK if I have in Admin -> PanelData -> EntriesCurrency only ($ and €) instead USD and EUR?

Steffen Buschkemper
May 3, 2013, 05:39 PM
Hi Oslo



I mean in Google rich snippet test tool, doesn't appear.


My test and the test of Morgans page works great.
I do not know why it should be any different with your side...



and is that OK if I have in Admin -> PanelData -> EntriesCurrency only ($ and €) instead USD and EUR?


No, that's not ok. Sorry.
Google microdata accepts only the ISO 4217 currency code format.

I have test it with € and $ but the price was not displayed.
With USD and EUR no problem and the price was displayed.

If it is a problem for you, then you can disable the rich snippets for price in
Admin Panel - Common -> Configurations -> Listing Rating -> and disable Data with Price

Best regards
Steffen

Serhii Kutserei
June 11, 2014, 01:51 PM
Hey Steffen, is there any chance you can update your plugin to 4.3 version? It look's like it not working with the 4.3..

Ameer Hassan
June 14, 2014, 09:54 AM
Hello "not working with 4.3
i still have problem with google master
Missing: best or worst rating ???
what to do with it?

Anderson Camargo
February 8, 2017, 09:30 PM
Hi thanks for the modification is working very well with version 4.5.2

Nick Ringelberg
February 19, 2017, 12:22 PM
If I add this, than I get an mysql error that it not exist
`T1`.`description_add` AS `Listing_info`,

Curtis
February 21, 2017, 05:38 AM
If I add this, than I get an mysql error that it not exist
`T1`.`description_add` AS `Listing_info`,

You need to check your listing fields, in this case it must have field with description with key "description_add", or you need change it to another key.

Nick Ringelberg
February 23, 2017, 07:20 PM
That works! thnks!