Jump to content

[Resolved] Google Rich Cards


foz1234

Recommended Posts

Google rich cards,

although not directly related to CC i would like to ask you experienced CC users, if i may, where i add the syntax for the mobile rich cards?

i assume i add the rich card script, to the body of my existing product source code? is that correct?

although the code is hidden from view, i assume google reads both the std product code and the rich card? or do i need to add the rich card script as separate html page hopefully you understand what i mean.

thanks for any input

kind regards

Foz1234 

Link to comment
Share on other sites

As DB said, rich cards are only currently for recipes (which isnt really relevant for many / any CubeCart stores) but Structured Data / Micro data can be added for products and reviews (events as well, although again, that is not very relevant for stores).

Our plugin available via the Marketplace adds all relevant micro data easily for you - see https://www.cubecart.com/extensions/plugins/google-schema-org-microdata-plugin

A free trial is available which you can use to test on your store for up to 7 days

Ian

Link to comment
Share on other sites

I took a look at the Products sample Google gave, and it's a jason script file. So I created a schema.js file and added it to the skin's js folder. I called it at the bottom of main.php where the other scripts are listed.

The Structured Testing Tool seemed to like what I have. I already had schema on the content.product.php file, so the pricing and review info were picked up from that. I've never been able to get Google to accept my attempt to add condition. The script seems to get the condition properly.

This is TOTALLY guesswork:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Product",  "@context": "http://schema.org/",
  "name": "{$PRODUCT.name}",
  "image": "{$STORE_URL}/images/source/{$PRODUCT.medium}",
  "description": "{$PRODUCT.description}",

  "brand": {
    "@type": "Thing",
    "name": "{$MANUFACTURER}"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "{$REVIEW_AVERAGE}",
    "reviewCount": "{$REVIEW_COUNT}"
  },
  "offers": {
    "@type": "Offer",
    "priceCurrency": "USD",
    "price": "{$PRODUCT.price_to_pay}",
    "itemCondition": "http://schema.org/UsedCondition",
    "seller": {
      "@type": "Organization",
      "name": "{$CONFIG.store_name}"
    }
  }
}
</script>

This script still needs availability, but we show out of stock items on our store. I never could figure out how to word the if/then for InStock and OutOfStock in javascript syntax, so I added the availability to the microdata on content.product.php.

Also, there's nothing here to show items On Sale, which I don't need at the moment but certainly will in the future.

These testing tools were invaluable! http://www.seoskeptic.com/structured-data-markup-validation-testing-tools/

For the first time ever - Google accepted my Automatic Item Updates!!

Edited by Dirty Butter
Revised code to show what appears to be working correctly
Link to comment
Share on other sites

On ‎19‎/‎08‎/‎2016 at 10:46 AM, havenswift-hosting said:

As DB said, rich cards are only currently for recipes (which isnt really relevant for many / any CubeCart stores) but Structured Data / Micro data can be added for products and reviews (events as well, although again, that is not very relevant for stores).

Our plugin available via the Marketplace adds all relevant micro data easily for you - see https://www.cubecart.com/extensions/plugins/google-schema-org-microdata-plugin

A free trial is available which you can use to test on your store for up to 7 days

Ian

Ian, will this plugin be edited/updated to include the product rich card?

i am interested in this as my php is not so good. i will make sure my host has the ionCube installed

Link to comment
Share on other sites

1 hour ago, foz1234 said:

Ian, will this plugin be edited/updated to include the product rich card?

i am interested in this as my php is not so good. i will make sure my host has the ionCube installed

The plugin already adds 23 different micro data / schema.org markup to the product landing page covering product and review information - this is everything that is currently possible.  If changes are made and additional markup is added, then we will add that to the plugin

Ian

Link to comment
Share on other sites

  • 1 month later...

Hi Ian, sorry i had forgotten about getting your micro data plugin installed, so today was having a quiet day so i got ioncube installed on the server and then followed by your 7 day trial, may i ask now how do i know if this is working?

I've turned the plugin on in cc and there seems to be no setting up, I've logged into my google webmasters tools and done a fetch as google.

forgot to say i am using the standard skin.

i see under the install guide, i see this information do i need to do this for the trial period or make a backup and edit so i keep the original in case i decide not to purchase the plugin.

Within the two files content.product.php and element.product_reviews.php search for and remove any instances of the following:

  • itemtype="http://schema.org/Product"
  • itemtype="http://schema.org/AggregateRating"
  • itemtype="http://schema.org/Review"
  • itemtype="http://schema.org/Rating"
  • <meta itemprop="ratingValue" content="{$REVIEW_AVERAGE}">
  • <meta itemprop="reviewCount" content="{$REVIEW_COUNT}">
  • <meta itemprop="datePublished" content="">
  • <meta itemprop="worstRating" content="0">
  • <meta itemprop="ratingValue" content="{$review.rating}">
  • <meta itemprop="bestRating" content="5">
  • itemprop="aggregateRating"
  • itemprop="description"
  • itemprop="review"
  • itemprop="reviewRating"
  • itemprop="author"
  • itemscope

Finally, within the file content.product.php find the following line:
{if isset($PRODUCT) && $PRODUCT}

AFTER ON A NEW LINE ADD:
{if (isset($MICRODATA))}{$MICRODATA}{/if}

regards 

Link to comment
Share on other sites

Hi

If by "Standard" skin you mean Foundation then yes, you will need to make these changes - the problem is that this skin and a few others have added a few bits and pieces of code to help with Microdata but most have been done in an inconsistent way and some have got it completely wrong.  We therefore suggest removing any relevant code completely so that our plugin can add it dynamically and correctly.

There are several websites that test what microdata has been added but probably the best is Google's own one - https://search.google.com/structured-data/testing-tool where you can enter the url of a product page from your website - forexample take a look at the results from a product page (https://www.cubecart-demo.co.uk/cubecart-plugins/test-product-6.html) on our own test website - https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.cubecart-demo.co.uk%2Fcubecart-plugins%2Ftest-product-6.html

Ian

Link to comment
Share on other sites

  • 1 month later...

i see that the content.product.php and element.product_reviews.php 2 files i edited for the microdata plugin have been replaced after the new 6.1.1 update, is it ok to just simply ftp the older edited files back in? or have these files changed in anyway and require re-editing?

thanks

Link to comment
Share on other sites

i see from comparing the 2 files, 6.1.1 and the older 6.0.12 there has been changes in the foundation skin to the content content.product.php file, i have edited the new 6.1.1 file as per previous instructions but i am now getting errors from the structured data testing tool with customer reviews, "The review has no reviewed item specified". pretty sure i did not receive this message when it was on 6.0.12 unless i am mistaken?

i am getting no structured data only the review errors from the testing tool hmm

the host downgraded php from 7.0.3 i think it was to 5.6.28 because of this error:-

[24-Nov-2016 13:48:08 Europe/London] PHP Fatal error: The file /home/tvboxcom/public_html/modules/plugins/google_microdata/hooks/class.cubecart.display_product.php was encoded by the ionCube Encoder for PHP 5.0 and cannot run under PHP 7.0.
Please ask the provider of the script to provide a version encoded with the ionCube Encoder for PHP 5.6. in Unknown on line 0so it would run this addon

now i am getting this error  

[24-Nov-2016 22:25:25 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php56/root/usr/lib64/php/modules/gmp.so' - /opt/cpanel/ea-php56/root/usr/lib64/php/modules/gmp.so: cannot open shared object file: No such file or directory in Unknown on line 0

could this be anything to do with it?

thanks

 

 

Link to comment
Share on other sites

That error is coming from when PHP wants to start up. The PHP.INI file has a line that has been uncommented:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

extension=gmp.so

I think PHP code can request PHP load an extension on the fly, and maybe this plugin does that. But probably not.

I think the PHP 5.6 installation just forgot to put gmp.so in the folder specified in the error message.

A ticket to the hosting provider may be required.

Link to comment
Share on other sites

Thanks brian

i opened a ticket about the error log before i went to bed last night and its been sorted by this morning. (great service)

the Google Schema_Microdata plugin will not work with php 7.0.3 or there is a problem with the ioncube on 7.0.3 either way one of them was causing the problem with the items not loading the pages yesterday.{ hopefully Ian will fix this to run on php 7.x.x } if its the plugin at fault. or we get a fix for ioncube if that was the problem. i am sure Ian will let us know which one was causing the problem soon.

happy to report I've just edited the 2 files again (content.product.php and element.product_reviews.php) this morning and the structured data testing tool is now reading the structured data  ( it was late last night and i had been working 12 hours that's my excuse and i an sticking to it lol)   

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...