Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2011
    Posts
    92
    Plugin Contributions
    0

    Default Pinterest Rich Pins

    Has anyone managed to get Pinterest's Rich Pin functionality working on Zen Cart and is willing to share the code?

    Thanks

    Lee

  2. #2
    Join Date
    Apr 2015
    Location
    United States
    Posts
    15
    Plugin Contributions
    0

    Default Re: Pinterest Rich Pins

    I have..

    My approach was pretty simple..

    In the file \includes\templates\My_Template\templates\tpl_product_info_display.php

    At the very end between
    <!--bof Form close-->

    and

    </div>

    I entered..
    Code:
    <?php
    //Schema.org tags
    ?>
      <meta property="og:site_name" content="My Website Title Here" />
        <div itemscope itemtype="http://schema.org/Product">
        <meta itemprop="name" content="<?php echo $products_name; ?>" />
        <meta itemprop="image" content="<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" />
        <meta itemprop="url" content="<?php echo $canonicalLink; ?>" />
      
      <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <meta itemprop="price" content="<?php echo zen_get_products_special_price($_GET['products_id'], false) ; ?>" />
        <meta itemprop="priceCurrency" content="USD" />
      </div>
      </div>
    <?php
    //Schema.org tags
    ?>
    I then validated my product pages at..
    https://developers.pinterest.com/rich_pins/validator/

  3. #3
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Pinterest Rich Pins

    That code works great when the product is on special. This will work for special and regular priced items.

    Code:
    <?php
    //Schema.org tags
    ?>
    <meta property="og:site_name" content="The Untreed Reads Store" />
    <div itemscope itemtype="http://schema.org/Product">
      <meta itemprop="name" content="<?php echo $products_name; ?>" />
      <meta itemprop="image" content="<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" />
      <meta itemprop="url" content="<?php echo $canonicalLink; ?>" />
      <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <?php if (zen_get_products_special_price($_GET['products_id'] == null )) {?>
        <meta itemprop="price" content="<?php echo zen_get_products_base_price($_GET['products_id'], false) ; ?>" />
        <?php
    		  }else{
    	  ?>
        <meta itemprop="price" content="<?php echo zen_get_products_special_price($_GET['products_id'], false) ; ?>" />
        <?php } ?>
        <meta itemprop="availability" content="in stock" />
        <meta itemprop="priceCurrency" content="USD" />
      </div>
    </div>
    <?php
    //Schema.org tags
    ?>

  4. #4
    Join Date
    Dec 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Pinterest Rich Pins

    Hi both,

    Thank you so much for your posts, they have been really helpful.

    I have used your example Jeking however I am having some problems..

    I have used your code exactly as is except for changing the site name and swapping from USD to GBP

    Firstly, it does not show the price details at all for my products if the product is not on special.

    Secondly, I have pinned an item that is not in stock however on Pinterest it is still showing as in stock. Is there a way to add the code so that it checks the availability as I think in stock is just hard coded in the example you gave..

    Thanks in advance for any additional help you may be able to give, I really appreciate it :)

  5. #5
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Pinterest Rich Pins

    Correction to the code in post #3. Use this instead:

    Code:
    <?php
    //Schema.org tags
    ?>
    <meta property="og:site_name" content="The Untreed Reads Store" />
    <div itemscope itemtype="http://schema.org/Product">
      <meta itemprop="name" content="<?php echo $products_name; ?>" />
      <meta itemprop="image" content="<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" />
      <meta itemprop="url" content="<?php echo $canonicalLink; ?>" />
      <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <?php if (zen_get_products_special_price($_GET['products_id'] === null )) {?>
        <meta itemprop="price" content="<?php echo zen_get_products_base_price($_GET['products_id']) ; ?>" />
        <?php
    	}else{
         ?>
        <meta itemprop="price" content="<?php echo zen_get_products_special_price($_GET['products_id']) ; ?>" />
        <?php } ?>
        <meta itemprop="availability" content="in stock" />
        <meta itemprop="priceCurrency" content="USD" />
      </div>
    </div>
    <?php
    //Schema.org tags
    ?>
    Availability is optional. If your items are not all 'in stock', simply remove that line from the code above.

  6. #6
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Pinterest Rich Pins

    Third times a charm, right? This code works for both regular and specials and passes the Rich Pin validation.
    Code:
    <?php
    //Schema.org tags
    ?>
    <meta property="og:site_name" content="Your Store Name" />
    <div itemscope itemtype="http://schema.org/Product">
      <meta itemprop="name" content="<?php echo $products_name; ?>" />
      <meta itemprop="image" content="<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" />
      <meta itemprop="url" content="<?php echo $canonicalLink; ?>" />
      <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <?php 
    		$special_price = $db->Execute("SELECT * from " . TABLE_SPECIALS . " WHERE products_id = '" . (int)$_GET['products_id'] . "' AND status='1'");
    		if ($special_price->RecordCount() > 0) { ?>
        <meta itemprop="price" content="<?php echo zen_get_products_special_price($_GET['products_id']) ; ?>" />
        <?php
    		}else{
    	 ?>
        <meta itemprop="price" content="<?php echo zen_get_products_base_price($_GET['products_id']) ; ?>" />
        <?php } ?>
        <meta itemprop="availability" content="in stock" />
        <meta itemprop="priceCurrency" content="USD" />
      </div>
    </div>
    <?php
    //Schema.org tags
    ?>

  7. #7
    Join Date
    Dec 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Pinterest Rich Pins

    Quote Originally Posted by jeking View Post
    Third times a charm, right? This code works for both regular and specials and passes the Rich Pin validation.
    Code:
    <?php
    //Schema.org tags
    ?>
    <meta property="og:site_name" content="Your Store Name" />
    <div itemscope itemtype="http://schema.org/Product">
      <meta itemprop="name" content="<?php echo $products_name; ?>" />
      <meta itemprop="image" content="<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" />
      <meta itemprop="url" content="<?php echo $canonicalLink; ?>" />
      <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <?php 
    		$special_price = $db->Execute("SELECT * from " . TABLE_SPECIALS . " WHERE products_id = '" . (int)$_GET['products_id'] . "' AND status='1'");
    		if ($special_price->RecordCount() > 0) { ?>
        <meta itemprop="price" content="<?php echo zen_get_products_special_price($_GET['products_id']) ; ?>" />
        <?php
    		}else{
    	 ?>
        <meta itemprop="price" content="<?php echo zen_get_products_base_price($_GET['products_id']) ; ?>" />
        <?php } ?>
        <meta itemprop="availability" content="in stock" />
        <meta itemprop="priceCurrency" content="USD" />
      </div>
    </div>
    <?php
    //Schema.org tags
    ?>
    Hi Jeking,

    Thanks so much for your time spent on this, it's really appreciated. I almost hate to tell you this, but for some reason this code still doesn't seem to work correctly for products that are not on special. None of the details come across into Pinterest. If the product is on special it works fine..

  8. #8
    Join Date
    Dec 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Pinterest Rich Pins

    Quote Originally Posted by OLCS View Post
    Hi Jeking,

    Thanks so much for your time spent on this, it's really appreciated. I almost hate to tell you this, but for some reason this code still doesn't seem to work correctly for products that are not on special. None of the details come across into Pinterest. If the product is on special it works fine..

    Ignore my previous post. Its just started working!

    Thanks so much for this Jeking! It works like a charm

    Availability is optional. If your items are not all 'in stock', simply remove that line from the code above.
    All I was getting at was that it would be great if this could be done by some kind of look up from the database that populated the availability rather than have it hardcoded as obviously this code applies to all products across the site, some that will be in stock and some not. I just wondered whether something could check whether the stock level was less that 0 for example and then adjust the availability tag accordingly. Just a thought. Great job though. Thanks!

  9. #9
    Join Date
    Apr 2015
    Location
    United States
    Posts
    15
    Plugin Contributions
    0

    Default Re: Pinterest Rich Pins

    Yes, thanks for catching my oversight on special vs base pricing, and for continuing to provide updates.

 

 

Similar Threads

  1. v139h Pinterest - Product Rich Pins
    By badarac in forum All Other Contributions/Addons
    Replies: 7
    Last Post: 14 Mar 2014, 03:55 AM
  2. v151 Rich Pins
    By never2cute in forum General Questions
    Replies: 3
    Last Post: 23 Sep 2013, 05:52 AM
  3. Pinterest urlencode
    By niccol in forum General Questions
    Replies: 26
    Last Post: 16 Feb 2013, 05:12 PM
  4. Delivering PINs through email
    By apaminerala in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 27 Sep 2007, 07:13 PM

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