Add currency to google rich snippets

  • Posts: 26
  • Thank you received: 3
11 years 5 months ago #115616

Hi,

I've noticed when Google displays my products my item is listed in US Dollars - I'm assuming this is because I'm not giving google a rich snippet to say it should be in Australian Dollars (AUD).

So far i've worked out google is getting the snippet price from this field:

<span class="hikashop_product_price_full">
	<span  itemprop="price" class="hikashop_product_price hikashop_product_price_0">$24.00</span>  </span>
	</span>

It it possible to somehow easily add <span itemprop="currency">AUD</span> or similar into this code?
I'm reasonably familiar with PHP/javascript and can do basic modification - if you could at least point me towards the files where I could edit this I'd appreciate it :)

I fear having the "US" currency listed in my google results will drive domestic customers away who are my main target base.

An example of one of my pages is here: www.geekbyte.com.au/index.php/component/...blood-splatter-apron

I'm also happy to hard-code it into my site somehow to get this info correctly displayed

Last edit: 11 years 5 months ago by geekbyte.

Please Log in or Create an account to join the conversation.

  • Posts: 2334
  • Thank you received: 403
11 years 5 months ago #115643

Hi there,

Did you enabled the Microdata plugin? It's an Hikashop plugin which use your product data to create tags for google snippets (if I'm right).
You should try this and tell us if it doesn't work for your currencies ;)

Please Log in or Create an account to join the conversation.

  • Posts: 26
  • Thank you received: 3
11 years 5 months ago #115795

Hi,

I have that plugin enabled but I currently can't see the currency field in the sites HTML / php code. Google webmaster tools doesn't pick it up either.
Not sure if i've done something funny to disable this data or not.
Hopefully you can assist.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 5 months ago #115823

Hi,

I've done some tests through the google rich snippets test tool and it seems to correctly read the price and its currency. Did you test it through this test tool ?

Last edit: 11 years 5 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #144749

Hi,

Did you get an answer to this ? I am having exactly the same issue .

Search for "Mitrax 1011" in Google and you will see what I mean.

The snippet data contains price but no currency indicator & Google seems to assume USD.

Cheers
Rob


MItrax Trading
www.mitrax.com.au

Please Log in or Create an account to join the conversation.

  • Posts: 2334
  • Thank you received: 403
10 years 10 months ago #144813

Are you using the last version of Hikashop?
And could you give a link to your page?

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #144868

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13404
  • MODERATOR
10 years 10 months ago #144889

I do see the currency in the snippet of Google results page for your price:

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #144921

Interesting this is what a screenshot from google.com.au



MItrax Trading
www.mitrax.com.au
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #144922

Should I say this is what a screenshot from google.com.au looks like.


MItrax Trading
www.mitrax.com.au

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13404
  • MODERATOR
10 years 10 months ago #144964

I do see it correctly on google.com.au regardless of whether I'm logged in my google account or not.
Can you try again in incognito mode (a browser mode for anonymous surfing) ? I guess that you should also see the price without the US in that case.

Google and its personalized results...
I guess that it's because you display your currency with the $ symbol. If you edit your currency settings to display the prices like that: AUD$ 9.99 or something similar, it should be able to display the price in AUD regardless of the user searching for the product.

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #145050

Hi Nicolas,

Thanks for working with me on this . Incognito makes no difference:




The google test tool shows the following:





Would adding pricecurrency into the snippet help ?





Kind Regards
Rob


MItrax Trading
www.mitrax.com.au
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13404
  • MODERATOR
10 years 10 months ago #145072

Try to add the code:

$currency_id = $this->mainCurrency();
		$null = null;
		$currencies = $this->getCurrencies($currency_id,$null);
		$data=$currencies[$currency_id];
		$body=str_replace('</head>', '<meta itemprop="currency" content="'.$data->currency_code.'" /></head>', $body);
before:
JResponse::setBody($body);
in plugins/system/hikashopproducttag/hikashopproducttag.php

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #145130

MItrax Trading
www.mitrax.com.au
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13404
  • MODERATOR
10 years 10 months ago #145145

Try that code instead:

$currency_id = hikashop_getCurrency();
		$null = null;
		$currencyClass = hikashop_get('class.currency');
		$currencies = $currencyClass->getCurrencies($currency_id,$null);
		$data=$currencies[$currency_id];
		$body=str_replace('</head>', '<meta itemprop="currency" content="'.$data->currency_code.'" /></head>', $body);

Last edit: 10 years 10 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #145148

MItrax Trading
www.mitrax.com.au
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13404
  • MODERATOR
10 years 10 months ago #145189

Please use the code in my last message after I edited it.

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #145272

Hi Nicolas,

This is what I pasted into hikashopproducttag.php



Cheers
Rob


MItrax Trading
www.mitrax.com.au
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
10 years 10 months ago #145342

Hi,

It is logical that the plugin "hikashopproducttag" does not contain the function "getCurrencies".
I think it will be better if you call this function on this owner, the HikaShop currency class, like Nicolas wrote in his post.
You don't have to improvise you know, just to copy and past the code that Nicolas wrote for you :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 76
  • Thank you received: 5
10 years 10 months ago #145350

Jerome,

Thanks for pointing out the logic of the code in Hikashop I am pleased that I am in safe hands with someone who understands it as I can honestly say that I have no idea. As for improvising ... I guess I did to a degree i.e. I made an unintentional cut and paste error. :oops:

Complete code is now in and snippet is appearing in the metadata






but is not showing up in the google test tool. I changed the price to confirm the test tool was picking up changes.




Is it possible that the currency needs to be nested as a property of the offer before it can be picked up ?

Thanks in Advance.
Kind Regards
Rob


MItrax Trading
www.mitrax.com.au
Attachments:
Last edit: 10 years 10 months ago by Mitrax.

Please Log in or Create an account to join the conversation.

Time to create page: 0.160 seconds
Powered by Kunena Forum