PepperJamExchange - Version 1.0.0

Version Notes

Initial Release.

Download this release

Release Info

Developer True Action PepperJam
Extension PepperJamExchange
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (25) hide show
  1. app/code/community/TrueAction/PepperJam/Block/Adminhtml/Sales/Order/View.php +19 -0
  2. app/code/community/TrueAction/PepperJam/Block/Adminhtml/System/Form/Renderer/Config/HeadingComment.php +25 -0
  3. app/code/community/TrueAction/PepperJam/Block/Adminhtml/System/Form/Renderer/Config/RegisterButton.php +60 -0
  4. app/code/community/TrueAction/PepperJam/Block/Beacon.php +79 -0
  5. app/code/community/TrueAction/PepperJam/Helper/Data.php +93 -0
  6. app/code/community/TrueAction/PepperJam/Helper/Xfabric.php +73 -0
  7. app/code/community/TrueAction/PepperJam/LICENSE.TXT +81 -0
  8. app/code/community/TrueAction/PepperJam/Model/Message/Order.php +31 -0
  9. app/code/community/TrueAction/PepperJam/Model/Message/Shipment.php +21 -0
  10. app/code/community/TrueAction/PepperJam/Model/Observer.php +74 -0
  11. app/code/community/TrueAction/PepperJam/Model/Referral.php +29 -0
  12. app/code/community/TrueAction/PepperJam/Model/Resource/Referral.php +21 -0
  13. app/code/community/TrueAction/PepperJam/Model/Resource/Referral/Collection.php +16 -0
  14. app/code/community/TrueAction/PepperJam/controllers/Adminhtml/Pepperjam/RegisterController.php +15 -0
  15. app/code/community/TrueAction/PepperJam/etc/adminhtml.xml +29 -0
  16. app/code/community/TrueAction/PepperJam/etc/config.xml +133 -0
  17. app/code/community/TrueAction/PepperJam/etc/system.xml +85 -0
  18. app/code/community/TrueAction/PepperJam/sql/pepperjam_setup/install-0.1.0.php +50 -0
  19. app/design/adminhtml/default/default/layout/pepperjam.xml +15 -0
  20. app/design/adminhtml/default/default/template/pepperjam/register/view.phtml +24 -0
  21. app/design/adminhtml/default/default/template/pepperjam/system/config/register_button.phtml +52 -0
  22. app/design/frontend/base/default/layout/pepperjam.xml +25 -0
  23. app/design/frontend/base/default/template/pepperjam/beacon.phtml +22 -0
  24. app/etc/modules/TrueAction_PepperJam.xml +19 -0
  25. package.xml +28 -0
app/code/community/TrueAction/PepperJam/Block/Adminhtml/Sales/Order/View.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
9
+ {
10
+
11
+ /**
12
+ * Check possible render buttons
13
+ */
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ }
18
+
19
+ }
app/code/community/TrueAction/PepperJam/Block/Adminhtml/System/Form/Renderer/Config/HeadingComment.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Block_Adminhtml_System_Form_Renderer_Config_HeadingComment
9
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
10
+ {
11
+ /**
12
+ * Render element html
13
+ *
14
+ * @param Varien_Data_Form_Element_Abstract $element
15
+ * @return string
16
+ */
17
+ public function render(Varien_Data_Form_Element_Abstract $element)
18
+ {
19
+ return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5">'
20
+ . '<h4 id="%s">%s</h4><div id="system-fieldset-sub-head-comment">%s</div></td></tr>',
21
+ $element->getHtmlId(), $element->getHtmlId(),
22
+ $element->getLabel(), $element->getComment()
23
+ );
24
+ }
25
+ }
app/code/community/TrueAction/PepperJam/Block/Adminhtml/System/Form/Renderer/Config/RegisterButton.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Block_Adminhtml_System_Form_Renderer_Config_RegisterButton
9
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
10
+ implements Varien_Data_Form_Element_Renderer_Interface
11
+ {
12
+
13
+ protected $_template = 'pepperjam/system/config/register_button.phtml';
14
+
15
+ /**
16
+ * Unset scope label and pass further to parent render()
17
+ *
18
+ * @param Varien_Data_Form_Element_Abstract $element
19
+ * @return string
20
+ */
21
+ public function render(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ /* only show this button if the capability has not yet been onboarded
24
+ if ($capabilityIsOnboarded) {
25
+ return '';
26
+ }
27
+ */
28
+ // Unset the scope label near the button
29
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
30
+ $html = sprintf(
31
+ '<tr class="system-fieldset-sub-head" id="row_%1$s">
32
+ <td colspan="5">
33
+ %2$s
34
+ </td>
35
+ </tr>',
36
+ $element->getHtmlId(),
37
+ $this->_getElementHtml($element)
38
+ );
39
+ return $html;
40
+ }
41
+
42
+ /**
43
+ * Get the button and scripts contents
44
+ *
45
+ * @param Varien_Data_Form_Element_Abstract $element
46
+ * @return string
47
+ */
48
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
49
+ {
50
+ $originalData = $element->getOriginalData();
51
+ $this->addData(array(
52
+ 'button_label' => Mage::helper('pepperjam')->__($originalData['button_label']),
53
+ 'html_id' => $element->getHtmlId(),
54
+ 'button_url' => trim($originalData['button_url']),
55
+ 'element_label' => $element->getLabel(),
56
+ 'element_comment' => $element->getComment(),
57
+ ));
58
+ return $this->_toHtml();
59
+ }
60
+ }
app/code/community/TrueAction/PepperJam/Block/Beacon.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Block_Beacon extends Mage_Core_Block_Template
9
+ {
10
+ /**
11
+ * Mage_Sales_Model_Order
12
+ */
13
+ protected $_order; // The order
14
+
15
+ /**
16
+ * Get the last order.
17
+ *
18
+ * @return Mage_Sales_Model_Order
19
+ */
20
+ protected function _getOrder()
21
+ {
22
+ if (!($this->_order instanceof Mage_Sales_Model_Order)) {
23
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
24
+ if ($orderId) {
25
+ $this->_order = Mage::getModel('sales/order')->load($orderId);
26
+ }
27
+ }
28
+ return $this->_order;
29
+ }
30
+
31
+ /**
32
+ * Get the beacon url.
33
+ *
34
+ * @return String
35
+ */
36
+ public function getBeaconUrl()
37
+ {
38
+ $order = $this->_getOrder();
39
+ $url = '';
40
+ if ($order instanceof Mage_Sales_Model_Order) {
41
+ $helper = Mage::helper('pepperjam');
42
+ $params = array(
43
+ 'PID' => $helper->getMerchantId(),
44
+ 'OID' => $order->getIncrementId(),
45
+ 'INT' => 'ITEMIZED',
46
+ 'CURRENCY' => $order->getOrderCurrencyCode(),
47
+ );
48
+
49
+ $i = 0;
50
+ foreach ($order->getAllVisibleItems() as $item) {
51
+ $i++;
52
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
53
+ $productId = $product->getIdBySku($item->getSku());
54
+ $params['ITEM' . $i] = $productId;
55
+ $params['QTY' . $i] = (int) $item->getQtyOrdered();
56
+ $params['TOTALAMOUNT' . $i] = sprintf('%01.2f', $item->getRowTotal());
57
+ }
58
+
59
+ $path = $helper->useHybridPixel() ? "demand" : "track";
60
+ $url = "https://t.pepperjamnetwork.com/$path?" . http_build_query($params);
61
+ }
62
+ return $url;
63
+ }
64
+
65
+ /**
66
+ * Whether or not to display the beacon.
67
+ *
68
+ * @return bool
69
+ */
70
+ public function showBeacon()
71
+ {
72
+ $helper = Mage::helper('pepperjam');
73
+ if (!$helper->isEnabled()) return false;
74
+ $order = $this->_getOrder();
75
+ if (!($order instanceof Mage_Sales_Model_Order)) return false;
76
+ if ($helper->useHybridPixel() && !$helper->isCookieSet()) return false;
77
+ return true;
78
+ }
79
+ }
app/code/community/TrueAction/PepperJam/Helper/Data.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ const PEPPERJAM_CONFIG_ENABLED = 'affiliate_programs/pepperjam/enabled';
11
+ const PEPPERJAM_CONFIG_MERCHANT_ID = 'affiliate_programs/pepperjam/merchant_id';
12
+ const PEPPERJAM_CONFIG_USE_HYBRID_PIXEL = 'affiliate_programs/pepperjam/use_hybrid_pixel';
13
+ const PEPPERJAM_COOKIE_LIFETIME = 'affiliate_programs/pepperjam/cookie_lifetime';
14
+ const PEPPERJAM_COOKIE_NAME = 'pepperjam';
15
+
16
+ /**
17
+ * Get config flag indicating if PepperJam integration is enabled
18
+ *
19
+ * @return bool
20
+ */
21
+ public function isEnabled()
22
+ {
23
+ return Mage::getStoreConfigFlag(self::PEPPERJAM_CONFIG_ENABLED);
24
+ }
25
+
26
+ /**
27
+ * Get config value for PepperJam merchant Id
28
+ *
29
+ * @return string
30
+ */
31
+ public function getMerchantId()
32
+ {
33
+ return Mage::getStoreConfig(self::PEPPERJAM_CONFIG_MERCHANT_ID);
34
+ }
35
+
36
+ /**
37
+ * Get cookie expiration date, add number of days specified in admin config to current time
38
+ *
39
+ * return int
40
+ */
41
+ public function getCookieExpirationDate()
42
+ {
43
+ return Mage::getStoreConfig(self::PEPPERJAM_COOKIE_LIFETIME) * 24 * 60 * 60;
44
+ }
45
+
46
+ /**
47
+ * Write out the cookie used for PepperJam
48
+ *
49
+ * @param array $requestParams
50
+ */
51
+ public function writeCookie($requestParams)
52
+ {
53
+ $name = self::PEPPERJAM_COOKIE_NAME;
54
+ $requestParams['dateEntered'] = time();
55
+ $value = http_build_query($requestParams, '', '&');
56
+ $period = $this->getCookieExpirationDate();
57
+ Mage::getModel('core/cookie')->set($name, $value, $period);
58
+ }
59
+
60
+ /**
61
+ * Retrieve the value from the PJ cookie
62
+ *
63
+ * @return string|null
64
+ */
65
+ public function getCookieValue()
66
+ {
67
+ return Mage::getModel('core/cookie')->get(self::PEPPERJAM_COOKIE_NAME);
68
+ }
69
+
70
+ /**
71
+ * Is the PJ cookie set?
72
+ *
73
+ * @return bool
74
+ */
75
+ public function isCookieSet()
76
+ {
77
+ if ($this->getCookieValue()) {
78
+ return true;
79
+ }
80
+ return false;
81
+ }
82
+
83
+ /**
84
+ * Gets config flag indicating if the Demand Beacon should be used
85
+ *
86
+ * @return bool
87
+ */
88
+ public function useHybridPixel()
89
+ {
90
+ return Mage::getStoreConfigFlag(self::PEPPERJAM_CONFIG_USE_HYBRID_PIXEL);
91
+ }
92
+
93
+ }
app/code/community/TrueAction/PepperJam/Helper/Xfabric.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ <?php
9
+
10
+ class TrueAction_PepperJam_Helper_XFabric extends Mage_Core_Helper_Data
11
+ {
12
+
13
+ const XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_TARGET_CAPABILITY_NAME
14
+ = 'affiliate_programs/pepperjam/registration/target_capability_name';
15
+ const XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_STORE_ENDPOINT_URL
16
+ = 'affiliate_programs/pepperjam/registration/store_endpoint_url';
17
+ const XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_IS_REGISTERED
18
+ = 'affiliate_programs/pepperjam/registration/is_registered';
19
+ const XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_REQUEST_URL
20
+ = 'affiliate_programs/pepperjam/registration/registration_url';
21
+ const XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_LEGAL_AGREEMENT_URL
22
+ = 'affiliate_programs/pepperjam/registration/legal_agreement_url';
23
+
24
+
25
+ /**
26
+ * Check xFabric registration status
27
+ * @return bool
28
+ */
29
+ public function isXfabricRegistered()
30
+ {
31
+ return (bool)Mage::helper('xcom_xfabric')->getResponseAuthorizationKey();
32
+ }
33
+
34
+ public function getRegistrationRequestUrl()
35
+ {
36
+ return Mage::getStoreConfig(self::XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_REQUEST_URL);
37
+ }
38
+
39
+ public function getRegistrationTargetCapabilityName()
40
+ {
41
+ return Mage::getStoreConfig(self::XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_TARGET_CAPABILITY_NAME);
42
+ }
43
+
44
+ public function getRegistrationStoreEndpointUrl()
45
+ {
46
+ return Mage::getStoreConfig(self::XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_STORE_ENDPOINT_URL);
47
+ }
48
+
49
+ public function getRegistrationLegalAgreementUrl()
50
+ {
51
+ return Mage::getStoreConfig(self::XML_PATH_PEPPERJAM_CHANNEL_REGISTRATION_LEGAL_AGREEMENT_URL);
52
+ }
53
+
54
+ /**
55
+ * Retrieve registration request
56
+ *
57
+ * @return Varien_Object
58
+ */
59
+ public function getRegistrationRequest()
60
+ {
61
+ $request = new Varien_Object();
62
+ $postData = array(
63
+ 'target_capability_name' => $this->getRegistrationTargetCapabilityName(),
64
+ 'store_endpoint_url' => $this->getRegistrationStoreEndpointUrl(),
65
+ 'is_registered' => $this->isXfabricRegistered(),
66
+ 'legal_agreement_url' => $this->getRegistrationLegalAgreementUrl(),
67
+ );
68
+ $jsonData = Zend_Json::encode($postData);
69
+ $request->setOnboardingInfo(urlencode($jsonData));
70
+ return $request;
71
+ }
72
+
73
+ }
app/code/community/TrueAction/PepperJam/LICENSE.TXT ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GSI COMMERCE
2
+ MAGENTO CONNECT EXTENSIONS
3
+ END USER LICENSE AGREEMENT
4
+ This End User License Agreement ("Agreement") is made as of July 10, 2012 (the "Effective Date") by and between GSI Interactive, Inc. (dba "TrueAction") ("TrueAction"), a Pennsylvania corporation having its principal place of business at 935 1st Avenue, King of Prussia, PA 19406 USA and the Licensee executing this Agreement.
5
+
6
+ WHEREAS, TrueAction along with its affiliates owned or controlled by GSI Commerce, Inc. (each, a "GSI Company") offer various e-commerce and marketing technology and services to its clients, including, among other things, fulfillment and customer call center services, various marketing technology platform services, and account management and marketing agency services (together, the "GSI Services").
7
+
8
+ WHEREAS, TrueAction desires to grant Licensee a limited licensee to use the applicable Magento Connect integration extension (including the associated documentation, the "Extension") in connection with Licensee's purchase and use of the corresponding GSI Services pursuant to an executed services agreement between Licensee and the applicable GSI Company ("Service Agreement").
9
+
10
+ The parties agree as follows:
11
+ TERMS AND CONDITIONS
12
+ 1. License
13
+ 1.1. Subject to Licensee's payment for the applicable GSI Services pursuant to a Service Agreement and Licensee's compliance with other terms and conditions of a Service Agreement and this Agreement, TrueAction hereby grants Licensee a non-transferable, non-assignable, non-sublicensable, worldwide license to use the Extension, solely for internal purposes, in accordance with the Extension's technical documentation and solely during the term of a Service Agreement.
14
+ 1.2. Licensee shall implement reasonable controls to ensure that it does not use the Extension except as permitted hereunder. TrueAction reserves the right to audit Licensee's use of the Extension during normal business hours and with reasonable notice and to include means within the Extension to limit Licensee's use of the Extension to the use permitted hereunder.
15
+ 1.3. TrueAction shall provide the Extension to Licensee, including the associated technical documentation, for use by Licensee in accordance with this Agreement.
16
+ 1.4. TrueAction may modify the terms of this Agreement at any time upon notice to Licensee, which notice shall be deemed given thirty (30) days following the posting of the modified agreement on the applicable Magento website or other website where the Extension is made available. Continued use of the Extension shall be deemed Licensee's consent and agreement with the modified agreement.
17
+
18
+ 2. License Exclusions and Restrictions
19
+ 2.1. Except as expressly authorized herein, Licensee shall not:
20
+ a. use or deploy the Extension in any manner except in connection with its purchase and use of the GSI Services pursuant to a Service Agreement;
21
+ b. reverse engineer, disassemble, decompile or otherwise attempt to derive the source code or functionality of the Extension, except to the extent allowed under any applicable law;
22
+ c. distribute, sublicense, disclose, market, rent, lease, or offer remote computing services, networking, batch processing or transfer of, the Extension to any third party, or permit any person or entity to have access to the Extension by means of a time sharing, remote computing services, networking, batch processing, service bureau or time sharing arrangement;
23
+ d. export the Extension in violation of U.S. Department of Commerce export administration regulations.
24
+ 2.2. No license, right or interest in any TrueAction or any other GSI Company trademark, trade name or service mark is granted hereunder.
25
+
26
+ 3. Fees
27
+ The Extension is made available to Licensee at no additional charge, subject to Licensee's timely payment for the GSI Services and compliance with a Service Agreement and this Agreement.
28
+
29
+ 4. Title and Protection
30
+ 4.1. TrueAction (or its third party providers) retains title to all portions of the Extension and any copies thereof. The Extension contains valuable proprietary information, and Licensee shall not disclose the Extension to anyone other than those of its employees or consultants under written nondisclosure obligations at least as restrictive as those contained in this Agreement, having a need to know for purposes consistent with this Agreement. Licensee shall be responsible for the compliance of such employees or consultants. Licensee shall affix, to each full or partial copy of the Extension made by Licensee, all copyright and proprietary information notices as were affixed to the original. The obligations set forth in this Section shall survive termination of this Agreement.
31
+ 4.2. If the Extension is acquired by or on behalf of a unit or agency of the U.S. Government (the "Government"), the Government agrees that such Product is "commercial computer software" or "commercial computer software documentation" and that, absent a written agreement to the contrary, the Government's rights with respect to such Product are limited by the terms of this Agreement, pursuant to applicable FAR and/or DFARS and successor regulations.
32
+
33
+ 5. Patent and Copyright Indemnity
34
+ For such time as Licensee is receiving Services pursuant to a Service Agreement, TrueAction shall indemnify and defend Licensee against any claims that the Extension infringes any United States patent or copyright; provided that TrueAction is given prompt notice of such claim and is given information, reasonable assistance and sole authority to defend or settle the claim. In the defense or settlement of the claim, TrueAction shall obtain for Licensee the right to continue using the Extension, replace or modify the Extension so that it becomes non-infringing while giving equivalent performance or, if TrueAction determines that such remedies are not reasonably available, remove the infringing portion of the Extension. TrueAction shall have no liability if the alleged infringement is based on (i) a modification of the Extension by anyone other than, or a combination of the Extension with any product or service not provided by, TrueAction; (ii) use of the Extension other than in accordance with the documentation of this Agreement; or (iii) use of the Extension not in connection with the GSI Services. This Section 5 states TrueAction's entire liability and Licensee's exclusive remedy for infringement.
35
+
36
+ 6. Default and Termination
37
+ 6.1. An event of default shall be deemed to occur if: (i) Licensee fails to perform any of its obligations under this Agreement or is otherwise in breach of this Agreement or a Service Agreement.
38
+ 6.2. If an event of default occurs, the non-defaulting party, in addition to any other rights available to it under the law, may terminate this Agreement and all licenses granted hereunder by written notice to the defaulting party. Remedies shall be cumulative and there shall be no obligation to exercise a particular remedy.
39
+ 6.3. This Agreement and all licenses granted herein shall automatically terminate upon the termination or expiration of the applicable Service Agreement.
40
+ 6.4. Within thirty (30) days after termination of this Agreement, Licensee shall certify in writing to TrueAction that Licensee has ceased use of the Extension and that all copies of the Extension in any form, including partial copies, have been destroyed.
41
+
42
+ 7. Warranty
43
+ 7.1. Warranty. TrueAction warrants for a single period of ninety (90) days commencing upon TrueAction's electronic delivery of the Extension to Licensee that the Extension will in all material respects perform the functions described in the specifications contained in the documentation provided with the Extension. TrueAction will use commercially reasonable efforts to undertake to correct any reported and verifiable error, which shall be TrueAction's entire liability and Licensee's exclusive remedy for errors. TrueAction does not warrant that the Extension will meet Licensee's requirements, that the Extension will operate in the combinations which Licensee may select for use, that the operation of the Extension will be uninterrupted or error-free, or that all error conditions will be corrected. EXCEPT AS PROVIDED IN THIS SECTION ALL SOFTWARE PROVIDED HEREUNDER IS PROVIDED "AS IS".
44
+ 7.2. DISCLAIMER . THE EXPRESS WARRANTIES SET FORTH IN THIS SECTION 7 ARE THE ONLY WARRANTIES MADE BY TRUEACTION WITH RESPECT TO THE EXTENSION PROVIDED BY TRUEACTION. TRUEACTION MAKES NO OTHER WARRANTIES, EXPRESS, IMPLIED OR ARISING BY CUSTOM OR TRADE USAGE, AND, SPECIFICALLY, MAKES NO WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. TRUEACTION'S EXPRESS WARRANTIES SHALL NOT BE ENLARGED, DIMINISHED OR AFFECTED BY, AND NO OBLIGATION OR LIABILITY SHALL ARISE OUT OF, TRUEACTION RENDERING TECHNICAL OR OTHER ADVICE OR SERVICE IN CONNECTION WITH THE EXTENSION.
45
+
46
+ 8. Limitation of Liability
47
+ 8.1. LIABILITY EXCLUSIONS. NOTHING IN THIS AGREEMENT SHALL EXCLUDE OR LIMIT EITHER PARTY'S LIABILITY FOR BREACH OF THE LICENSES OR RELATED RESTRICTIONS CONTAINED HEREIN OR ANY LIABILITY WHICH CANNOT BE EXCLUDED OR LIMITED BY APPLICABLE LAW. SAVE FOR THE FOREGOING, NEITHER PARTY ACCEPTS AND EACH PARTY HEREBY EXCLUDES ANY LIABILITY FOR LOSS OF OR DAMAGE TO TANGIBLE PROPERTY OTHER THAN THAT CAUSED BY ITS NEGLIGENCE AND HEREBY EXCLUDES ANY OTHER LIABILITY FOR NEGLIGENCE ARISING PURSUANT TO THE TERMS OF THIS AGREEMENT. UNDER NO CIRCUMSTANCES WILL EITHER PARTY BE LIABLE FOR: LOSS OF REVENUE; LOSS OF ACTUAL OR ANTICIPATED PROFITS; LOSS OF CONTRACTS; LOSS OF THE USE OF MONEY; LOSS OF ANTICIPATED SAVINGS; LOSS OF BUSINESS; LOSS OF OPPORTUNITY; LOSS OF GOODWILL; LOSS OF REPUTATION; LOSS OF, DAMAGE TO OR CORRUPTION OF DATA; OR CONSEQUENTIAL OR INDIRECT LOSS OR SPECIAL, PUNITIVE, OR INCIDENTAL DAMAGES (INCLUDING, FOR THE AVOIDANCE OF DOUBT, WHERE SUCH LOSS OR DAMAGE IS ALSO OF A CATEGORY OF LOSS OR DAMAGE ALREADY LISTED), WHETHER FORESEEABLE OR UNFORESEEABLE, BASED ON CLAIMS OF LICENSEE, TRUEACTION OR ANY THIRD PARTY ARISING OUT OF ANY BREACH OR FAILURE OF EXPRESS OR IMPLIED WARRANTY CONDITIONS OR OTHER TERM, BREACH OF CONTRACT, MISREPRESENTATION, NEGLIGENCE, OTHER LIABILITY IN TORT, FAILURE OF ANY REMEDY TO ACHIEVE ITS ESSENTIAL PURPOSE, OR OTHERWISE.
48
+
49
+ 8.2. LIABILITY CAP. NOTWITHSTANDING THE FORM (E.G., CONTRACT, TORT, OR OTHERWISE) IN WHICH ANY LEGAL OR EQUITABLE ACTION MAY BE BROUGHT, IN NO EVENT WILL TRUEACTION OR ITS SUPPLIERS BE LIABLE FOR DAMAGES, RESTITUTION OR LOSSES, THAT EXCEED, IN THE AGGREGATE, FOR EACH RESPECTIVE BREACH OR SERIES OF RELATED BREACHES, THE LESSER OF $5,000 OR THE AMOUNT OF FEES PAID BY LICENSEE FOR THE EXTENSION LICENSE IN THE TWELVE (12) MONTH PERIOD PRIOR TO THE DATE ON WHICH THE EVENT GIVING RISE TO SUCH DAMAGES OR LOSSES OCCURRED.
50
+
51
+ 9. Support Services
52
+ No support services are provided under this Agreement. Any support services provided to Licensee will be provided pursuant to a Service Agreement through the applicable GSI Company.
53
+
54
+ 10. Joint Marketing Activities
55
+ The parties agree to undertake the joint marketing activities set forth in Schedule A (Joint Marketing Activities).
56
+
57
+ 11. Notices
58
+ All notices shall be in writing and sent by first class mail or overnight mail (or courier), transmitted by facsimile (if confirmed by such mailing), or email, to the addresses indicated on the first page of this Agreement, or such other address as either party may indicate by at least ten (10) days prior written notice to the other party. Notices to TrueAction shall be sent to the attention of the General Counsel.
59
+
60
+ 12. Assignment
61
+ Licensee may not assign this Agreement without the prior written consent of TrueAction; provided that such consent shall not be required for assignment to a purchaser of all or substantially all of the assets or equity securities of Licensee who undertakes in writing to be bound by all the terms and conditions of this Agreement. Any prohibited assignment shall be null and void.
62
+
63
+ 13. Entire Agreement
64
+ This Agreement is the complete and exclusive agreement between the parties, which supersedes all proposals or prior agreements, oral or written, including any other online (click-through) agreement which Licensee may have accepted in conjunction with the downloading of the Extension, and all other communications between the parties relating to the subject matter hereof. No purchase order, other ordering document or any hand written or typewritten text or email which purports to modify or supplement the printed text hereof or any executed agreement with any GSI Company other than TrueAction shall add to or vary the terms thereof. Except as contained in a writing signed by both parties, all such proposed variations or additions are objected to and shall have no force or effect.
65
+
66
+ 14. General
67
+ This Agreement is made in and shall be governed by the laws of the State of New York, excluding choice of law principles. All proceedings shall be conducted in English. Venue for all proceedings shall be the state and federal courts located in New York, New York, provided that TrueAction may seek injunctive relief in any court of competent jurisdiction. The United Nations Convention for the International Sale of Goods shall not apply. The section headings herein are provided for convenience only and have no substantive effect on the construction of this Agreement. Except for Licensee's license restrictions herein, neither party shall be liable for any failure to perform due to causes beyond its reasonable control. If any provision of this Agreement is held to be unenforceable, this Agreement shall be construed without such provision. The failure by a party to exercise any right hereunder shall not operate as a waiver of such party's right to exercise such right or any other right in the future. This Agreement may be amended only by a written document executed by a duly authorized representative of each of the parties. The parties agree to receive electronic documents and accept electronic signatures (information attached or logically associated with such document and clicked or otherwise adopted with an intent to sign) including in counterparts which shall be valid substitutes for paper-based documents and signatures, and the legal validity of a transaction will not be denied on the ground that it is not in writing.
68
+
69
+ 15. Definitions
70
+ "Updates" means all published revisions and corrections to the printed documentation and corrections and new releases of the Extension which are generally made available to TrueAction's supported customers at no additional cost or for media and handling charges only. Updates shall not include any options or future products which TrueAction sells separately.
71
+
72
+ SCHEDULE A
73
+ TRUEACTION EXTENSION
74
+ JOINT MARKETING ACTIVITIES
75
+ These Joint Marketing Activities are referenced in and incorporated into the End User License Agreement between GSI Interactive, Inc. ("TrueAction") and ("Licensee"), dated July 10, 2012 (the "Agreement").
76
+ 1. Press Releases. Licensee agrees to permit TrueAction to issue a press releases at (i) contract execution announcing the selection of the Extension(s), and (ii) at launch of GSI Services. Licensee will have the right to approve the release in advance, but such approval will not be unreasonably delayed or withheld.
77
+ 2. Use of Licensee Logo. TrueAction shall be permitted to include Licensee's logo on TrueAction's website (including its social media pages) as well as in connection with the Magento Connect website and in printed marketing material.
78
+ 3. Interview. Licensee agrees to designate one of its founders and/or executives to participate in a video and/or written interview to promote the TrueAction Extension.
79
+ 4. Case Study. The parties shall jointly issue a case study based on such use. Licensee's site may be showcased on TrueAction's website.
80
+ 5. Reference. Licensee's employees shall make themselves available to be a reference for the Extension and will provide quotations about how the Extension has contributed to the success of their site or product.
81
+ 6. Other. Additional joint marketing activities may be developed based upon mutual agreement.
app/code/community/TrueAction/PepperJam/Model/Message/Order.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Message_Order extends Xcom_Chronicle_Model_Message_Order
9
+ {
10
+
11
+ /**
12
+ * Override _createSimpleOrder to include referral source in the message
13
+ *
14
+ * @param $order Mage_Sales_Model_Order
15
+ * @return array
16
+ */
17
+ protected function _createOrderDetails()
18
+ {
19
+ $data = parent::_createOrderDetails();
20
+ if (array_key_exists('referralSource', $data)) {
21
+ $orderReferralSource = $this->_order->getReferralSource();
22
+ if (!$orderReferralSource) {
23
+ $orderReferral = Mage::getModel('pepperjam/referral')->load($this->_order->getId());
24
+ $orderReferralSource = $orderReferral->getReferralSouce();
25
+ }
26
+ $data['referralSource'] = $orderReferralSource;
27
+ }
28
+ return $data;
29
+ }
30
+
31
+ }
app/code/community/TrueAction/PepperJam/Model/Message/Shipment.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Message_Shipment extends Xcom_Chronicle_Model_Message_Shipment
9
+ {
10
+
11
+ protected function _createShipment(Mage_Sales_Model_Order_Shipment $shipment)
12
+ {
13
+ $data = parent::_createShipment($shipment);
14
+ if (array_key_exists('referralSource', $data)) {
15
+ $orderReferral = Mage::getModel('pepperjam/referral')->load($shipment->getOrder()->getId());
16
+ $data['referralSource'] = $orderReferral->getReferralSource();
17
+ }
18
+ return $data;
19
+ }
20
+
21
+ }
app/code/community/TrueAction/PepperJam/Model/Observer.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Observer extends Xcom_Chronicle_Model_Observer
9
+ {
10
+
11
+ const PEPPER_JAM_SOURCE_PREFIX = 'pjn';
12
+
13
+ public function checkForPepperJamSource($observer)
14
+ {
15
+ $controller_action = $observer['controller_action'];
16
+ $requestParams = $controller_action->getRequest()->getParams();
17
+ // source param is set and starts with PJ source prefix
18
+ if (isset($requestParams['source']) && stripos($requestParams['source'], self::PEPPER_JAM_SOURCE_PREFIX) == 0) {
19
+ Mage::helper('pepperjam')->writeCookie($requestParams);
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Override Xcom_Chronicle observer to ensure the referral source
25
+ * is saved after the order model is saved and before the Xfabric message is sent
26
+ */
27
+ public function orderAfterCreate(Varien_Event_Observer $observer)
28
+ {
29
+ try {
30
+ if ($order = $observer->getEvent()->getOrder()) {
31
+ //single shipping order
32
+ $this->_addPepperJamReferralToOrder($order);
33
+ } else if ($observer->getEvent()->getOrders()) {
34
+ //multi shipping case
35
+ foreach ($observer->getEvent()->getOrders() as $order) {
36
+ $this->_addPepperJamReferralToOrder($order);
37
+ }
38
+ }
39
+ } catch (Exception $exception) {
40
+ $this->_handleException($exception);
41
+ }
42
+ return parent::orderAfterCreate($observer);
43
+ }
44
+
45
+ /**
46
+ * Save the stored referral source with a reference to the order that created it
47
+ */
48
+ protected function _addPepperJamReferralToOrder($order)
49
+ {
50
+ // Add referral source when editing from admin, relationParentId will be ID of the original order
51
+ if ($parentId = $order->getRelationParentId()) {
52
+ $parentReferral = Mage::getModel('pepperjam/referral')->load($parentId);
53
+ if ($parentSource = $parentReferral->getReferralSource()) {
54
+ $referral = Mage::getModel('pepperjam/referral')
55
+ ->setReferralSource($parentReferral)
56
+ ->setId($order->getId())
57
+ ->save();
58
+ $order->setReferralSource($parentReferral);
59
+ }
60
+ // Normal checkout, look for pepperjam cookie
61
+ } else {
62
+ $referralParams = Mage::getModel('core/cookie')->get(TrueAction_PepperJam_Helper_Data::PEPPERJAM_COOKIE_NAME);
63
+ if (!empty($referralParams)) {
64
+ $referral = Mage::getModel('pepperjam/referral')
65
+ ->setReferralSource($referralParams)
66
+ ->setId($order->getId())
67
+ ->save();
68
+ $order->setReferralSource($referralParams);
69
+ }
70
+ }
71
+ return $this;
72
+ }
73
+
74
+ }
app/code/community/TrueAction/PepperJam/Model/Referral.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Referral extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ /**
12
+ * Initialize resource model
13
+ */
14
+ protected function _construct()
15
+ {
16
+ $this->_init('pepperjam/referral');
17
+ }
18
+
19
+ public function getId()
20
+ {
21
+ return $this->getEntityId();
22
+ }
23
+
24
+ public function setId($id)
25
+ {
26
+ return $this->setEntityId($id);
27
+ }
28
+
29
+ }
app/code/community/TrueAction/PepperJam/Model/Resource/Referral.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Resource_Referral extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+
11
+ /**
12
+ * pk is fk to order so no auto increment
13
+ */
14
+ protected $_isPkAutoIncrement = false;
15
+
16
+ public function _construct()
17
+ {
18
+ $this->_init('pepperjam/referral', 'entity_id');
19
+ }
20
+
21
+ }
app/code/community/TrueAction/PepperJam/Model/Resource/Referral/Collection.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Model_Resource_Referral_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ $this->_init('pepperjam/referral');
14
+ }
15
+
16
+ }
app/code/community/TrueAction/PepperJam/controllers/Adminhtml/Pepperjam/RegisterController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ class TrueAction_PepperJam_Adminhtml_Pepperjam_RegisterController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ public function indexAction()
11
+ {
12
+ $this->loadLayout();
13
+ $this->renderLayout();
14
+ }
15
+ }
app/code/community/TrueAction/PepperJam/etc/adminhtml.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category TrueAction
5
+ * @package TrueAction_PepperJam
6
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <config>
10
+ <acl>
11
+ <resources>
12
+ <admin>
13
+ <children>
14
+ <system>
15
+ <children>
16
+ <config>
17
+ <children>
18
+ <affiliate_programs>
19
+ <title>Affiliate Programs</title>
20
+ </affiliate_programs>
21
+ </children>
22
+ </config>
23
+ </children>
24
+ </system>
25
+ </children>
26
+ </admin>
27
+ </resources>
28
+ </acl>
29
+ </config>
app/code/community/TrueAction/PepperJam/etc/config.xml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category TrueAction
5
+ * @package TrueAction_PepperJam
6
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <TrueAction_PepperJam>
12
+ <version>1.0.0</version>
13
+ </TrueAction_PepperJam>
14
+ </modules>
15
+ <global>
16
+ <models>
17
+ <pepperjam>
18
+ <class>TrueAction_PepperJam_Model</class>
19
+ <resourceModel>pepperjam_resource</resourceModel>
20
+ </pepperjam>
21
+ <pepperjam_resource>
22
+ <class>TrueAction_PepperJam_Model_Resource</class>
23
+ <entities>
24
+ <referral>
25
+ <table>trueaction_pepperjam_referral</table>
26
+ </referral>
27
+ </entities>
28
+ </pepperjam_resource>
29
+ <xcom_chronicle>
30
+ <rewrite>
31
+ <message_order>TrueAction_PepperJam_Model_Message_Order</message_order>
32
+ <message_shipment>TrueAction_PepperJam_Model_Message_Shipment</message_shipment>
33
+ <observer>TrueAction_PepperJam_Model_Observer</observer>
34
+ </rewrite>
35
+ </xcom_chronicle>
36
+ </models>
37
+ <resources>
38
+ <pepperjam_setup>
39
+ <setup>
40
+ <module>TrueAction_PepperJam</module>
41
+ </setup>
42
+ </pepperjam_setup>
43
+ </resources>
44
+ <blocks>
45
+ <pepperjam>
46
+ <class>TrueAction_PepperJam_Block</class>
47
+ </pepperjam>
48
+ </blocks>
49
+ <helpers>
50
+ <pepperjam>
51
+ <class>TrueAction_PepperJam_Helper</class>
52
+ </pepperjam>
53
+ </helpers>
54
+ <!--
55
+ Need some message from adapter to indicate that onboarding is successful.
56
+ <events>
57
+ <response_message_process_pong>
58
+ <observers>
59
+ <tan_pepperjam>
60
+ <type>singleton</type>
61
+ <class>TrueAction_PepperJam_Model_Observer</class>
62
+ <method>xcomMessagePong</method>
63
+ </tan_pepperjam>
64
+ </observers>
65
+ </response_message_process_pong>
66
+ </events>
67
+ -->
68
+ </global>
69
+ <frontend>
70
+ <layout>
71
+ <updates>
72
+ <pepperjam>
73
+ <file>pepperjam.xml</file>
74
+ </pepperjam>
75
+ </updates>
76
+ </layout>
77
+ <events>
78
+ <controller_action_predispatch>
79
+ <observers>
80
+ <pepperjam_watch_for_source_param>
81
+ <type>singleton</type>
82
+ <class>TrueAction_PepperJam_Model_Observer</class>
83
+ <method>checkForPepperJamSource</method>
84
+ </pepperjam_watch_for_source_param>
85
+ </observers>
86
+ </controller_action_predispatch>
87
+ </events>
88
+ <routers>
89
+ <pepperjam>
90
+ <use>standard</use>
91
+ <args>
92
+ <module>TrueAction_PepperJam</module>
93
+ <frontName>pepperjam</frontName>
94
+ </args>
95
+ </pepperjam>
96
+ </routers>
97
+ </frontend>
98
+ <adminhtml>
99
+ <layout>
100
+ <updates>
101
+ <pepperjam>
102
+ <file>pepperjam.xml</file>
103
+ </pepperjam>
104
+ </updates>
105
+ </layout>
106
+ </adminhtml>
107
+ <admin>
108
+ <routers>
109
+ <adminhtml>
110
+ <args>
111
+ <modules>
112
+ <TrueAction_PepperJam before="Mage_Adminhtml">TrueAction_PepperJam_Adminhtml</TrueAction_PepperJam>
113
+ </modules>
114
+ </args>
115
+ </adminhtml>
116
+ </routers>
117
+ </admin>
118
+ <default>
119
+ <affiliate_programs>
120
+ <pepperjam>
121
+ <cookie_lifetime>365</cookie_lifetime>
122
+ <beacon_enabled>1</beacon_enabled>
123
+ <use_demand_beacon>1</use_demand_beacon>
124
+ <registration>
125
+ <target_capability_name>PepperJam Exchange</target_capability_name>
126
+ <store_endpoint_url />
127
+ <registration_url><![CDATA[https://devportal.x.com/merchant_onboarding/]]></registration_url>
128
+ <legal_agreement_url><![CDATA[http://www.pepperjam.com/advertisers/magento-integration/]]></legal_agreement_url>
129
+ </registration>
130
+ </pepperjam>
131
+ </affiliate_programs>
132
+ </default>
133
+ </config>
app/code/community/TrueAction/PepperJam/etc/system.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category TrueAction
5
+ * @package TrueAction_PepperJam
6
+ * @copyright Copyright (c) 2012 True Action (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <config>
10
+ <tabs>
11
+ <marketing translate="label" module="pepperjam">
12
+ <label>Marketing</label>
13
+ <sort_order>99999</sort_order>
14
+ </marketing>
15
+ </tabs>
16
+ <sections>
17
+ <affiliate_programs>
18
+ <label>Affiliate Programs</label>
19
+ <tab>marketing</tab>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>100</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <groups>
26
+ <pepperjam translate="label">
27
+ <label>PepperJam Exchange</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>1</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <fields>
34
+ <register_button>
35
+ <label>Register</label>
36
+ <frontend_model>pepperjam/adminhtml_system_form_renderer_config_registerButton</frontend_model>
37
+ <comment><![CDATA[To enable the PepperJam Exchange extension, you must register it with x.com. A new window will appear and take you to x.com to complete your registration.<br />Log in with the same credentials you used when you registered for the Fabric at the System menu, under "Configuration".]]></comment>
38
+ <button_label>Register with X.commerce</button_label>
39
+ <button_url><![CDATA[*/pepperjam_register/index]]></button_url>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>0</show_in_website>
43
+ <show_in_store>0</show_in_store>
44
+ </register_button>
45
+ <setup_text translate="label comment">
46
+ <label>Configuration</label>
47
+ <frontend_model>pepperjam/adminhtml_system_form_renderer_config_headingComment</frontend_model>
48
+ <comment><![CDATA[This extension requres you to have an account with PepperJam Exchange. If you do not have an account or do not know the account information to enter below, please contact <a href="http://www.pepperjam.com/advertisers/magento-integration/" target="_blank">PepperJam Exchange</a> for details.]]></comment>
49
+ <sort_order>110</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>0</show_in_website>
52
+ <show_in_store>0</show_in_store>
53
+ </setup_text>
54
+ <enabled translate="label">
55
+ <label>Enable PepperJam Exchange</label>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>adminhtml/system_config_source_yesno</source_model>
58
+ <sort_order>120</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </enabled>
63
+ <merchant_id translate="label">
64
+ <label>Program Id</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>130</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </merchant_id>
71
+ <use_hybrid_pixel translate="label">
72
+ <label>Use Hybrid Pixel</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_yesno</source_model>
75
+ <sort_order>140</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </use_hybrid_pixel>
80
+ </fields>
81
+ </pepperjam>
82
+ </groups>
83
+ </affiliate_programs>
84
+ </sections>
85
+ </config>
app/code/community/TrueAction/PepperJam/sql/pepperjam_setup/install-0.1.0.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category TrueAction
4
+ * @package TrueAction_PepperJam
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+
8
+ $installer = $this;
9
+ $installer->startSetup();
10
+
11
+ $table = $installer->getConnection()
12
+ ->newTable(
13
+ $installer->getTable('pepperjam/referral')
14
+ )
15
+ ->addColumn(
16
+ 'entity_id',
17
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
18
+ null,
19
+ array(
20
+ 'unsigned' => true,
21
+ 'nullable' => false,
22
+ 'primary' => true,
23
+ ),
24
+ 'Entity Id')
25
+ ->addColumn(
26
+ 'referral_source',
27
+ Varien_Db_Ddl_Table::TYPE_TEXT,
28
+ 500,
29
+ array(
30
+ ),
31
+ 'Referral Source'
32
+ )
33
+ ->addForeignKey(
34
+ $installer->getFkName(
35
+ 'pepperjam/referral',
36
+ 'entity_id',
37
+ 'sales/order',
38
+ 'entity_id'
39
+ ),
40
+ 'entity_id',
41
+ $installer->getTable('sales/order'),
42
+ 'entity_id',
43
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
44
+ Varien_Db_Ddl_Table::ACTION_CASCADE
45
+ )
46
+ ->setComment('PepperJam Referral Source');
47
+
48
+ $installer->getConnection()->createTable($table);
49
+
50
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/pepperjam.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category design
5
+ * @package base_default
6
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <layout>
10
+ <adminhtml_pepperjam_register_index>
11
+ <reference name="root">
12
+ <action method="setTemplate"><template>pepperjam/register/view.phtml</template></action>
13
+ </reference>
14
+ </adminhtml_pepperjam_register_index>
15
+ </layout>
app/design/adminhtml/default/default/template/pepperjam/register/view.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+ ?>
8
+ <!DOCTYPE HTML>
9
+ <html lang="en-US">
10
+ <head>
11
+ <meta charset="UTF-8" />
12
+ <title><?php echo $this->__('Please wait') ?></title>
13
+ </head>
14
+ <body>
15
+ <?php /** @var $_helper Xcom_Ebay_Helper_Data */ ?>
16
+ <?php $_helper = $this->helper('pepperjam/xfabric'); ?>
17
+ <form id="xcom_registration" action="<?php echo $_helper->getRegistrationRequestUrl() ?>" method="post" enctype="multipart/form-data">
18
+ <input type="hidden" name="onboarding_info" value="<?php echo $_helper->getRegistrationRequest()->getOnboardingInfo() ?>" />
19
+ </form>
20
+ <script type="text/javascript">
21
+ document.forms['xcom_registration'].submit();
22
+ </script>
23
+ </body>
24
+ </html>
app/design/adminhtml/default/default/template/pepperjam/system/config/register_button.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ */
7
+ ?>
8
+ <h4 id="heading_<?php echo $this->getHtmlId() ?>"><?php echo $this->getElementLabel() ?></h4>
9
+ <div id="system-fieldset-sub-head-comment"><?php echo $this->getElementComment() ?></div>
10
+ <div>
11
+ <button class="scalable add" type="button" id="<?php echo $this->getHtmlId() ?>">
12
+ <span><?php echo $this->escapeHtml($this->getButtonLabel()); ?></span>
13
+ </button>
14
+ </div>
15
+ <script type="text/javascript">
16
+ //<![CDATA[
17
+ var XFabricExtensionRegistration = Class.create();
18
+ XFabricExtensionRegistration.prototype = {
19
+ initialize: function() {
20
+ this.redirectURL = '<?php echo $this->getUrl($this->getButtonUrl())?>';
21
+ this.buttonId = '<?php echo $this->getHtmlId() ?>';
22
+ this.popupWindow = null;
23
+
24
+ $(this.buttonId).observe('click', this.openWindow.bindAsEventListener(this));
25
+ },
26
+
27
+ openWindow: function() {
28
+ if (this.popupWindow == null || this.popupWindow.closed) {
29
+ this.popupWindow = window.open(this.redirectURL, 'ExtensionRegistartion', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=815, height=640');
30
+ }
31
+ else {
32
+ this.popupWindow.focus();
33
+ }
34
+ if (typeof this.intervalID == "number") {
35
+ window.clearInterval(this.intervalID);
36
+ delete this.intervalID;
37
+ }
38
+ this.intervalID = window.setInterval(function(){this.checkWindow();}.bind(this), 500);
39
+ return false;
40
+ },
41
+
42
+ checkWindow: function() {
43
+ if (this.popupWindow != null && this.popupWindow.closed) {
44
+ window.clearInterval(this.intervalID);
45
+ delete this.intervalID;
46
+ window.location.reload(true);
47
+ }
48
+ }
49
+ };
50
+ var registrationExtension = new XFabricExtensionRegistration();
51
+ //]]>
52
+ </script>
app/design/frontend/base/default/layout/pepperjam.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category design
5
+ * @package base_default
6
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <layout version="0.1.0">
10
+ <checkout_pepperjam_success translate="label">
11
+ <reference name="before_body_end">
12
+ <block type="pepperjam/beacon" name="pepperjam.beacon" template="pepperjam/beacon.phtml"/>
13
+ </reference>
14
+ </checkout_pepperjam_success>
15
+
16
+ <checkout_multishipping_success translate="label">
17
+ <label>Multishipping Checkout Success</label>
18
+ <update handle="checkout_pepperjam_success"/>
19
+ </checkout_multishipping_success>
20
+
21
+ <checkout_onepage_success translate="label">
22
+ <label>Onepage Checkout Success</label>
23
+ <update handle="checkout_pepperjam_success"/>
24
+ </checkout_onepage_success>
25
+ </layout>
app/design/frontend/base/default/template/pepperjam/beacon.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category design
4
+ * @package base_default
5
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
6
+ * @var $this TAN_PepperJam_Block_Beacon
7
+ */
8
+ ?>
9
+ <?php if ($this->showBeacon()):?>
10
+ <script>
11
+ (function (d,i) {
12
+ i=d.createElement('iframe');
13
+ i.width=i.height=1;
14
+ i.frameBorder=0;
15
+ i.src="<?php echo $this->getBeaconUrl()?>";
16
+ d.body.appendChild(i);
17
+ }(document));
18
+ </script>
19
+ <noscript>
20
+ <iframe width="1" height="1" frameBorder="0" src="<?php echo $this->getBeaconUrl()?>"></iframe>
21
+ </noscript>
22
+ <?php endif?>
app/etc/modules/TrueAction_PepperJam.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category TrueAction
5
+ * @package TrueAction_PepperJam
6
+ * @copyright Copyright (c) 2012 True Action Network (http://www.trueaction.com)
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <TrueAction_PepperJam>
12
+ <active>true</active>
13
+ <codePool>community</codePool>
14
+ <depends>
15
+ <Xcom_Xfabric />
16
+ </depends>
17
+ </TrueAction_PepperJam>
18
+ </modules>
19
+ </config>
package.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>PepperJamExchange</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://media.trueaction.com/magento/LICENSE.TXT">GSI Commerce End User License Agreement</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Pepperjam, a GSI Media company, is an industry leader in online performance marketing and technology.</summary>
10
+ <description>&lt;p&gt;Welcome to PepperJam Exchange, the preferred affiliate Partner for Magento merchants.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;As part of eBay&#x2019;s Inc&#x2019;s global marketing family we are excited to work as your brand advocate and affiliate network partner. Our commitment to you is to provide high-touch personalized service and innovative technology to drive revenue for your business.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;In order to get started, we&#x2019;d like to schedule some time to learn more about you and discuss your needs. Please complete our &lt;a href="http://www.pepperjam.com/advertisers/magento-integration/"&gt;contact form&lt;/a&gt; and an affiliate consultant will be in touch with you within one business day.&lt;/p&gt;&#xD;
13
+ &lt;h2&gt;Why PepperJam Exchange Leads in Performance Based Marketing&lt;/h2&gt;&#xD;
14
+ &lt;ul&gt;&#xD;
15
+ &lt;li&gt;Personal service supported by enterprise power&lt;/li&gt;&#xD;
16
+ &lt;li&gt;Best-in-class performance management&lt;/li&gt;&#xD;
17
+ &lt;li&gt;Transparent network of active publishers to drive incremental sales&lt;/li&gt;&#xD;
18
+ &lt;li&gt;Scalable technology to support rapidly changing consumer shopping landscape&lt;/li&gt;&#xD;
19
+ &lt;li&gt;Innovative product development and multi-channel solutions&lt;/li&gt;&#xD;
20
+ &lt;/ul&gt;</description>
21
+ <notes>Initial Release.</notes>
22
+ <authors><author><name>True Action PepperJam</name><user>trueaction_pj</user><email>pepperjam@trueaction.com</email></author></authors>
23
+ <date>2012-07-10</date>
24
+ <time>22:51:44</time>
25
+ <contents><target name="magecommunity"><dir name="TrueAction"><dir name="PepperJam"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="2a886a2f00c362b4fe8e72cefbeb94a2"/></dir></dir><dir name="System"><dir name="Form"><dir name="Renderer"><dir name="Config"><file name="HeadingComment.php" hash="c469f453c06aefdb32b943780e80e71b"/><file name="RegisterButton.php" hash="73a3173d145f2c77dd7ece6c7f3f21d0"/></dir></dir></dir></dir></dir><file name="Beacon.php" hash="a1ca59415bab1bb7d5133a03eed0c731"/></dir><dir name="Helper"><file name="Data.php" hash="56a3a7372eade5fd3735ca91445d1f3c"/><file name="Xfabric.php" hash="5ee028e6e5a00e300e217c2a959a0505"/></dir><file name="LICENSE.TXT" hash="90f4fc90c81a1ca036fad0087c9c7dee"/><dir name="Model"><dir name="Message"><file name="Order.php" hash="68ba41d89fb60dad57af8bb782886d41"/><file name="Shipment.php" hash="c93633cba746e6368a92c8b9d4ae0ca4"/></dir><file name="Observer.php" hash="78caba0c5c0716c90e7ccfff4d49b512"/><file name="Referral.php" hash="d18fcb550dd7a6b5ed11979d0c63cc81"/><dir name="Resource"><dir name="Referral"><file name="Collection.php" hash="00d0bcd78aa84352cb8fc7efda30e7da"/></dir><file name="Referral.php" hash="46f4a240d601a82015c9ac5973f8ce7b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Pepperjam"><file name="RegisterController.php" hash="31ad44d503b844686b2514d7da2abb62"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3968c6f709d375102fa256ccbd224851"/><file name="config.xml" hash="ab7135f4394d62a51ea538d46da2fa90"/><file name="system.xml" hash="b177cf093cb8d8ce34e30a43b94ede57"/></dir><dir name="sql"><dir name="pepperjam_setup"><file name="install-0.1.0.php" hash="329f06d0be9ef00d61d30a4a75ad76f3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pepperjam.xml" hash="5f5450e93559191ed46038c14f6fac6b"/></dir><dir name="template"><dir name="pepperjam"><dir name="register"><file name="view.phtml" hash="a96c543d3e6ad65db04e55d8f28c2f45"/></dir><dir name="system"><dir name="config"><file name="register_button.phtml" hash="b55eb2a2ed44315b66ddac5e7038440a"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pepperjam.xml" hash="f93ec3a1a53b33b8d5f0cf65bfec8cf4"/></dir><dir name="template"><dir name="pepperjam"><file name="beacon.phtml" hash="b2d0756ef1f0f0a74513c2998fa766cd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TrueAction_PepperJam.xml" hash="340b5d3c52161a773764f3e3cd731c0e"/></dir></target></contents>
26
+ <compatible/>
27
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>xintegrationpack</name><channel>community</channel><min>1.0.0</min><max>1.0.9</max></package></required></dependencies>
28
+ </package>