You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I've seen that Pinterest is now doing which is a way of including more information into Pinterest.
To do this would require modifying this section in jslib.php
// +-- // | Print OpenGraph tags. // +-- $opengraph_title = $meta_title; $opengraph_image = $this->xhtml_encode($this->globals('core.opengraph_image')); $opengraph_sitename = $this->xhtml_encode($site_name); $opengraph_description = $meta_description; if (!(empty($opengraph_title))) {print '<meta property="og:title" content="' . $opengraph_title . '" />' . $eol;} if (!(empty($opengraph_image))) {print '<meta property="og:image" content="' . $opengraph_image . '" />' . $eol;} if (!(empty($opengraph_sitename))) {print '<meta property="og:site_name" content="' . $opengraph_sitename . '" />' . $eol;} if (!(empty($opengraph_description))) {print '<meta property="og:description" content="' . $opengraph_description . '" />' . $eol;}
Including og:type would be simple, but I don't know how to read the product price (and allow for discounts if offered), location of image, related products etc.
It would probably be too much for me, but someone who knows v8 well enough could probably figure out the code easily enough...
Offline
if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { $prod = $this->globals('ecom.prod_proddetail'); // You can pull the pricing from the $prod array at this point. } // End of if statement.
Offline
Would this work?
// +-- // | Print OpenGraph tags. // +-- //HACK FOR RICH TAGS 2015-05-05 //Pinterest Rich Tags requirements from https://developers.pinterest.com/rich_pins_product/ //<meta property="og:title" content="Name of your product" /> ----- ALREADY PRESENT IN CODE //<meta property="og:type" content="product" /> //<meta property="og:price:amount" content="1.00" /> //<meta property="og:price:currency" content="USD" /> //SOURCED from https://forum.kryptronic.com/viewtopic.php?id=31914 if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { $prod = $this->globals('ecom.prod_proddetail'); // You can pull the pricing from the $prod array at this point. $opengraph_price = $prod['core.priceinfo']; } $opengraph_type = '<meta property="og:type" content="product" />'; if (!(empty($opengraph_type))) {print '<meta property="og:type" content="' . $opengraph_type . '" />' . $eol;} if (!(empty($opengraph_price))) {print '<meta property="og:price:amount" content="' . $opengraph_price . '" />' . $eol;} $opengraph_currency = '<meta property="og:currency" content="USD" />'; if (!(empty($opengraph_currency))) {print '<meta property="og:price:currency" content="' . $opengraph_currency . '" />' . $eol;} //END HACK $opengraph_title = $meta_title; $opengraph_image = $this->xhtml_encode($this->globals('core.opengraph_image')); $opengraph_sitename = $this->xhtml_encode($site_name); $opengraph_description = $meta_description; if (!(empty($opengraph_title))) {print '<meta property="og:title" content="' . $opengraph_title . '" />' . $eol;} if (!(empty($opengraph_image))) {print '<meta property="og:image" content="' . $opengraph_image . '" />' . $eol;} if (!(empty($opengraph_sitename))) {print '<meta property="og:site_name" content="' . $opengraph_sitename . '" />' . $eol;} if (!(empty($opengraph_description))) {print '<meta property="og:description" content="' . $opengraph_description . '" />' . $eol;} } // End of if statement.
Offline
The syntax is off. Try this:
// BEGIN HACK FOR RICH TAGS 2015-05-05 // Pinterest Rich Tags requirements from https://developers.pinterest.com/rich_pins_product/ // <meta property="og:title" content="Name of your product" /> ----- ALREADY PRESENT IN CODE // <meta property="og:type" content="product" /> // <meta property="og:price:amount" content="1.00" /> // <meta property="og:price:currency" content="USD" /> // SOURCED from https://forum.kryptronic.com/viewtopic.php?id=31914 if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { print '<meta property="og:type" content="product" />' . $eol; if ($this->globals('ecom.prod_priceinfo')) { $ogprice = $this->globals('ecom.prod_priceinfo'); print '<meta property="og:price:amount" content="' . $this->xhtml_encode($ogprice['actualb']) . '" />' . $eol; print '<meta property="og:price:currency" content="USD" />' . $eol; } // End of if statement. } // End of if statement. // END HACK
Offline
I got this error on product display pages:
Parse error: syntax error, unexpected $end in /home/woodwork/public_html/core-private/core/CORE/includes/jslib.php on line 598
Offline
Ok, so I went back to what I suggested and had to fix a few things. I can get the og:price:currency and and og:type to work but the og:price:amount does not work.
//HACK FOR RICH TAGS 2015-05-05 //Pinterest Rich Tags requirements from https://developers.pinterest.com/rich_pins_product/ //<meta property="og:title" content="Name of your product" /> ----- ALREADY PRESENT IN CODE //<meta property="og:type" content="product" /> //<meta property="og:price:amount" content="1.00" /> //<meta property="og:price:currency" content="USD" /> //SOURCED from https://forum.kryptronic.com/viewtopic.php?id=31914 if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { $prod = $this->globals('ecom.prod_proddetail'); // You can pull the pricing from the $prod array at this point. $opengraph_price = $prod['core.priceinfo']; } $opengraph_type = 'product'; if (!(empty($opengraph_type))) {print '<meta property="og:type" content="' . $opengraph_type . '" />' . $eol;} if (!(empty($opengraph_price))) {print '<meta property="og:price:amount" content="' . $opengraph_price . '" />' . $eol;} $opengraph_currency = 'USD'; if (!(empty($opengraph_currency))) {print '<meta property="og:price:currency" content="' . $opengraph_currency .'" />' . $eol;} //END HACK $opengraph_title = $meta_title; $opengraph_image = $this->xhtml_encode($this->globals('core.opengraph_image')); $opengraph_sitename = $this->xhtml_encode($site_name); $opengraph_description = $meta_description; if (!(empty($opengraph_title))) {print '<meta property="og:title" content="' . $opengraph_title . '" />' . $eol;} if (!(empty($opengraph_image))) {print '<meta property="og:image" content="' . $opengraph_image . '" />' . $eol;} if (!(empty($opengraph_sitename))) {print '<meta property="og:site_name" content="' . $opengraph_sitename . '" />' . $eol;} if (!(empty($opengraph_description))) {print '<meta property="og:description" content="' . $opengraph_description . '" />' . $eol;} } // End of if statement.
produces
<meta property="og:type" content="product" />
<meta property="og:price:amount" content="Array" />
<meta property="og:price:currency" content="USD" />
<meta property="og:title" content="MY PRODUCT TITLE" />
So all that's left to get is the price. Something in here needs to change?
//SOURCED from https://forum.kryptronic.com/viewtopic.php?id=31914 if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { $prod = $this->globals('ecom.prod_proddetail'); // You can pull the pricing from the $prod array at this point. $opengraph_price = $prod['core.priceinfo']; }
Last edited by CrownRoyal (05-06-2015 07:23:19)
Offline
Get the price with this:
$ogprice = $this->globals('ecom.prod_priceinfo'); print '<meta property="og:price:amount" content="' . $this->xhtml_encode($ogprice['actualb']) . '" />' . $eol;
Offline
Thanks Nick. Seems to work. Produced in the current selling price, reg price 18.50, sale price 14.95.
<meta property="og:price:amount" content="14.9500" />
Only question I have is if the 4 decimal places might be acceptable or not? Is there a way to round it down?
Offline
A followup, I entered a product url into the Rich Pins validate page at Pinterest and it passed the test.
A person is then offered the ability to validate their domain. Waiting now to see if Pinterest approves the store.
Offline
And just like that domain is approved, pins from our products on Pinterest mostly show pricing and proper trademark branding. Nice. Not all show pricing and branding. Pinterest says: For older Pins, it may take a few weeks for them to appear as Rich Pins.
Thanks Nick!
So to review for others, this is the finished code used:
// +-- // | Print OpenGraph tags. // +-- //HACK FOR RICH TAGS 2015-05-05 //Pinterest Rich Tags requirements from https://developers.pinterest.com/rich_pins_product/ //<meta property="og:title" content="Name of your product" /> ----- ALREADY PRESENT IN CODE //<meta property="og:type" content="product" /> //<meta property="og:price:amount" content="1.00" /> //<meta property="og:price:currency" content="USD" /> //SOURCED from https://forum.kryptronic.com/viewtopic.php?id=31914 if ($this->globals('core_cgi.app') == 'ecom' && $this->globals('core_cgi.ns') == 'prodshow') { $prod = $this->globals('ecom.prod_proddetail'); // You can pull the pricing from the $prod array at this point. $ogprice = $this->globals('ecom.prod_priceinfo'); } $opengraph_type = 'product'; if(!(empty($ogprice))) {print '<meta property="og:price:amount" content="' . $this->xhtml_encode(sprintf("%.2f",round($ogprice['actualb'],2))) . '" />' . $eol;} if (!(empty($opengraph_type))) {print '<meta property="og:type" content="' . $opengraph_type . '" />' . $eol;} if (!(empty($opengraph_price))) {print '<meta property="og:price:amount" content="' . $opengraph_price . '" />' . $eol;} $opengraph_currency = 'USD'; if (!(empty($opengraph_currency))) {print '<meta property="og:price:currency" content="' . $opengraph_currency .'" />' . $eol;} //END HACK
Last edited by CrownRoyal (05-07-2015 06:42:09)
Offline
that worked Nick, I'll update the code above.
Offline