Version Notes
Tested on 1.9
Download this release
Release Info
| Developer | Cadence Labs |
| Extension | cadence_pinterest |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Cadence/Pinterest/Helper/Data.php +26 -0
- app/code/community/Cadence/Pinterest/etc/adminhtml.xml +23 -0
- app/code/community/Cadence/Pinterest/etc/config.xml +34 -0
- app/code/community/Cadence/Pinterest/etc/system.xml +76 -0
- app/design/frontend/base/default/layout/cadence_pinterest.xml +18 -0
- app/design/frontend/base/default/template/cadence/pinterest/conversion.phtml +27 -0
- app/design/frontend/base/default/template/cadence/pinterest/visitor.phtml +10 -0
- app/etc/modules/Cadence_Pinterest.xml +9 -0
- package.xml +29 -0
app/code/community/Cadence/Pinterest/Helper/Data.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @author Alan Barber <alan@cadence-labs.com>
|
| 4 |
+
*/
|
| 5 |
+
class Cadence_Pinterest_Helper_Data extends Mage_Core_Helper_Abstract
|
| 6 |
+
{
|
| 7 |
+
public function isVisitorPixelEnabled()
|
| 8 |
+
{
|
| 9 |
+
return Mage::getStoreConfig("cadence_pinterest/visitor/enabled");
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function isConversionPixelEnabled()
|
| 13 |
+
{
|
| 14 |
+
return Mage::getStoreConfig("cadence_pinterest/conversion/enabled");
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public function getVisitorPixelId()
|
| 18 |
+
{
|
| 19 |
+
return Mage::getStoreConfig("cadence_pinterest/visitor/pixel_id");
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function getConversionPixelId()
|
| 23 |
+
{
|
| 24 |
+
return Mage::getStoreConfig("cadence_pinterest/conversion/pixel_id");
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/Cadence/Pinterest/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<cadence_pinterest>
|
| 12 |
+
<title>Cadence Labs Pinterest Tracking Pixels</title>
|
| 13 |
+
<sort_order>990</sort_order>
|
| 14 |
+
</cadence_pinterest>
|
| 15 |
+
</children>
|
| 16 |
+
</config>
|
| 17 |
+
</children>
|
| 18 |
+
</system>
|
| 19 |
+
</children>
|
| 20 |
+
</admin>
|
| 21 |
+
</resources>
|
| 22 |
+
</acl>
|
| 23 |
+
</config>
|
app/code/community/Cadence/Pinterest/etc/config.xml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Cadence_Pinterest>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Cadence_Pinterest>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<helpers>
|
| 10 |
+
<cadence_pinterest>
|
| 11 |
+
<class>Cadence_Pinterest_Helper</class>
|
| 12 |
+
</cadence_pinterest>
|
| 13 |
+
</helpers>
|
| 14 |
+
</global>
|
| 15 |
+
<frontend>
|
| 16 |
+
<layout>
|
| 17 |
+
<updates>
|
| 18 |
+
<cadence_pinterest>
|
| 19 |
+
<file>cadence_pinterest.xml</file>
|
| 20 |
+
</cadence_pinterest>
|
| 21 |
+
</updates>
|
| 22 |
+
</layout>
|
| 23 |
+
</frontend>
|
| 24 |
+
<default>
|
| 25 |
+
<cadence_pinterest>
|
| 26 |
+
<visitor>
|
| 27 |
+
<enabled>0</enabled>
|
| 28 |
+
</visitor>
|
| 29 |
+
<conversion>
|
| 30 |
+
<enabled>0</enabled>
|
| 31 |
+
</conversion>
|
| 32 |
+
</cadence_pinterest>
|
| 33 |
+
</default>
|
| 34 |
+
</config>
|
app/code/community/Cadence/Pinterest/etc/system.xml
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<cadence>
|
| 5 |
+
<label>Cadence Labs</label>
|
| 6 |
+
<sort_order>200</sort_order>
|
| 7 |
+
</cadence>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<cadence_pinterest translate="label">
|
| 11 |
+
<label>Pinterest Pixel</label>
|
| 12 |
+
<tab>cadence</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>100</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
<groups>
|
| 19 |
+
<visitor translate="label">
|
| 20 |
+
<label>Visitor Pixel</label>
|
| 21 |
+
<show_in_default>1</show_in_default>
|
| 22 |
+
<show_in_website>1</show_in_website>
|
| 23 |
+
<show_in_store>1</show_in_store>
|
| 24 |
+
<sort_order>1</sort_order>
|
| 25 |
+
<fields>
|
| 26 |
+
<enabled translate="label" module="cadence_pinterest">
|
| 27 |
+
<label>Enable</label>
|
| 28 |
+
<frontend_type>select</frontend_type>
|
| 29 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
| 30 |
+
<sort_order>10</sort_order>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
<show_in_store>1</show_in_store>
|
| 34 |
+
</enabled>
|
| 35 |
+
<pixel_id translate="label">
|
| 36 |
+
<label>Pixel Tid</label>
|
| 37 |
+
<frontend_type>text</frontend_type>
|
| 38 |
+
<sort_order>20</sort_order>
|
| 39 |
+
<show_in_default>1</show_in_default>
|
| 40 |
+
<show_in_website>1</show_in_website>
|
| 41 |
+
<show_in_store>1</show_in_store>
|
| 42 |
+
<comment>This is the pixel tid (see the install guide for instructions on where to find this). Make sure to select conversion type "Visit" for this pixel!</comment>
|
| 43 |
+
</pixel_id>
|
| 44 |
+
</fields>
|
| 45 |
+
</visitor>
|
| 46 |
+
<conversion translate="label">
|
| 47 |
+
<label>Checkout Pixel (Optional)</label>
|
| 48 |
+
<show_in_default>1</show_in_default>
|
| 49 |
+
<show_in_website>1</show_in_website>
|
| 50 |
+
<show_in_store>1</show_in_store>
|
| 51 |
+
<sort_order>2</sort_order>
|
| 52 |
+
<fields>
|
| 53 |
+
<enabled translate="label" module="cadence_pinterest">
|
| 54 |
+
<label>Enable</label>
|
| 55 |
+
<frontend_type>select</frontend_type>
|
| 56 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
| 57 |
+
<sort_order>10</sort_order>
|
| 58 |
+
<show_in_default>1</show_in_default>
|
| 59 |
+
<show_in_website>1</show_in_website>
|
| 60 |
+
<show_in_store>1</show_in_store>
|
| 61 |
+
</enabled>
|
| 62 |
+
<pixel_id translate="label">
|
| 63 |
+
<label>Pixel Tid</label>
|
| 64 |
+
<frontend_type>text</frontend_type>
|
| 65 |
+
<sort_order>20</sort_order>
|
| 66 |
+
<show_in_default>1</show_in_default>
|
| 67 |
+
<show_in_website>1</show_in_website>
|
| 68 |
+
<show_in_store>1</show_in_store>
|
| 69 |
+
<comment>This is the pixel tid (see the install guide for instructions on where to find this). Make sure to select conversion type "Checkout" for this pixel!</comment>
|
| 70 |
+
</pixel_id>
|
| 71 |
+
</fields>
|
| 72 |
+
</conversion>
|
| 73 |
+
</groups>
|
| 74 |
+
</cadence_pinterest>
|
| 75 |
+
</sections>
|
| 76 |
+
</config>
|
app/design/frontend/base/default/layout/cadence_pinterest.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<block type="core/template" template="cadence/pinterest/visitor.phtml" />
|
| 6 |
+
</reference>
|
| 7 |
+
</default>
|
| 8 |
+
<checkout_onepage_success translate="label">
|
| 9 |
+
<reference name="after_body_start">
|
| 10 |
+
<block type="core/template" template="cadence/pinterest/conversion.phtml" />
|
| 11 |
+
</reference>
|
| 12 |
+
</checkout_onepage_success>
|
| 13 |
+
<checkout_multishipping_success translate="label">
|
| 14 |
+
<reference name="after_body_start">
|
| 15 |
+
<block type="core/template" template="cadence/pinterest/conversion.phtml" />
|
| 16 |
+
</reference>
|
| 17 |
+
</checkout_multishipping_success>
|
| 18 |
+
</layout>
|
app/design/frontend/base/default/template/cadence/pinterest/conversion.phtml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/** @var Cadence_Pinterest_Helper_Data $helper */
|
| 3 |
+
$helper = Mage::helper("cadence_pinterest");
|
| 4 |
+
if (!$helper->isConversionPixelEnabled()) {
|
| 5 |
+
return;
|
| 6 |
+
}
|
| 7 |
+
$id = $helper->getConversionPixelId();
|
| 8 |
+
?>
|
| 9 |
+
<?php
|
| 10 |
+
$order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
|
| 11 |
+
if (!$order_id || intval($order_id) < 1) {
|
| 12 |
+
//Failsafe for bad order id
|
| 13 |
+
return;
|
| 14 |
+
}
|
| 15 |
+
/** @var Mage_Sales_Model_Order $order */
|
| 16 |
+
$order = Mage::getModel('sales/order')->load($order_id);
|
| 17 |
+
$grand_total = round($order->getGrandTotal(), 2);
|
| 18 |
+
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
|
| 19 |
+
$total_qty = 0;
|
| 20 |
+
/** @var Mage_Sales_Model_Order_Item $item */
|
| 21 |
+
foreach($order->getAllVisibleItems() as $item) {
|
| 22 |
+
$total_qty += $item->getQtyOrdered();
|
| 23 |
+
}
|
| 24 |
+
?>
|
| 25 |
+
<!-- Pinterest Conversion Pixel Code -->
|
| 26 |
+
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/?tid=<?php echo $id ?>&value=<?php echo $grand_total ?>&quantity=<?php echo $total_qty ?>"/>
|
| 27 |
+
<!-- End Pinterest Conversion Pixel Code -->
|
app/design/frontend/base/default/template/cadence/pinterest/visitor.phtml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$helper = Mage::helper("cadence_pinterest");
|
| 3 |
+
if (!$helper->isVisitorPixelEnabled()) {
|
| 4 |
+
return;
|
| 5 |
+
}
|
| 6 |
+
$id = $helper->getVisitorPixelId();
|
| 7 |
+
?>
|
| 8 |
+
<!-- Pinterest Visitor Pixel Code -->
|
| 9 |
+
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/?tid=<?php echo $id ?>&value=0.00&quantity=1"/>
|
| 10 |
+
<!-- End Pinterest Visitor Pixel Code -->
|
app/etc/modules/Cadence_Pinterest.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Cadence_Pinterest>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Cadence_Pinterest>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>cadence_pinterest</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>GNU GPL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This extension allows you to quickly implement Pinterest conversion tracking and code on your Magento store. Supports Visit and Checkout conversion events. </summary>
|
| 10 |
+
<description><p>This Pinterest Conversion Tracking Code extension allows you to quickly implement visitor and checkout events through the Pinterest Conversion Pixel. <a href="https://www.cadence-labs.com/2016/05/free-pinterest-tracking-pixel-extension-magento/" title="User Manual"><strong>Learn how it works.</strong></a>. </p>
|
| 11 |
+
<p>After setting your Pinterested TID (Pixel Id), you may:</p>
|
| 12 |
+
<ul>
|
| 13 |
+
<li>Track Visit (code is displayed on every page)</li>
|
| 14 |
+
<li>Track Checkouts (code is displayed only upon successful checkout)</li>
|
| 15 |
+
</ul> 
|
| 16 |
+
<p> The extension works by attaching the relevant pixel code (for either Visits or Conversions) to your store's webpage, just after the start of the <strong>body</strong> tag. If you have the correct pixel id installed, Pinterest will do the rest.</p><p>Click here to view our <a href="https://www.cadence-labs.com/2016/05/free-pinterest-tracking-pixel-extension-magento/">Pinterest Tracking Pixel Install Guide</a>.</p>
|
| 17 |
+
<h2>Multistore; Tracks Grand Total and Quantity</h2>
|
| 18 |
+
<p>This extension supports installations with multiple websites and/or stores. The Checkout Pixel will track the grand total and the quantity ordered.</p> 
|
| 19 |
+

|
| 20 |
+
<h2>About The Developer</h2>
|
| 21 |
+
<p><a href="http://www.cadence-labs.com/" title="Cadence Labs">Cadence Labs</a> is a digital design, software development, and Magento agency based in Boulder, Colorado. Our developers are Magento certified eCommerce geeks!</p></description>
|
| 22 |
+
<notes>Tested on 1.9</notes>
|
| 23 |
+
<authors><author><name>Cadence Labs</name><user>cadencelabs</user><email>alan@cadence-labs.com</email></author></authors>
|
| 24 |
+
<date>2016-05-30</date>
|
| 25 |
+
<time>17:40:55</time>
|
| 26 |
+
<contents><target name="magecommunity"><dir name="Cadence"><dir name="Pinterest"><dir name="Helper"><file name="Data.php" hash="65b74f77e24f47fbe1709e9ad0a603c6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8a6e311f8ef36556d905501eeff33480"/><file name="config.xml" hash="935e3867b2b14b58609d74c2f1e07826"/><file name="system.xml" hash="92534c60cb3cbf555814a566ee8181d1"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cadence_Pinterest.xml" hash="9d220294781c37382bc941547b346618"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cadence_pinterest.xml" hash="24a81722f309d7b3f84e11548333bff8"/></dir><dir name="template"><dir name="cadence"><dir name="pinterest"><file name="conversion.phtml" hash="302fc4de4eeeee0c1dd7c624a26b1014"/><file name="visitor.phtml" hash="1350e7b52365e3ef446f8dab063e1045"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 27 |
+
<compatible/>
|
| 28 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.9</max></php></required></dependencies>
|
| 29 |
+
</package>
|
