Qualityunit_Pap - Version 1.2.0

Version Notes

- option to force campaign ID
- safe character checker upgrade
- affiliate signup improved to work with cookies

Download this release

Release Info

Developer Quality Unit, LLC
Extension Qualityunit_Pap
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.0 to 1.2.0

app/code/local/Qualityunit/Pap/Block/Clicktracking.php CHANGED
@@ -15,6 +15,11 @@ class Qualityunit_Pap_Block_Clicktracking extends Mage_Core_Block_Text {
15
  $url = $config->getInstallationPath();
16
  $accountID = $config->getAPICredential('account');
17
 
 
 
 
 
 
18
  if ($url == '') {
19
  $this->addText('<!-- Post Affiliate Pro plugin has not been configured yet! -->');
20
  }
@@ -26,7 +31,7 @@ class Qualityunit_Pap_Block_Clicktracking extends Mage_Core_Block_Text {
26
  "'.$url.'/scripts/trackjs.js\' type=\'text/javascript\'%3E%3C/script%3E"));
27
  </script>
28
  <script type="text/javascript">
29
- PostAffTracker.setAccountId(\''.$accountID.'\');
30
  try {
31
  PostAffTracker.track();
32
  } catch (err) { }
15
  $url = $config->getInstallationPath();
16
  $accountID = $config->getAPICredential('account');
17
 
18
+ $campaign = '';
19
+ if ($config->getCampaignID() != '') {
20
+ $campaign = "\nvar CampaignID = '".$config->getCampaignID()."';";
21
+ }
22
+
23
  if ($url == '') {
24
  $this->addText('<!-- Post Affiliate Pro plugin has not been configured yet! -->');
25
  }
31
  "'.$url.'/scripts/trackjs.js\' type=\'text/javascript\'%3E%3C/script%3E"));
32
  </script>
33
  <script type="text/javascript">
34
+ PostAffTracker.setAccountId(\''.$accountID.'\');'.$campaign.'
35
  try {
36
  PostAffTracker.track();
37
  } catch (err) { }
app/code/local/Qualityunit/Pap/Block/Saletracking.php CHANGED
@@ -58,6 +58,7 @@ class Qualityunit_Pap_Block_SaleTracking extends Mage_Core_Block_Text {
58
  sale$i.setStatus('".$item['status']."');
59
  sale$i.setCurrency('".(Mage::app()->getStore()->getBaseCurrencyCode())."');\n";
60
 
 
61
  if (!empty($item['data1'])) $sale_tracker .= "sale$i.setData1('".$item['data1']."');\n";
62
  if (!empty($item['data2'])) $sale_tracker .= "sale$i.setData2('".$item['data2']."');\n";
63
  if (!empty($item['data3'])) $sale_tracker .= "sale$i.setData3('".$item['data3']."');\n";
58
  sale$i.setStatus('".$item['status']."');
59
  sale$i.setCurrency('".(Mage::app()->getStore()->getBaseCurrencyCode())."');\n";
60
 
61
+ if (!empty($item['campaignid'])) $sale_tracker .= "sale$i.setCampaignID('".$item['campaignid']."');\n";
62
  if (!empty($item['data1'])) $sale_tracker .= "sale$i.setData1('".$item['data1']."');\n";
63
  if (!empty($item['data2'])) $sale_tracker .= "sale$i.setData2('".$item['data2']."');\n";
64
  if (!empty($item['data3'])) $sale_tracker .= "sale$i.setData3('".$item['data3']."');\n";
app/code/local/Qualityunit/Pap/Model/Config.php CHANGED
@@ -67,6 +67,10 @@ class Qualityunit_Pap_Model_Config extends Mage_Core_Model_Config_Base {
67
  return Mage::getStoreConfig('pap_config/tracking/data'.$n);
68
  }
69
 
 
 
 
 
70
  public function isPerProductEnabled() {
71
  if (Mage::getStoreConfigFlag('pap_config/tracking/perproduct')) {
72
  return true;
67
  return Mage::getStoreConfig('pap_config/tracking/data'.$n);
68
  }
69
 
70
+ public function getCampaignID() {
71
+ return Mage::getStoreConfig('pap_config/tracking/trackforcampaign');
72
+ }
73
+
74
  public function isPerProductEnabled() {
75
  if (Mage::getStoreConfigFlag('pap_config/tracking/perproduct')) {
76
  return true;
app/code/local/Qualityunit/Pap/Model/Pap.php CHANGED
@@ -131,10 +131,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
131
  }
132
 
133
  private function safeString($str) {
134
- if (strpos($str, '&') !== false) {
135
- return urlencode($str);
136
- }
137
- return $str;
138
  }
139
 
140
  private function getStatus($state) {
@@ -172,6 +169,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
172
  $sales[$i]['productid'] = $this->safeString($product->getSku());
173
  $sales[$i]['couponcode'] = $couponcode;
174
  $sales[$i]['status'] = $status;
 
175
 
176
  for ($n = 1; $n < 6; $n++) {
177
  if ($config->getData($n)) {
@@ -191,6 +189,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
191
  $sales[0]['productid'] = null;
192
  $sales[0]['couponcode'] = $couponcode;
193
  $sales[0]['status'] = $status;
 
194
 
195
  for ($n = 1; $n < 6; $n++) {
196
  if ($config->getData($n)) {
@@ -233,7 +232,7 @@ class Qualityunit_Pap_Model_Pap extends Mage_Core_Model_Abstract {
233
  $customer = Mage::getSingleton('customer/session')->getCustomer();
234
 
235
  $session = $this->getSession();
236
- $affiliate = new Pap_Api_Affiliate($session);
237
  $affiliate->setUsername($order->getCustomerEmail());
238
  $affiliate->setFirstname($order->getCustomerFirstname());
239
  $affiliate->setLastname($order->getCustomerLastname());
131
  }
132
 
133
  private function safeString($str) {
134
+ return urlencode($str);
 
 
 
135
  }
136
 
137
  private function getStatus($state) {
169
  $sales[$i]['productid'] = $this->safeString($product->getSku());
170
  $sales[$i]['couponcode'] = $couponcode;
171
  $sales[$i]['status'] = $status;
172
+ $sales[$i]['campaignid'] = $config->getCampaignID();
173
 
174
  for ($n = 1; $n < 6; $n++) {
175
  if ($config->getData($n)) {
189
  $sales[0]['productid'] = null;
190
  $sales[0]['couponcode'] = $couponcode;
191
  $sales[0]['status'] = $status;
192
+ $sales[0]['campaignid'] = $config->getCampaignID();
193
 
194
  for ($n = 1; $n < 6; $n++) {
195
  if ($config->getData($n)) {
232
  $customer = Mage::getSingleton('customer/session')->getCustomer();
233
 
234
  $session = $this->getSession();
235
+ $affiliate = new Pap_Api_AffiliateSignup($session);
236
  $affiliate->setUsername($order->getCustomerEmail());
237
  $affiliate->setFirstname($order->getCustomerFirstname());
238
  $affiliate->setLastname($order->getCustomerLastname());
app/code/local/Qualityunit/Pap/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Qualityunit_Pap>
5
- <version>1.1.0</version>
6
  </Qualityunit_Pap>
7
  </modules>
8
  <global>
@@ -140,6 +140,7 @@
140
  <tracking>
141
  <trackingmethod>javascript</trackingmethod>
142
  <trackclicks>1</trackclicks>
 
143
  <perproduct>1</perproduct>
144
  <coupontrack>0</coupontrack>
145
  <autostatuschange>1</autostatuschange>
2
  <config>
3
  <modules>
4
  <Qualityunit_Pap>
5
+ <version>1.2.0</version>
6
  </Qualityunit_Pap>
7
  </modules>
8
  <global>
140
  <tracking>
141
  <trackingmethod>javascript</trackingmethod>
142
  <trackclicks>1</trackclicks>
143
+ <trackforcampaign></trackforcampaign>
144
  <perproduct>1</perproduct>
145
  <coupontrack>0</coupontrack>
146
  <autostatuschange>1</autostatuschange>
app/code/local/Qualityunit/Pap/etc/system.xml CHANGED
@@ -92,6 +92,15 @@
92
  <show_in_store>1</show_in_store>
93
  <tooltip><![CDATA[Choose whether the click tracking code should be automatically added to your site or not.]]></tooltip>
94
  </trackclicks>
 
 
 
 
 
 
 
 
 
95
  <perproduct translate="label">
96
  <label>Per Product Commissions</label>
97
  <frontend_type>select</frontend_type>
92
  <show_in_store>1</show_in_store>
93
  <tooltip><![CDATA[Choose whether the click tracking code should be automatically added to your site or not.]]></tooltip>
94
  </trackclicks>
95
+ <trackforcampaign>
96
+ <label>Track into campaign</label>
97
+ <frontend_type>text</frontend_type>
98
+ <sort_order>23</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ <tooltip><![CDATA[You can set if all sales will always be assigned to a specific campaign (identified by campaign ID).]]></tooltip>
103
+ </trackforcampaign>
104
  <perproduct translate="label">
105
  <label>Per Product Commissions</label>
106
  <frontend_type>select</frontend_type>
app/etc/modules/Qualityunit_Pap.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Qualityunit_Pap>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
- <version>1.1.0</version>
8
  </Qualityunit_Pap>
9
  </modules>
10
  </config>
4
  <Qualityunit_Pap>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <version>1.2.0</version>
8
  </Qualityunit_Pap>
9
  </modules>
10
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qualityunit_Pap</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -9,14 +9,13 @@
9
  <summary>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.</summary>
10
  <description>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.&#xD;
11
  The module integrates sales, supports per product tracking, Coupon tracking and Lifetime Commission tracking. It also automatically approves and declines commissions when transaction status is changed.</description>
12
- <notes>- option to turn off click tracking added&#xD;
13
- - option to turn off status changes added&#xD;
14
- - option to create an affiliate automatically&#xD;
15
- - added product ID condition for affiliate creation</notes>
16
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
17
- <date>2016-11-18</date>
18
- <time>10:49:04</time>
19
- <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Pap"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="dda7a8bb08c3ffe188c8b9612bd6d9fa"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="18514fdd4c0efba91d7644965679940b"/><dir name="Paypal"><file name="Redirect.php" hash="163f906979f1fa74c49954f76c32cd48"/></dir><file name="Saletracking.php" hash="12ee6aaa99e272ce7e92d1964a8632f6"/></dir><dir name="Helper"><file name="Data.php" hash="7d2adc731fa282df27b81990cc8ae634"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="59a9bff60fd34d2eec459b2aef2c7fc3"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="efeddbe739ca3a193dda0d5c19b55d15"/><file name="TrackSales.php" hash="1af0c801457e4b31f55fde6ad12e7b67"/></dir></dir><file name="Config.php" hash="40917e2e2e1f69cbc4b3773337820ca0"/><file name="Observer.php" hash="13fbbfb3f4c4e863cb9e2b296385761a"/><file name="Pap.php" hash="6b21599b6159614f53724d4a9eb36a08"/><file name="Paypal.php" hash="253bcb6a212495cfa838ee05cc606f3e"/><file name="PaypalIpn.php" hash="268b92124ac73a3fb35572e3002a6e81"/><file name="Validateapi.php" hash="2a90e74dc6a137a8960df465f17711ca"/></dir><dir name="etc"><file name="config.xml" hash="6a48a9f61639b1d1a5a1a2b6dd54dfce"/><file name="system.xml" hash="ddd4f6e142671e356c8d7056fd6b01e1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="600ebb26e9af1c78ac0a5d22717d2cd2"/></dir><dir name="template"><dir name="pap"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="cebb98c5c843a2921debea7cf98fdfe2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Pap.xml" hash="f56fd417224620989cc3084536b6fd44"/></dir></target><target name="magelib"><dir name="PAP"><file name="PapApi.class.php" hash="c72aff2ef36ea6ec91098c3a03ad6d93"/></dir></target><target name="mage"><dir name="lib"><dir name="PAP"><file name="README.txt" hash="2a279f64825e116dfd29c73fee9dabc8"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="pap"><file name="pap.css" hash="ff8a88a99075753b4a0ea9004d579a42"/><file name="pap-tab.png" hash="eef09c5b3777189e05b1702c463a9a33"/><file name="pap-logo.png" hash="e9053c44287a8d84801451ed69ef2f09"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qualityunit_Pap</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
9
  <summary>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.</summary>
10
  <description>The module makes an integration with Post Affiliate Pro or Post Affiliate Network an easy thing. A simple configuration with all the needed options helps you to make it working in seconds.&#xD;
11
  The module integrates sales, supports per product tracking, Coupon tracking and Lifetime Commission tracking. It also automatically approves and declines commissions when transaction status is changed.</description>
12
+ <notes>- option to force campaign ID&#xD;
13
+ - safe character checker upgrade&#xD;
14
+ - affiliate signup improved to work with cookies</notes>
 
15
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
16
+ <date>2017-01-17</date>
17
+ <time>12:58:38</time>
18
+ <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Pap"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="dda7a8bb08c3ffe188c8b9612bd6d9fa"/></dir></dir></dir></dir><file name="Clicktracking.php" hash="38b50a0be274db8bb528d56d241866da"/><dir name="Paypal"><file name="Redirect.php" hash="163f906979f1fa74c49954f76c32cd48"/></dir><file name="Saletracking.php" hash="8670044e7df98de5791312f27fd38ae2"/></dir><dir name="Helper"><file name="Data.php" hash="7d2adc731fa282df27b81990cc8ae634"/></dir><dir name="Model"><dir name="Checkout"><file name="Observer.php" hash="59a9bff60fd34d2eec459b2aef2c7fc3"/></dir><dir name="Config"><dir name="Source"><file name="CustomVariables.php" hash="efeddbe739ca3a193dda0d5c19b55d15"/><file name="TrackSales.php" hash="1af0c801457e4b31f55fde6ad12e7b67"/></dir></dir><file name="Config.php" hash="99ba8062a384014dff270f63164e9367"/><file name="Observer.php" hash="13fbbfb3f4c4e863cb9e2b296385761a"/><file name="Pap.php" hash="fa7ed7875b87248d011d9cd8c072d87f"/><file name="Paypal.php" hash="253bcb6a212495cfa838ee05cc606f3e"/><file name="PaypalIpn.php" hash="268b92124ac73a3fb35572e3002a6e81"/><file name="Validateapi.php" hash="2a90e74dc6a137a8960df465f17711ca"/></dir><dir name="etc"><file name="config.xml" hash="4937b3f46bc4653140549f9b34f3013f"/><file name="system.xml" hash="e276577132675143bafcfdc09c618b36"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="600ebb26e9af1c78ac0a5d22717d2cd2"/></dir><dir name="template"><dir name="pap"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="cebb98c5c843a2921debea7cf98fdfe2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="pap.xml" hash="167eddd9fa705fba71f8d3d2992a43cc"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Pap.xml" hash="74a7c6da8a545d1ecfc0388f8264db0b"/></dir></target><target name="magelib"><dir name="PAP"><file name="PapApi.class.php" hash="c72aff2ef36ea6ec91098c3a03ad6d93"/></dir></target><target name="mage"><dir name="lib"><dir name="PAP"><file name="README.txt" hash="2a279f64825e116dfd29c73fee9dabc8"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="pap"><file name="pap.css" hash="ff8a88a99075753b4a0ea9004d579a42"/><file name="pap-tab.png" hash="eef09c5b3777189e05b1702c463a9a33"/><file name="pap-logo.png" hash="e9053c44287a8d84801451ed69ef2f09"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php></required></dependencies>
21
  </package>