Version Notes
1) Display "Reward Points" in Product, Cart, Checkout, and Order Success Pages.
2) Configure various features and display elements like "Rewards Tab" display location, currency-unit-to-points multiple, badges, and text displayed around rewards points .
3) Save points earned on completed orders at punchtab.com.
4) Social buttons (like, tweet, and +1) and facebook comments support in product pages.
5) Integrate Rewards membership with native magento accounts.
6) Rewards Catalog support
7) Display Rewards under My Account
8) Enable Multi-language support
9) Coupon support
10) Bottom Bar support
11) Points grant upon invoicing
12) Remove points for canceled payments or credits
Download this release
Release Info
Developer | Magento Core Team |
Extension | punchtabpoints |
Version | 1.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- app/code/community/PunchTab/Points/Helper/Data.php +9 -4
- app/code/community/PunchTab/Points/Model/Backend/Language.php +17 -7
- app/code/community/PunchTab/Points/Model/Backend/Source/Granted.php +13 -0
- app/code/community/PunchTab/Points/Model/Backend/Source/Position.php +1 -0
- app/code/community/PunchTab/Points/Model/Observer.php +177 -3
- app/code/community/PunchTab/Points/etc/config.xml +73 -2
- app/code/community/PunchTab/Points/etc/system.xml +21 -4
- app/design/frontend/base/default/layout/points.xml +1 -1
- app/design/frontend/default/default/layout/points.xml +1 -1
- package.xml +8 -5
app/code/community/PunchTab/Points/Helper/Data.php
CHANGED
@@ -34,7 +34,7 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
34 |
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Static HOST: ".$statichost);
|
35 |
if(strlen($pthost)==0)
|
36 |
{
|
37 |
-
$pthost = "
|
38 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$pthost);
|
39 |
}
|
40 |
if(strlen($statichost)==0)
|
@@ -78,6 +78,9 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
78 |
if( Mage::getStoreConfig('points/settings/position') == 'none') {
|
79 |
$scrpt .= 'display: "inline",';
|
80 |
}
|
|
|
|
|
|
|
81 |
else {
|
82 |
$scrpt .= 'display: "tab",';
|
83 |
}
|
@@ -106,6 +109,8 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
106 |
*/
|
107 |
if( Mage::getStoreConfig('points/social/earning') == 0 )
|
108 |
$scrpt .= 'earningmap: false';
|
|
|
|
|
109 |
$scrpt .= '};';
|
110 |
|
111 |
if( Mage::getStoreConfig('points/settings/badges') != 'none' )
|
@@ -178,7 +183,7 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
178 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
179 |
if(strlen($host)==0)
|
180 |
{
|
181 |
-
$host = "
|
182 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
183 |
}
|
184 |
$url_path = "/api/v1/auth/status";
|
@@ -263,7 +268,7 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
263 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
264 |
if(strlen($host)==0)
|
265 |
{
|
266 |
-
$host = "
|
267 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
268 |
}
|
269 |
$url_path = "/api/v1/auth/sso";
|
@@ -342,7 +347,7 @@ class PunchTab_Points_Helper_Data extends Mage_Core_Helper_Abstract
|
|
342 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
343 |
if(strlen($host)==0)
|
344 |
{
|
345 |
-
$host = "
|
346 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
347 |
}
|
348 |
$url_path = "/api/v1/auth/logout";
|
34 |
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Static HOST: ".$statichost);
|
35 |
if(strlen($pthost)==0)
|
36 |
{
|
37 |
+
$pthost = "api.punchtab.com";
|
38 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$pthost);
|
39 |
}
|
40 |
if(strlen($statichost)==0)
|
78 |
if( Mage::getStoreConfig('points/settings/position') == 'none') {
|
79 |
$scrpt .= 'display: "inline",';
|
80 |
}
|
81 |
+
elseif( Mage::getStoreConfig('points/settings/position') == 'bar' ){
|
82 |
+
$scrpt .= 'bar: {},';
|
83 |
+
}
|
84 |
else {
|
85 |
$scrpt .= 'display: "tab",';
|
86 |
}
|
109 |
*/
|
110 |
if( Mage::getStoreConfig('points/social/earning') == 0 )
|
111 |
$scrpt .= 'earningmap: false';
|
112 |
+
else
|
113 |
+
$scrpt .= 'earningmap: true';
|
114 |
$scrpt .= '};';
|
115 |
|
116 |
if( Mage::getStoreConfig('points/settings/badges') != 'none' )
|
183 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
184 |
if(strlen($host)==0)
|
185 |
{
|
186 |
+
$host = "api.punchtab.com";
|
187 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
188 |
}
|
189 |
$url_path = "/api/v1/auth/status";
|
268 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
269 |
if(strlen($host)==0)
|
270 |
{
|
271 |
+
$host = "api.punchtab.com";
|
272 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
273 |
}
|
274 |
$url_path = "/api/v1/auth/sso";
|
347 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
348 |
if(strlen($host)==0)
|
349 |
{
|
350 |
+
$host = "api.punchtab.com";
|
351 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
352 |
}
|
353 |
$url_path = "/api/v1/auth/logout";
|
app/code/community/PunchTab/Points/Model/Backend/Language.php
CHANGED
@@ -5,16 +5,26 @@ class PunchTab_Points_Model_Backend_Language
|
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
return array(
|
8 |
-
array('value' => '
|
9 |
-
array('value' => 'nl', 'label'=> Mage::helper('points')->__('Dutch')),
|
10 |
-
array('value' => 'fr', 'label'=> Mage::helper('points')->__('French')),
|
11 |
-
array('value' => 'de', 'label'=> Mage::helper('points')->__('German')),
|
12 |
array('value' => 'el', 'label'=> Mage::helper('points')->__('Greek')),
|
13 |
-
array('value' => '
|
14 |
-
array('value' => '
|
|
|
15 |
array('value' => 'es-es', 'label'=> Mage::helper('points')->__('Spanish (Spain)')),
|
16 |
-
array('value' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
array('value' => 'ru', 'label'=> Mage::helper('points')->__('Russian')),
|
|
|
|
|
18 |
array('value' => 'tr', 'label'=> Mage::helper('points')->__('Turkish')),
|
19 |
);
|
20 |
}
|
5 |
public function toOptionArray()
|
6 |
{
|
7 |
return array(
|
8 |
+
array('value' => 'cs', 'label'=> Mage::helper('points')->__('Czech')),
|
|
|
|
|
|
|
9 |
array('value' => 'el', 'label'=> Mage::helper('points')->__('Greek')),
|
10 |
+
array('value' => 'en', 'label'=> Mage::helper('points')->__('English')),
|
11 |
+
array('value' => 'en-gb', 'label'=> Mage::helper('points')->__('English (United Kingdom)')),
|
12 |
+
array('value' => 'es-us', 'label'=> Mage::helper('points')->__('Spanish (USA)')),
|
13 |
array('value' => 'es-es', 'label'=> Mage::helper('points')->__('Spanish (Spain)')),
|
14 |
+
array('value' => 'da', 'label'=> Mage::helper('points')->__('Danish')),
|
15 |
+
array('value' => 'de', 'label'=> Mage::helper('points')->__('German')),
|
16 |
+
array('value' => 'fr', 'label'=> Mage::helper('points')->__('French')),
|
17 |
+
array('value' => 'it', 'label'=> Mage::helper('points')->__('Italian')),
|
18 |
+
array('value' => 'is', 'label'=> Mage::helper('points')->__('Icelandic')),
|
19 |
+
array('value' => 'nb-no', 'label'=> Mage::helper('points')->__('Norwegian Bokmål (Norway)')),
|
20 |
+
array('value' => 'nl', 'label'=> Mage::helper('points')->__('Dutch')),
|
21 |
+
array('value' => 'pt', 'label'=> Mage::helper('points')->__('Portugese')),
|
22 |
+
array('value' => 'pt-br', 'label'=> Mage::helper('points')->__('Portuguese (Brazil)')),
|
23 |
+
array('value' => 'pt-pt', 'label'=> Mage::helper('points')->__('Portuguese (Portugal)')),
|
24 |
+
array('value' => 'ro', 'label'=> Mage::helper('points')->__('Romanian')),
|
25 |
array('value' => 'ru', 'label'=> Mage::helper('points')->__('Russian')),
|
26 |
+
array('value' => 'sk', 'label'=> Mage::helper('points')->__('Slovak')),
|
27 |
+
array('value' => 'sl', 'label'=> Mage::helper('points')->__('Slovenian')),
|
28 |
array('value' => 'tr', 'label'=> Mage::helper('points')->__('Turkish')),
|
29 |
);
|
30 |
}
|
app/code/community/PunchTab/Points/Model/Backend/Source/Granted.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PunchTab_Points_Model_Backend_Source_Granted
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'placed', 'label'=> Mage::helper('points')->__('Order Placed')),
|
9 |
+
array('value' => 'invoiced', 'label'=> Mage::helper('points')->__('Order Invoiced')),
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
app/code/community/PunchTab/Points/Model/Backend/Source/Position.php
CHANGED
@@ -9,6 +9,7 @@ class PunchTab_Points_Model_Backend_Source_Position
|
|
9 |
array('value' => 'top-right', 'label'=> Mage::helper('points')->__('Top Right')),
|
10 |
array('value' => 'bottom-left', 'label'=> Mage::helper('points')->__('Bottom Left')),
|
11 |
array('value' => 'bottom-right', 'label'=> Mage::helper('points')->__('Bottom Right')),
|
|
|
12 |
array('value' => 'none', 'label'=> Mage::helper('points')->__('None')),
|
13 |
);
|
14 |
}
|
9 |
array('value' => 'top-right', 'label'=> Mage::helper('points')->__('Top Right')),
|
10 |
array('value' => 'bottom-left', 'label'=> Mage::helper('points')->__('Bottom Left')),
|
11 |
array('value' => 'bottom-right', 'label'=> Mage::helper('points')->__('Bottom Right')),
|
12 |
+
array('value' => 'bar', 'label'=> Mage::helper('points')->__('Bottom Bar')),
|
13 |
array('value' => 'none', 'label'=> Mage::helper('points')->__('None')),
|
14 |
);
|
15 |
}
|
app/code/community/PunchTab/Points/Model/Observer.php
CHANGED
@@ -82,9 +82,10 @@ class PunchTab_Points_Model_Observer
|
|
82 |
//$order_id = $orders['0'];
|
83 |
$order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
|
84 |
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order_id);
|
85 |
-
|
86 |
$this->postPointsToPunchTab($order_id);
|
87 |
}
|
|
|
|
|
88 |
return $this;
|
89 |
}
|
90 |
|
@@ -101,6 +102,8 @@ class PunchTab_Points_Model_Observer
|
|
101 |
$this->postPointsToPunchTab($order_id);
|
102 |
}
|
103 |
}
|
|
|
|
|
104 |
return $this;
|
105 |
}
|
106 |
|
@@ -153,10 +156,13 @@ class PunchTab_Points_Model_Observer
|
|
153 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
154 |
if(strlen($host)==0)
|
155 |
{
|
156 |
-
$host = "
|
157 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
158 |
}
|
159 |
-
|
|
|
|
|
|
|
160 |
$query_parameters = "?method=POST";
|
161 |
$query_parameters .= "&key=".Mage::getStoreConfig('points/settings/key');
|
162 |
$query_parameters .= "&token=".$token;
|
@@ -186,6 +192,94 @@ class PunchTab_Points_Model_Observer
|
|
186 |
}
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
/*
|
190 |
public function customerCustomerAuthenticated($observer)
|
191 |
{
|
@@ -254,5 +348,85 @@ class PunchTab_Points_Model_Observer
|
|
254 |
Mage::Log("WARN - PunchTab not enabled or Client ID/shared secret not set");
|
255 |
}
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
82 |
//$order_id = $orders['0'];
|
83 |
$order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
|
84 |
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order_id);
|
|
|
85 |
$this->postPointsToPunchTab($order_id);
|
86 |
}
|
87 |
+
else
|
88 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("PunchTab not enabled");
|
89 |
return $this;
|
90 |
}
|
91 |
|
102 |
$this->postPointsToPunchTab($order_id);
|
103 |
}
|
104 |
}
|
105 |
+
else
|
106 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("PunchTab not enabled");
|
107 |
return $this;
|
108 |
}
|
109 |
|
156 |
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
157 |
if(strlen($host)==0)
|
158 |
{
|
159 |
+
$host = "api.punchtab.com";
|
160 |
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
161 |
}
|
162 |
+
if ( Mage::getStoreConfig('points/settings/granted') != 'invoiced')
|
163 |
+
$url_path = "/api/v1/activity/purchase/magento";
|
164 |
+
else
|
165 |
+
$url_path = "/api/v1/activity/magento/order";
|
166 |
$query_parameters = "?method=POST";
|
167 |
$query_parameters .= "&key=".Mage::getStoreConfig('points/settings/key');
|
168 |
$query_parameters .= "&token=".$token;
|
192 |
}
|
193 |
}
|
194 |
|
195 |
+
public function postInvoicePoints($order)
|
196 |
+
{
|
197 |
+
if( Mage::getStoreConfig('points/settings/enabled') )
|
198 |
+
{
|
199 |
+
$app = Mage::app('default');
|
200 |
+
$price = 0;
|
201 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log($order->getData());
|
202 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Subtotal: ".$order->getSubtotal());
|
203 |
+
$points = floor($order->getSubtotal()*Mage::getStoreConfig('points/settings/multiple'));
|
204 |
+
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
205 |
+
if(strlen($host)==0)
|
206 |
+
{
|
207 |
+
$host = "api.punchtab.com";
|
208 |
+
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
209 |
+
}
|
210 |
+
$url_path = "/api/v1/activity/magento/invoice";
|
211 |
+
$query_parameters = "?method=POST";
|
212 |
+
$query_parameters .= "&key=".Mage::getStoreConfig('points/settings/key');
|
213 |
+
$query_parameters .= "&installation=magento";
|
214 |
+
$url = $host.$url_path.$query_parameters;
|
215 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("URL ".$url);
|
216 |
+
|
217 |
+
$post_data = "order_id=".$order->getIncrementId()."&";
|
218 |
+
$post_data .= "points=".$points."&";
|
219 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("post data ".$post_data);;
|
220 |
+
|
221 |
+
$pt_site = curl_init();
|
222 |
+
curl_setopt($pt_site, CURLOPT_URL,$url);
|
223 |
+
curl_setopt($pt_site, CURLOPT_FAILONERROR, 1);
|
224 |
+
curl_setopt($pt_site, CURLOPT_FOLLOWLOCATION, 1);
|
225 |
+
curl_setopt($pt_site, CURLOPT_RETURNTRANSFER,1);
|
226 |
+
curl_setopt($pt_site, CURLOPT_TIMEOUT, 30);
|
227 |
+
curl_setopt($pt_site, CURLOPT_REFERER, Mage::getBaseURL() );
|
228 |
+
curl_setopt($pt_site, CURLOPT_POST, 1);
|
229 |
+
curl_setopt($pt_site, CURLOPT_POSTFIELDS,$post_data);
|
230 |
+
$result = curl_exec($pt_site);
|
231 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("postInvoicePoints: ".$result);
|
232 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log(curl_getinfo($pt_site));
|
233 |
+
curl_close($pt_site);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
public function removePoints($order)
|
238 |
+
{
|
239 |
+
if( Mage::getStoreConfig('points/settings/enabled') )
|
240 |
+
{
|
241 |
+
$app = Mage::app('default');
|
242 |
+
$price = 0;
|
243 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log($order->getData());
|
244 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Subtotal: ".$order->getSubtotal());
|
245 |
+
$points = floor($order->getSubtotal()*Mage::getStoreConfig('points/settings/multiple'));
|
246 |
+
$host = "http://".Mage::getStoreConfig('points/developer/pthost');
|
247 |
+
if(strlen($host)==0)
|
248 |
+
{
|
249 |
+
$host = "api.punchtab.com";
|
250 |
+
Mage::getModel('core/config')->saveConfig('points/developer/pthost',$host);
|
251 |
+
}
|
252 |
+
$url_path = "/api/v1/activity/magento/cancel";
|
253 |
+
$query_parameters = "?method=POST";
|
254 |
+
$query_parameters .= "&key=".Mage::getStoreConfig('points/settings/key');
|
255 |
+
$query_parameters .= "&installation=magento";
|
256 |
+
$url = $host.$url_path.$query_parameters;
|
257 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("URL ".$url);
|
258 |
+
|
259 |
+
$post_data = "order_id=".$order->getIncrementId()."&";
|
260 |
+
$post_data .= "points=".$points."&";
|
261 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("post data ".$post_data);
|
262 |
+
|
263 |
+
$core_session = Mage::getSingleton('core/session');
|
264 |
+
$visitor_data = $core_session->getVisitorData();
|
265 |
+
$http_referer = $visitor_data['http_referer'];
|
266 |
+
|
267 |
+
$pt_site = curl_init();
|
268 |
+
curl_setopt($pt_site, CURLOPT_URL,$url);
|
269 |
+
curl_setopt($pt_site, CURLOPT_FAILONERROR, 1);
|
270 |
+
curl_setopt($pt_site, CURLOPT_FOLLOWLOCATION, 1);
|
271 |
+
curl_setopt($pt_site, CURLOPT_RETURNTRANSFER,1);
|
272 |
+
curl_setopt($pt_site, CURLOPT_TIMEOUT, 30);
|
273 |
+
curl_setopt($pt_site, CURLOPT_REFERER,Mage::getBaseURL());
|
274 |
+
curl_setopt($pt_site, CURLOPT_POST, 1);
|
275 |
+
curl_setopt($pt_site, CURLOPT_POSTFIELDS,$post_data);
|
276 |
+
$result = curl_exec($pt_site);
|
277 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("removePoints: ".$result);
|
278 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log(curl_getinfo($pt_site));
|
279 |
+
curl_close($pt_site);
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
/*
|
284 |
public function customerCustomerAuthenticated($observer)
|
285 |
{
|
348 |
Mage::Log("WARN - PunchTab not enabled or Client ID/shared secret not set");
|
349 |
}
|
350 |
|
351 |
+
// Dispatched when Order "Invoice" us used from Order page
|
352 |
+
public function invoiceRegistered($observer)
|
353 |
+
{
|
354 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("invoiceRegistered dispatched...");
|
355 |
+
|
356 |
+
$order = $observer->getEvent()->getOrder();
|
357 |
+
$order_id = $order->getIncrementId();
|
358 |
+
if( Mage::getStoreConfig('points/settings/enabled') &&
|
359 |
+
Mage::getStoreConfig('points/settings/granted') == 'invoiced')
|
360 |
+
{
|
361 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order_id);
|
362 |
+
$this->postInvoicePoints($order);
|
363 |
+
}
|
364 |
+
else
|
365 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Points grant not set at invoice");
|
366 |
+
}
|
367 |
+
|
368 |
+
// Dispatched when Order "Cancel" is used from Order page
|
369 |
+
public function paymentCancel($observer)
|
370 |
+
{
|
371 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("paymentCancel dispatched...");
|
372 |
+
|
373 |
+
$payment = $observer->getEvent()->getPayment();
|
374 |
+
$order = $payment->getOrder();
|
375 |
+
if( Mage::getStoreConfig('points/settings/enabled') ) {
|
376 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order->getIncrementId());
|
377 |
+
$this->removePoints($order);
|
378 |
+
}
|
379 |
+
else
|
380 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Points removal not done - settings disabled");
|
381 |
+
}
|
382 |
+
|
383 |
+
// Dispatched when Order "Credit Memo" is used from Order page
|
384 |
+
public function paymentRefund($observer)
|
385 |
+
{
|
386 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("paymentRefund dispatched...");
|
387 |
+
|
388 |
+
$credit_memo = $observer->getEvent()->getCreditmemo();
|
389 |
+
$order = $credit_memo->getOrder();
|
390 |
+
if( Mage::getStoreConfig('points/settings/enabled') ) {
|
391 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order->getIncrementId());
|
392 |
+
$this->removePoints($order);
|
393 |
+
}
|
394 |
+
else
|
395 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("Points removal not done - settings disabled");
|
396 |
+
}
|
397 |
+
|
398 |
+
// Dispatched when Order "Invoice" us used from Order page - Does nothing for now
|
399 |
+
public function invoiceCreated($observer)
|
400 |
+
{
|
401 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("invoiceCreated dispatched...");
|
402 |
+
//$invoice = $observer->getEvent()->getInvoice();
|
403 |
+
//$order = $invoice->getOrder();
|
404 |
+
}
|
405 |
+
|
406 |
+
// do not know what triggers it!!! - Do nothing for now
|
407 |
+
public function invoiceCancel($observer)
|
408 |
+
{
|
409 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("invoiceCancel dispatched...");
|
410 |
+
//$order = $observer->getEvent()->getOrder();
|
411 |
+
//if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("order ".$order->getIncrementId());
|
412 |
+
//$this->removePoints($order);
|
413 |
+
}
|
414 |
+
|
415 |
+
// do not know what triggers it!!! - Do nothing for now
|
416 |
+
public function paymentCancelInvoice($observer)
|
417 |
+
{
|
418 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("paymentCancelInvoice dispatched...");
|
419 |
+
//$payment = $observer->getEvent()->getPayment();
|
420 |
+
//$order = $observer->getEvent()->getOrder();
|
421 |
+
}
|
422 |
+
|
423 |
+
// Dispatched when Order "Credit Memo" is used from Order page - Do nothing for now!
|
424 |
+
public function orderRefund($observer)
|
425 |
+
{
|
426 |
+
if(Mage::getStoreConfig('points/developer/debug')) Mage::Log("orderRefund dispatched...");
|
427 |
+
//$credit_memo = $observer->getEvent()->getCreditmemo();
|
428 |
+
//$order = $credit_memo->getOrder();
|
429 |
+
}
|
430 |
+
|
431 |
}
|
432 |
|
app/code/community/PunchTab/Points/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<PunchTab_Points>
|
6 |
-
<version>1.2.
|
7 |
</PunchTab_Points>
|
8 |
</modules>
|
9 |
|
@@ -87,6 +87,77 @@
|
|
87 |
</points_observer>
|
88 |
</observers>
|
89 |
</customer_logout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</events>
|
91 |
</global>
|
92 |
|
@@ -143,7 +214,7 @@
|
|
143 |
</social>
|
144 |
<developer>
|
145 |
<debug>Yes</debug>
|
146 |
-
<pthost>
|
147 |
<statichost>static.punchtab.com</statichost>
|
148 |
</developer>
|
149 |
</points>
|
3 |
<config>
|
4 |
<modules>
|
5 |
<PunchTab_Points>
|
6 |
+
<version>1.2.1</version>
|
7 |
</PunchTab_Points>
|
8 |
</modules>
|
9 |
|
87 |
</points_observer>
|
88 |
</observers>
|
89 |
</customer_logout>
|
90 |
+
|
91 |
+
<sales_order_invoice_save_after>
|
92 |
+
<observers>
|
93 |
+
<points_observer>
|
94 |
+
<type>model</type>
|
95 |
+
<class>PunchTab_Points_Model_Observer</class>
|
96 |
+
<method>invoiceCreated</method>
|
97 |
+
</points_observer>
|
98 |
+
</observers>
|
99 |
+
</sales_order_invoice_save_after>
|
100 |
+
|
101 |
+
<sales_order_invoice_register>
|
102 |
+
<observers>
|
103 |
+
<points_observer>
|
104 |
+
<type>model</type>
|
105 |
+
<class>PunchTab_Points_Model_Observer</class>
|
106 |
+
<method>invoiceRegistered</method>
|
107 |
+
</points_observer>
|
108 |
+
</observers>
|
109 |
+
</sales_order_invoice_register>
|
110 |
+
|
111 |
+
<sales_order_payment_cancel>
|
112 |
+
<observers>
|
113 |
+
<points_observer>
|
114 |
+
<type>model</type>
|
115 |
+
<class>PunchTab_Points_Model_Observer</class>
|
116 |
+
<method>paymentCancel</method>
|
117 |
+
</points_observer>
|
118 |
+
</observers>
|
119 |
+
</sales_order_payment_cancel>
|
120 |
+
|
121 |
+
<sales_order_invoice_cancel>
|
122 |
+
<observers>
|
123 |
+
<points_observer>
|
124 |
+
<type>model</type>
|
125 |
+
<class>PunchTab_Points_Model_Observer</class>
|
126 |
+
<method>invoiceCancel</method>
|
127 |
+
</points_observer>
|
128 |
+
</observers>
|
129 |
+
</sales_order_invoice_cancel>
|
130 |
+
|
131 |
+
<sales_order_payment_cancel_invoice>
|
132 |
+
<observers>
|
133 |
+
<points_observer>
|
134 |
+
<type>model</type>
|
135 |
+
<class>PunchTab_Points_Model_Observer</class>
|
136 |
+
<method>paymentCancelInvoice</method>
|
137 |
+
</points_observer>
|
138 |
+
</observers>
|
139 |
+
</sales_order_payment_cancel_invoice>
|
140 |
+
|
141 |
+
<sales_order_payment_refund>
|
142 |
+
<observers>
|
143 |
+
<points_observer>
|
144 |
+
<type>model</type>
|
145 |
+
<class>PunchTab_Points_Model_Observer</class>
|
146 |
+
<method>paymentRefund</method>
|
147 |
+
</points_observer>
|
148 |
+
</observers>
|
149 |
+
</sales_order_payment_refund>
|
150 |
+
|
151 |
+
<sales_order_creditmemo_refund>
|
152 |
+
<observers>
|
153 |
+
<points_observer>
|
154 |
+
<type>model</type>
|
155 |
+
<class>PunchTab_Points_Model_Observer</class>
|
156 |
+
<method>orderRefund</method>
|
157 |
+
</points_observer>
|
158 |
+
</observers>
|
159 |
+
</sales_order_creditmemo_refund>
|
160 |
+
|
161 |
</events>
|
162 |
</global>
|
163 |
|
214 |
</social>
|
215 |
<developer>
|
216 |
<debug>Yes</debug>
|
217 |
+
<pthost>api.punchtab.com</pthost>
|
218 |
<statichost>static.punchtab.com</statichost>
|
219 |
</developer>
|
220 |
</points>
|
app/code/community/PunchTab/Points/etc/system.xml
CHANGED
@@ -130,7 +130,7 @@
|
|
130 |
</myrewards>
|
131 |
|
132 |
<multiple translate="label">
|
133 |
-
<label>Points Multiple</label>
|
134 |
<frontend_type>text</frontend_type>
|
135 |
<sort_order>7</sort_order>
|
136 |
<show_in_default>1</show_in_default>
|
@@ -145,10 +145,27 @@
|
|
145 |
</comment>
|
146 |
</multiple>
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
<cid translate="label">
|
149 |
<label>PunchTab Client ID</label>
|
150 |
<frontend_type>text</frontend_type>
|
151 |
-
<sort_order>
|
152 |
<show_in_default>1</show_in_default>
|
153 |
<show_in_website>1</show_in_website>
|
154 |
<show_in_store>1</show_in_store>
|
@@ -164,7 +181,7 @@
|
|
164 |
<secret translate="label">
|
165 |
<label>Shared Secret</label>
|
166 |
<frontend_type>text</frontend_type>
|
167 |
-
<sort_order>
|
168 |
<show_in_default>1</show_in_default>
|
169 |
<show_in_website>1</show_in_website>
|
170 |
<show_in_store>1</show_in_store>
|
@@ -181,7 +198,7 @@
|
|
181 |
<label>Language</label>
|
182 |
<frontend_type>select</frontend_type>
|
183 |
<source_model>points/backend_language</source_model>
|
184 |
-
<sort_order>
|
185 |
<show_in_default>1</show_in_default>
|
186 |
<show_in_website>1</show_in_website>
|
187 |
<show_in_store>1</show_in_store>
|
130 |
</myrewards>
|
131 |
|
132 |
<multiple translate="label">
|
133 |
+
<label>Purchase Points Multiple</label>
|
134 |
<frontend_type>text</frontend_type>
|
135 |
<sort_order>7</sort_order>
|
136 |
<show_in_default>1</show_in_default>
|
145 |
</comment>
|
146 |
</multiple>
|
147 |
|
148 |
+
<granted translate="label">
|
149 |
+
<label>Purchase Points Granted when</label>
|
150 |
+
<frontend_type>select</frontend_type>
|
151 |
+
<source_model>points/backend_source_granted</source_model>
|
152 |
+
<sort_order>8</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>1</show_in_store>
|
156 |
+
<comment>
|
157 |
+
<![CDATA[
|
158 |
+
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
159 |
+
Select when points should be granted for Purchase<br/>
|
160 |
+
</div>
|
161 |
+
]]>
|
162 |
+
</comment>
|
163 |
+
</granted>
|
164 |
+
|
165 |
<cid translate="label">
|
166 |
<label>PunchTab Client ID</label>
|
167 |
<frontend_type>text</frontend_type>
|
168 |
+
<sort_order>9</sort_order>
|
169 |
<show_in_default>1</show_in_default>
|
170 |
<show_in_website>1</show_in_website>
|
171 |
<show_in_store>1</show_in_store>
|
181 |
<secret translate="label">
|
182 |
<label>Shared Secret</label>
|
183 |
<frontend_type>text</frontend_type>
|
184 |
+
<sort_order>10</sort_order>
|
185 |
<show_in_default>1</show_in_default>
|
186 |
<show_in_website>1</show_in_website>
|
187 |
<show_in_store>1</show_in_store>
|
198 |
<label>Language</label>
|
199 |
<frontend_type>select</frontend_type>
|
200 |
<source_model>points/backend_language</source_model>
|
201 |
+
<sort_order>11</sort_order>
|
202 |
<show_in_default>1</show_in_default>
|
203 |
<show_in_website>1</show_in_website>
|
204 |
<show_in_store>1</show_in_store>
|
app/design/frontend/base/default/layout/points.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<layout version="1.2.
|
3 |
|
4 |
<default>
|
5 |
<reference name="head">
|
1 |
<?xml version="1.0"?>
|
2 |
+
<layout version="1.2.1">
|
3 |
|
4 |
<default>
|
5 |
<reference name="head">
|
app/design/frontend/default/default/layout/points.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<layout version="1.2.
|
3 |
|
4 |
<default>
|
5 |
<reference name="head">
|
1 |
<?xml version="1.0"?>
|
2 |
+
<layout version="1.2.1">
|
3 |
|
4 |
<default>
|
5 |
<reference name="head">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>punchtabpoints</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/lgpl-3.0.html">LGPL 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -16,11 +16,14 @@
|
|
16 |
6) Rewards Catalog support
|
17 |
7) Display Rewards under My Account
|
18 |
8) Enable Multi-language support
|
19 |
-
9) Coupon support
|
|
|
|
|
|
|
20 |
<authors><author><name>punchtab</name><user>auto-converted</user><email>apps@punchtab.com</email></author></authors>
|
21 |
-
<date>2012-
|
22 |
-
<time>
|
23 |
-
<contents><target name="magecommunity"><dir name="PunchTab"><dir name="Points"><dir name="Block"><dir name="Body"><file name="Scripts.php" hash="33a55c0339fec45af8c377f50562404f"/></dir><dir name="Cart"><file name="Points.php" hash="0c955704e51f8b9a9dd297265526f1fc"/></dir><dir name="Head"><file name="Scripts.php" hash="9d3e54c80e2f0f8317266d076309692d"/></dir><dir name="Multishipping"><file name="Points.php" hash="2c3e1437acd282d04bdbcc494cccf539"/><file name="Success.php" hash="34a733431a6a49f51bef39ce52385865"/></dir><dir name="Onepage"><file name="Points.php" hash="5327f1a7dc8cf884e9514d9449173f78"/><file name="Success.php" hash="9bd605833e559bec321668477f75c75c"/></dir><file name="Bar.php" hash="34d8cf6acb2dc1fafcf5732b75825f39"/><file name="Fbcomments.php" hash="762632d82e9253effce5357d18ee6d98"/><file name="Points.php" hash="70af0851f6a944e34c3c48a4ea137179"/><file name="Pt.php" hash="fa84dde5f77a240c48931a1b7330be3c"/><file name="Rewards.php" hash="cb9c53eb42fe7d219d416adca40e9d0d"/><file name="Sidebar.php" hash="5bf33a1f8399f6755d884794fb049cd0"/></dir><dir name="Helper"><file name="Data.php" hash="
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>punchtabpoints</name>
|
4 |
+
<version>1.2.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/lgpl-3.0.html">LGPL 3.0</license>
|
7 |
<channel>community</channel>
|
16 |
6) Rewards Catalog support
|
17 |
7) Display Rewards under My Account
|
18 |
8) Enable Multi-language support
|
19 |
+
9) Coupon support
|
20 |
+
10) Bottom Bar support
|
21 |
+
11) Points grant upon invoicing
|
22 |
+
12) Remove points for canceled payments or credits</notes>
|
23 |
<authors><author><name>punchtab</name><user>auto-converted</user><email>apps@punchtab.com</email></author></authors>
|
24 |
+
<date>2012-11-26</date>
|
25 |
+
<time>23:42:03</time>
|
26 |
+
<contents><target name="magecommunity"><dir name="PunchTab"><dir name="Points"><dir name="Block"><dir name="Body"><file name="Scripts.php" hash="33a55c0339fec45af8c377f50562404f"/></dir><dir name="Cart"><file name="Points.php" hash="0c955704e51f8b9a9dd297265526f1fc"/></dir><dir name="Head"><file name="Scripts.php" hash="9d3e54c80e2f0f8317266d076309692d"/></dir><dir name="Multishipping"><file name="Points.php" hash="2c3e1437acd282d04bdbcc494cccf539"/><file name="Success.php" hash="34a733431a6a49f51bef39ce52385865"/></dir><dir name="Onepage"><file name="Points.php" hash="5327f1a7dc8cf884e9514d9449173f78"/><file name="Success.php" hash="9bd605833e559bec321668477f75c75c"/></dir><file name="Bar.php" hash="34d8cf6acb2dc1fafcf5732b75825f39"/><file name="Fbcomments.php" hash="762632d82e9253effce5357d18ee6d98"/><file name="Points.php" hash="70af0851f6a944e34c3c48a4ea137179"/><file name="Pt.php" hash="fa84dde5f77a240c48931a1b7330be3c"/><file name="Rewards.php" hash="cb9c53eb42fe7d219d416adca40e9d0d"/><file name="Sidebar.php" hash="5bf33a1f8399f6755d884794fb049cd0"/></dir><dir name="Helper"><file name="Data.php" hash="7cb83036ca81957e3c25c479d42e3855"/></dir><dir name="Model"><dir name="Backend"><dir name="Source"><file name="Granted.php" hash="b068bb54adf3e0239d110e4eb7db8654"/><file name="Position.php" hash="256eff743745d9be02c3de3e8b7406c0"/></dir><file name="Language.php" hash="15fe7900bd2ebb301d8e76c52801fa56"/></dir><file name="Api.php" hash="a423082a3cef35888ce47a43f34f439f"/><file name="Observer.php" hash="297d6fede87f2f27f9078ea888bde064"/></dir><dir name="controllers"><file name="RewardsController.php" hash="8039d6270b418681b313759827b00651"/></dir><dir name="etc"><file name="api.xml" hash="5de9b350dcb2745e045d30c54092b57a"/><file name="config.xml" hash="385c54631e48fa37e985ff5def52d34d"/><file name="system.xml" hash="680ffcc230a50a2f181c335ea70bbcaa"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PunchTab_Points.xml" hash="c4c05dc493146f8f6a04277724f544e3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="points.xml" hash="9fb791d1a7b385c5abed11192297bf42"/></dir><dir name="template"><dir name="points"><dir name="body"><file name="scripts.phtml" hash="3163832695258582903fe63d4a015d68"/></dir><dir name="cart"><file name="points.phtml" hash="598bab86255fd9a22bfa6a42f2a94d89"/></dir><dir name="head"><file name="scripts.phtml" hash="6bd9c28ac694d240c16d23485e83a02f"/></dir><dir name="multishipping"><file name="points.phtml" hash="b5c29d33572c624bbffdac8370888691"/><file name="success.phtml" hash="e71173d14cba4e46656c522d87b58cf0"/></dir><dir name="onepage"><file name="points.phtml" hash="917336395db3df656093f4e74b244ff4"/><file name="success.phtml" hash="97b12dcf1900801f3f699b94d34d99c1"/></dir><file name="bar.phtml" hash="6c2d56103046c5ce8862b3f653d33883"/><file name="fbcomments.phtml" hash="fdf158b520f003d9e01750b389e56da4"/><file name="points.phtml" hash="9eeaa4947625ca5e1a23b2e4a492a391"/><file name="pt.phtml" hash="27063bd14d7abb81baafed07cbbd5916"/><file name="rewards.phtml" hash="205a105419e0e6ced575e0a5a514ef24"/><file name="sidebar.phtml" hash="dd9da0b37025e18a9f10eb71eecd77a1"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="points.xml" hash="9fb791d1a7b385c5abed11192297bf42"/></dir><dir name="template"><dir name="points"><dir name="body"><file name="scripts.phtml" hash="3163832695258582903fe63d4a015d68"/></dir><dir name="cart"><file name="points.phtml" hash="598bab86255fd9a22bfa6a42f2a94d89"/></dir><dir name="head"><file name="scripts.phtml" hash="6bd9c28ac694d240c16d23485e83a02f"/></dir><dir name="multishipping"><file name="points.phtml" hash="b5c29d33572c624bbffdac8370888691"/><file name="success.phtml" hash="e71173d14cba4e46656c522d87b58cf0"/></dir><dir name="onepage"><file name="points.phtml" hash="917336395db3df656093f4e74b244ff4"/><file name="success.phtml" hash="97b12dcf1900801f3f699b94d34d99c1"/></dir><file name="bar.phtml" hash="6c2d56103046c5ce8862b3f653d33883"/><file name="fbcomments.phtml" hash="fdf158b520f003d9e01750b389e56da4"/><file name="points.phtml" hash="9eeaa4947625ca5e1a23b2e4a492a391"/><file name="pt.phtml" hash="27063bd14d7abb81baafed07cbbd5916"/><file name="rewards.phtml" hash="205a105419e0e6ced575e0a5a514ef24"/><file name="sidebar.phtml" hash="dd9da0b37025e18a9f10eb71eecd77a1"/></dir></dir></dir></dir></dir></target></contents>
|
27 |
<compatible/>
|
28 |
<dependencies/>
|
29 |
</package>
|