Version Notes
- Display Reward Points in
* Product page
* Checkout page
* Order Success Page
- Configure
* points multiple for dollars purchased
* location of Rewards Tab on site pages
- Earn Reward Points at www.punchtab.com (reported when order completes successfully)
Download this release
Release Info
Developer | Magento Core Team |
Extension | punchtabpoints |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/community/PunchTab/Points/Block/Pt.php +17 -0
- app/code/community/PunchTab/Points/Model/Observer.php +18 -21
- app/design/frontend/base/default/layout/points.xml +5 -2
- app/design/frontend/base/default/template/points/multishipping/points.phtml +1 -1
- app/design/frontend/base/default/template/points/points.phtml +1 -1
- app/design/frontend/base/default/template/points/pt.phtml +4 -0
- app/design/frontend/default/default/layout/points.xml +5 -2
- app/design/frontend/default/default/template/points/multishipping/points.phtml +1 -1
- app/design/frontend/default/default/template/points/points.phtml +1 -1
- app/design/frontend/default/default/template/points/pt.phtml +4 -0
- package.xml +4 -4
app/code/community/PunchTab/Points/Block/Pt.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PunchTab_Points_Block_Pt extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->setTemplate('points/pt.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getScript()
|
13 |
+
{
|
14 |
+
return Mage::helper('points')->getRewardsTabScript();
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/PunchTab/Points/Model/Observer.php
CHANGED
@@ -9,16 +9,11 @@ class PunchTab_Points_Model_Observer
|
|
9 |
$block = $observer->getEvent()->getBlock();
|
10 |
|
11 |
//Mage::Log("Name in Layout ".$block->getNameInLayout());
|
12 |
-
if($block->getNameInLayout() == 'head') {
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
}
|
17 |
-
if($block->getNameInLayout() == 'before_body_end')
|
18 |
-
{
|
19 |
-
$html = $transport->getHtml()."\n".Mage::helper('points')->getRewardsTabScript();
|
20 |
-
$transport->setHtml($html);
|
21 |
-
}
|
22 |
|
23 |
return $this;
|
24 |
}
|
@@ -26,10 +21,12 @@ class PunchTab_Points_Model_Observer
|
|
26 |
public function checkoutOnepageControllerSuccessAction($observer)
|
27 |
{
|
28 |
|
29 |
-
|
30 |
//Mage::Log("Count: ".count($orders));
|
31 |
//Mage::Log("order ".$orders['0']);
|
32 |
-
|
|
|
|
|
33 |
|
34 |
$this->postPointsToPunchTab($order_id);
|
35 |
|
@@ -39,10 +36,10 @@ class PunchTab_Points_Model_Observer
|
|
39 |
public function checkoutMultishippingControllerSuccessAction($observer)
|
40 |
{
|
41 |
$orders = $observer->getEvent()->getOrderIds();
|
42 |
-
|
43 |
foreach($orders as $oid => $order_id)
|
44 |
{
|
45 |
-
|
46 |
$this->postPointsToPunchTab($order_id);
|
47 |
}
|
48 |
return $this;
|
@@ -55,9 +52,9 @@ class PunchTab_Points_Model_Observer
|
|
55 |
$session = Mage::getSingleton('customer/session',array('name'=>'frontend'));
|
56 |
if($session->isLoggedIn())
|
57 |
{
|
58 |
-
|
59 |
$customer = $session->getCustomer();
|
60 |
-
|
61 |
}
|
62 |
|
63 |
$cookie = Mage::getSingleton('core/cookie');
|
@@ -69,8 +66,8 @@ class PunchTab_Points_Model_Observer
|
|
69 |
$price = 0;
|
70 |
$order = Mage::getModel('sales/order');
|
71 |
$order->load($order_id);
|
72 |
-
|
73 |
-
|
74 |
$points = floor($order->getSubtotal()*Mage::getStoreConfig('points/settings/multiple'));
|
75 |
$http_host = $visitor_data['http_host'];
|
76 |
$http_referer = $visitor_data['http_referer'];
|
@@ -83,7 +80,7 @@ class PunchTab_Points_Model_Observer
|
|
83 |
$query_parameters .= "&token=".$token;
|
84 |
$query_parameters .= "&installation=magento";
|
85 |
$url = $host.$url_path.$query_parameters;
|
86 |
-
|
87 |
|
88 |
//$post_data = '{';
|
89 |
//$post_data .= '"order_id":"'.$order->getIncrementId().'",';
|
@@ -107,8 +104,8 @@ class PunchTab_Points_Model_Observer
|
|
107 |
curl_setopt($pt_site, CURLOPT_POST, 1);
|
108 |
curl_setopt($pt_site, CURLOPT_POSTFIELDS,$post_data);
|
109 |
$result = curl_exec($pt_site);
|
110 |
-
|
111 |
-
|
112 |
curl_close($pt_site);
|
113 |
|
114 |
}
|
9 |
$block = $observer->getEvent()->getBlock();
|
10 |
|
11 |
//Mage::Log("Name in Layout ".$block->getNameInLayout());
|
12 |
+
//if($block->getNameInLayout() == 'head') {
|
13 |
+
// $layout = Mage::app()->getLayout();
|
14 |
+
// $html = $transport->getHtml()."\n".Mage::helper('points')->getHeaderScript();
|
15 |
+
// $transport->setHtml($html);
|
16 |
+
//}
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
return $this;
|
19 |
}
|
21 |
public function checkoutOnepageControllerSuccessAction($observer)
|
22 |
{
|
23 |
|
24 |
+
//$orders = $observer->getEvent()->getOrderIds();
|
25 |
//Mage::Log("Count: ".count($orders));
|
26 |
//Mage::Log("order ".$orders['0']);
|
27 |
+
//$order_id = $orders['0'];
|
28 |
+
$order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
|
29 |
+
Mage::Log("order ".$order_id);
|
30 |
|
31 |
$this->postPointsToPunchTab($order_id);
|
32 |
|
36 |
public function checkoutMultishippingControllerSuccessAction($observer)
|
37 |
{
|
38 |
$orders = $observer->getEvent()->getOrderIds();
|
39 |
+
Mage::Log("Count: ".count($orders));
|
40 |
foreach($orders as $oid => $order_id)
|
41 |
{
|
42 |
+
Mage::Log("order ".$order_id);
|
43 |
$this->postPointsToPunchTab($order_id);
|
44 |
}
|
45 |
return $this;
|
52 |
$session = Mage::getSingleton('customer/session',array('name'=>'frontend'));
|
53 |
if($session->isLoggedIn())
|
54 |
{
|
55 |
+
Mage::Log("User logged in");
|
56 |
$customer = $session->getCustomer();
|
57 |
+
Mage::Log("Customer Info: ".$customer->getEmail()." ".$customer->getFirstname()." ".$customer->getLastname());
|
58 |
}
|
59 |
|
60 |
$cookie = Mage::getSingleton('core/cookie');
|
66 |
$price = 0;
|
67 |
$order = Mage::getModel('sales/order');
|
68 |
$order->load($order_id);
|
69 |
+
Mage::Log($order->getData());
|
70 |
+
Mage::Log("Subtotal: ".$order->getSubtotal());
|
71 |
$points = floor($order->getSubtotal()*Mage::getStoreConfig('points/settings/multiple'));
|
72 |
$http_host = $visitor_data['http_host'];
|
73 |
$http_referer = $visitor_data['http_referer'];
|
80 |
$query_parameters .= "&token=".$token;
|
81 |
$query_parameters .= "&installation=magento";
|
82 |
$url = $host.$url_path.$query_parameters;
|
83 |
+
Mage::Log("URL ".$url);
|
84 |
|
85 |
//$post_data = '{';
|
86 |
//$post_data .= '"order_id":"'.$order->getIncrementId().'",';
|
104 |
curl_setopt($pt_site, CURLOPT_POST, 1);
|
105 |
curl_setopt($pt_site, CURLOPT_POSTFIELDS,$post_data);
|
106 |
$result = curl_exec($pt_site);
|
107 |
+
Mage::Log($result);
|
108 |
+
Mage::Log(curl_getinfo($pt_site));
|
109 |
curl_close($pt_site);
|
110 |
|
111 |
}
|
app/design/frontend/base/default/layout/points.xml
CHANGED
@@ -4,11 +4,14 @@
|
|
4 |
<default>
|
5 |
<block type="points/points" name="points" />
|
6 |
<block type="points/multishipping_points" name="multishipping_points" />
|
|
|
|
|
|
|
7 |
</default>
|
8 |
|
9 |
<catalog_product_view>
|
10 |
-
<reference name="
|
11 |
-
<block type="points/points" name="points_points" before="-" />
|
12 |
</reference>
|
13 |
</catalog_product_view>
|
14 |
|
4 |
<default>
|
5 |
<block type="points/points" name="points" />
|
6 |
<block type="points/multishipping_points" name="multishipping_points" />
|
7 |
+
<reference name="before_body_end">
|
8 |
+
<block type="points/pt" name="points_pt" before="-" template="points/pt.phtml"/>
|
9 |
+
</reference>
|
10 |
</default>
|
11 |
|
12 |
<catalog_product_view>
|
13 |
+
<reference name="alert.urls">
|
14 |
+
<block type="points/points" name="points_points" before="-" template="points/points.phtml"/>
|
15 |
</reference>
|
16 |
</catalog_product_view>
|
17 |
|
app/design/frontend/base/default/template/points/multishipping/points.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
-
<span
|
3 |
</div>
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
+
<span><?php echo $this->getMessage();?></span>
|
3 |
</div>
|
app/design/frontend/base/default/template/points/points.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
-
<span
|
3 |
</div>
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
+
<span><?php echo $this->getMessage();?></span>
|
3 |
</div>
|
app/design/frontend/base/default/template/points/pt.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div id="pt-scripts" class="points" name="points">
|
2 |
+
<?php echo $this->getScript(); ?>
|
3 |
+
</div>
|
4 |
+
|
app/design/frontend/default/default/layout/points.xml
CHANGED
@@ -4,11 +4,14 @@
|
|
4 |
<default>
|
5 |
<block type="points/points" name="points" />
|
6 |
<block type="points/multishipping_points" name="multishipping_points" />
|
|
|
|
|
|
|
7 |
</default>
|
8 |
|
9 |
<catalog_product_view>
|
10 |
-
<reference name="
|
11 |
-
<block type="points/points" name="points_points" before="-" />
|
12 |
</reference>
|
13 |
</catalog_product_view>
|
14 |
|
4 |
<default>
|
5 |
<block type="points/points" name="points" />
|
6 |
<block type="points/multishipping_points" name="multishipping_points" />
|
7 |
+
<reference name="before_body_end">
|
8 |
+
<block type="points/pt" name="points_pt" before="-" template="points/pt.phtml"/>
|
9 |
+
</reference>
|
10 |
</default>
|
11 |
|
12 |
<catalog_product_view>
|
13 |
+
<reference name="alert.urls">
|
14 |
+
<block type="points/points" name="points_points" before="-" template="points/points.phtml"/>
|
15 |
</reference>
|
16 |
</catalog_product_view>
|
17 |
|
app/design/frontend/default/default/template/points/multishipping/points.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
-
<span
|
3 |
</div>
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
+
<span><?php echo $this->getMessage();?></span>
|
3 |
</div>
|
app/design/frontend/default/default/template/points/points.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
-
<span
|
3 |
</div>
|
1 |
<div id="magento_points" class="regular-price">
|
2 |
+
<span><?php echo $this->getMessage();?></span>
|
3 |
</div>
|
app/design/frontend/default/default/template/points/pt.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div id="pt-scripts" class="points" name="points">
|
2 |
+
<?php echo $this->getScript(); ?>
|
3 |
+
</div>
|
4 |
+
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>punchtabpoints</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/lgpl-3.0.html">LGPL 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -19,9 +19,9 @@ From purchases to social sharing, reward-enable any action you want to incentivi
|
|
19 |
* location of Rewards Tab on site pages
|
20 |
- Earn Reward Points at www.punchtab.com (reported when order completes successfully)</notes>
|
21 |
<authors><author><name>punchtab</name><user>auto-converted</user><email>apps@punchtab.com</email></author></authors>
|
22 |
-
<date>2011-11-
|
23 |
-
<time>
|
24 |
-
<contents><target name="magecommunity"><dir name="PunchTab"><dir name="Points"><dir name="Block"><dir name="Multishipping"><file name="Points.php" hash="2904825280ac274f1d89f84d363a32e2"/></dir><file name="Points.php" hash="5b7578288edc1fe6743b7eed502a5a5f"/></dir><dir name="Helper"><file name="Data.php" hash="cd5a2c2eb1de4cad64a5c53a59bda794"/></dir><dir name="Model"><dir name="Backend"><dir name="Source"><file name="Position.php" hash="a5f3cf3176d1ef59ea8b7bfab6eb3e0d"/></dir></dir><file name="Observer.php" hash="
|
25 |
<compatible/>
|
26 |
<dependencies/>
|
27 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>punchtabpoints</name>
|
4 |
+
<version>1.0.2</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>
|
19 |
* location of Rewards Tab on site pages
|
20 |
- Earn Reward Points at www.punchtab.com (reported when order completes successfully)</notes>
|
21 |
<authors><author><name>punchtab</name><user>auto-converted</user><email>apps@punchtab.com</email></author></authors>
|
22 |
+
<date>2011-11-13</date>
|
23 |
+
<time>03:43:57</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="PunchTab"><dir name="Points"><dir name="Block"><dir name="Multishipping"><file name="Points.php" hash="2904825280ac274f1d89f84d363a32e2"/></dir><file name="Points.php" hash="5b7578288edc1fe6743b7eed502a5a5f"/><file name="Pt.php" hash="12f0a834df7a458e67f3b5035c89f050"/></dir><dir name="Helper"><file name="Data.php" hash="cd5a2c2eb1de4cad64a5c53a59bda794"/></dir><dir name="Model"><dir name="Backend"><dir name="Source"><file name="Position.php" hash="a5f3cf3176d1ef59ea8b7bfab6eb3e0d"/></dir></dir><file name="Observer.php" hash="3ccd2b6754f6a858560c9f8d272f2716"/></dir><dir name="etc"><file name="config.xml" hash="85e0848cd7693663b0235cccf97a9e0f"/><file name="system.xml" hash="dedadfa472e466e85f1e93ca625dc372"/></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="base"><dir name="default"><dir name="layout"><file name="points.xml" hash="405116807d00cbffa36196edef8569cd"/></dir><dir name="template"><dir name="points"><dir name="multishipping"><file name="points.phtml" hash="17ff2427fe17c787c3708cfa00140f78"/></dir><file name="points.phtml" hash="17ff2427fe17c787c3708cfa00140f78"/><file name="pt.phtml" hash="27063bd14d7abb81baafed07cbbd5916"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="points.xml" hash="405116807d00cbffa36196edef8569cd"/></dir><dir name="template"><dir name="points"><dir name="multishipping"><file name="points.phtml" hash="17ff2427fe17c787c3708cfa00140f78"/></dir><file name="points.phtml" hash="17ff2427fe17c787c3708cfa00140f78"/><file name="pt.phtml" hash="27063bd14d7abb81baafed07cbbd5916"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies/>
|
27 |
</package>
|