Thread: Google Stars

Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2010
    Location
    United Kingdom
    Posts
    477
    Plugin Contributions
    0

    Default Google Stars

    Hi
    I have searched ,but can't really find a way to get stars on my google searches like other types of shops have.
    Is there a free way to achieve this or at least a low cost option.There are the usual ones like Trust Pilot etc but they are just to darn expensive..

    Name:  Capture.JPG
Views: 261
Size:  37.0 KB

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Google Stars

    I wrote some script a few month's ago. give me a few minutes to look it up.

  3. #3
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Google Stars

    Ok, found it.

    Create a new file in "includes/templates/YOUR_TEMPLATE/jscript" , and name it "structured_data_product.php"

    In the new file paste the code from below
    PHP Code:
    <?php

    // defines
    define('STRUCTURED_DATA_CONDITION''NewCondition'); // DamagedCondition, NewCondition, RefurbishedCondition, UsedCondition
    define('STRUCTURED_DATA_STOCK''InStock'); // Discontinued, InStock, InStoreOnly, LimitedAvailability, OnlineOnly, OutOfStock, PreOrder, PreSale, SoldOut

    $ratingQuery "SELECT reviews_id, reviews_rating
                    FROM " 
    TABLE_REVIEWS "
                    WHERE products_id = " 
    $product_info->fields['products_id'];
    $rating $db->Execute($ratingQuery);
    while (!
    $rating->EOF) {
      
    $ratingArray[] = array('reviews_id' => $rating->fields['reviews_id'],
                             
    'reviews_rating' => $rating->fields['reviews_rating']);
      
    $rating->MoveNext();
    }
    $ratingSum = array();

    if (
    $ratingArray != '') {
      foreach (
    $ratingArray as $value) {
        
    $ratingSum[] = $value['reviews_rating'];
      }
    } else {
      
    $ratingSum 0;
    }

    $reviewCount sizeof($ratingArray);
    if (
    $reviewCount != 0) {
      
    $ratingValue array_sum($ratingSum) / $reviewCount;
    } else {
      
    $ratingValue 0;
    }
    ?>
    <script type="application/ld+json">
    {
      "@context": "http://schema.org/",
      "@type": "Product",
      "name": "<?php echo $products_name?>",
      "image": "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER DIR_WS_HTTPS_CATALOG HTTP_SERVER DIR_WS_CATALOG ) . '/' DIR_WS_IMAGES $product_info->fields['products_image']; ?>",
      "description": "<?php echo htmlspecialchars(zen_clean_html(stripslashes(zen_get_products_description($product_info->fields['products_id'], $_SESSION['languages_id']))), ENT_QUOTES); ?>",
      "mpn": "<?php echo $products_model?>",
      "brand": {
        "@type": "Thing",
        "name": "<?php echo $manufacturers_name?>"
      },
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "<?php echo $ratingValue?>",
        "reviewCount": "<?php echo $reviewCount?>"
      },
      "offers": {
        "@type": "Offer",
        "priceCurrency": "<?php echo $_SESSION['currency']; ?>",
        "price": "<?php echo $products_price = (round(zen_get_products_base_price($product_info->fields['products_id']),2)); ?>",
        "priceValidUntil": "2020-11-05",
        "itemCondition": "http://schema.org/<?php echo STRUCTURED_DATA_CONDITION?>",
        "availability": "http://schema.org/<?php echo STRUCTURED_DATA_STOCK?>",
        "seller": {
          "@type": "Organization",
          "name": "<?php echo STORE_NAME ?>"
        }
      }
    }
    </script>
    in the file "includes\templates\YOUR_TEMPLATE\templates\tpl_product_info_display.php", add at the bottom of the file:
    PHP Code:
    <?php /* BOF Zen4All structured_data_product */ ?>
    <?php 
    include ($template->get_template_dir('structured_data_product.php'DIR_WS_TEMPLATE$current_page_base'jscript') . '/' 'structured_data_product.php'); ?>
    <?php 
    /* EOF Zen4All structured_data_product */ ?>
    Note: This was some experimental code, and it works on my site and my client's. The code may also need some optimization, like the defines at the top of the file.
    Last edited by Design75; 23 Sep 2016 at 07:26 PM.

  4. #4
    Join Date
    Oct 2010
    Location
    United Kingdom
    Posts
    477
    Plugin Contributions
    0

    Default Re: Google Stars

    Thanks ,have added info...I take it this will take some time to appear in searches if it is working on my site ..
    thanks again for the quick reply.
    Oh, while I see schema in the code do I need any add on's to get it to work
    Last edited by Andy-C27; 23 Sep 2016 at 07:47 PM.

  5. #5
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Google Stars

    The code works without any extra code, but you can add a lot more structured data if you like.

  6. #6
    Join Date
    Oct 2010
    Location
    United Kingdom
    Posts
    477
    Plugin Contributions
    0

    Default Re: Google Stars

    Doesn't seem to be working for me ..
    Although have found lipscore if anyone has heard of it and it's mostly free

  7. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Google Stars

    You will need to have some patience, as Google will index the stars in their own time.

  8. #8
    Join Date
    Oct 2010
    Location
    United Kingdom
    Posts
    477
    Plugin Contributions
    0

    Default Re: Google Stars

    gees you were quick with that reply ...Was coming back to delete post lol.
    As lipscore you have to pay for stars to appear.
    But OK will be patient :) as thought as much

 

 

Similar Threads

  1. How do I add stars?
    By profearn in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 19 Sep 2011, 12:43 AM
  2. Remove Review Stars
    By stevanicus in forum General Questions
    Replies: 4
    Last Post: 24 Apr 2009, 07:00 PM
  3. Custom Stars Rating
    By DieuxSoldat_04 in forum Basic Configuration
    Replies: 4
    Last Post: 25 Sep 2008, 07:18 AM
  4. Product Review Stars???
    By Stuff4Toys in forum General Questions
    Replies: 0
    Last Post: 8 Aug 2007, 04:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR