Version Notes
This is stable version on customer referral program
Download this release
Release Info
Developer | Magento Core Team |
Extension | Invitereferrals_Loyalty |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Invitereferrals/Loyalty/Block/Block.php +50 -0
- app/code/local/Invitereferrals/Loyalty/Block/Checkout.php +52 -0
- app/code/local/Invitereferrals/Loyalty/Helper/Data.php +6 -0
- app/code/local/Invitereferrals/Loyalty/etc/config.xml +54 -0
- app/code/local/Invitereferrals/Loyalty/etc/system.xml +46 -0
- app/design/frontend/default/default/layout/loyalty.xml +15 -0
- app/etc/modules/Invitereferrals_Loyalty.xml +9 -0
- package.xml +18 -0
app/code/local/Invitereferrals/Loyalty/Block/Block.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Developed By Siddharth Gupta
|
4 |
+
* @copyright Copyright (c) 2011-2012 tagNpin
|
5 |
+
* @license http://www.tagNpin.com/LICENSE-M1.txt
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Invitereferrals_Loyalty_Block_Block extends Mage_Core_Block_Template
|
9 |
+
{
|
10 |
+
protected function _toHtml()
|
11 |
+
{
|
12 |
+
$enableWidget = Mage::getStoreConfig('general/loyalty/active');
|
13 |
+
if(!empty($enableWidget)) {
|
14 |
+
$bid = Mage::getStoreConfig('general/loyalty/brandid');
|
15 |
+
$secKey = Mage::getStoreConfig('general/loyalty/secretkey');
|
16 |
+
|
17 |
+
$customer = Mage::getSingleton('customer/session')->isLoggedIn();
|
18 |
+
$customerData = array();
|
19 |
+
if($customer) {
|
20 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer()->getData();
|
21 |
+
} else {
|
22 |
+
$customerData['firstname'] = '';
|
23 |
+
$customerData['lastname'] = '';
|
24 |
+
$customerData['email'] = '';
|
25 |
+
$customerData['dob'] = '';
|
26 |
+
}
|
27 |
+
|
28 |
+
$t = time();
|
29 |
+
$setUserEmail = $customerData['email'];// the user email id
|
30 |
+
/* Optional parameters if passing email id as well */
|
31 |
+
$fname = $customerData['firstname'];//first name of customer
|
32 |
+
$lname = $customerData['lastname'];//last name of customer
|
33 |
+
$md5SecretKey = strtoupper(md5($secKey.'|'.$bid.'|'.$t.'|'.$setUserEmail));
|
34 |
+
|
35 |
+
echo "<div id='invtrflfloatbtn'></div>
|
36 |
+
<script>
|
37 |
+
var invite_referrals = window.invite_referrals || {}; (function() {
|
38 |
+
invite_referrals.auth = {
|
39 |
+
bid_e : '".$md5SecretKey."',
|
40 |
+
bid : '".$bid."', email : '".$setUserEmail."',
|
41 |
+
t : '".$t."', userParams : {'fname' : '".$fname."',
|
42 |
+
'lname' : '".$lname."'} };
|
43 |
+
var script = document.createElement('script');script.async = true;
|
44 |
+
script.src = 'http://' + 'cdn.invitereferrals.com/js/invite-referrals-1.0.js';
|
45 |
+
var entry = document.getElementsByTagName('script')[0];entry.parentNode.insertBefore(script, entry); })();
|
46 |
+
</script>";
|
47 |
+
//print '==========='.$brandID.'==========='.$title.'==========='.$xposition.'==========='.$yposition.'==========='.$secretKey.'===========';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Invitereferrals/Loyalty/Block/Checkout.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Developed By Siddharth Gupta
|
4 |
+
* @copyright Copyright (c) 2011-2012 tagNpin
|
5 |
+
* @license http://www.tagNpin.com/LICENSE-M1.txt
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Invitereferrals_Loyalty_Block_Checkout extends Mage_Core_Block_Template
|
9 |
+
{
|
10 |
+
protected function _toHtml()
|
11 |
+
{
|
12 |
+
$enablePurchaseWidget = Mage::getStoreConfig('general/loyalty/pointsonpurchase');
|
13 |
+
if(!empty($enablePurchaseWidget)) {
|
14 |
+
$brandID = Mage::getStoreConfig('general/loyalty/brandid');
|
15 |
+
$secretKey = Mage::getStoreConfig('general/loyalty/secretkey');
|
16 |
+
|
17 |
+
$order = new Mage_Sales_Model_Order();
|
18 |
+
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
19 |
+
$order->loadByIncrementId($incrementId);
|
20 |
+
|
21 |
+
$email = $order->getCustomerEmail(); // set email id
|
22 |
+
$purchaseValue = $order->getGrandTotal(); // set purchase value
|
23 |
+
$points = ''; // optional if you want to give points irrespective of points logic on any activity
|
24 |
+
$fname = $order->getCustomerFirstname();; // set first name
|
25 |
+
$lname = $order->getCustomerLastname(); // set last name
|
26 |
+
|
27 |
+
//$result = file_get_contents($apiUrl);
|
28 |
+
$resultArray = (array)json_decode($result);/* json decode the response */
|
29 |
+
//print_r($resultArray); die;
|
30 |
+
if($resultArray['type'] == 'success'){
|
31 |
+
$t = time();
|
32 |
+
/* Optional parameters if passing email id as well */
|
33 |
+
$md5SecretKey = strtoupper(md5($secretKey.'|'.$brandID.'|'.$t.'|'.$email));
|
34 |
+
|
35 |
+
echo "<div id='invtrflfloatbtn'></div>
|
36 |
+
<script>
|
37 |
+
var invite_referrals = window.invite_referrals || {}; (function() {
|
38 |
+
invite_referrals.auth = {
|
39 |
+
bid_e : '".$md5SecretKey."',
|
40 |
+
bid : '".$bid."', email : '".$setUserEmail."',
|
41 |
+
t : '".$t."', purchaseValue : '".$purchaseValue."',
|
42 |
+
orderID : '".$incrementId."', userParams : {'fname' : '".$fname."',
|
43 |
+
'lname' : '".$lname."'} };
|
44 |
+
var script = document.createElement('script');script.async = true;
|
45 |
+
script.src = 'http://' + 'cdn.invitereferrals.com/js/invite-referrals-1.0.js';
|
46 |
+
var entry = document.getElementsByTagName('script')[0];entry.parentNode.insertBefore(script, entry); })();
|
47 |
+
</script>";
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
app/code/local/Invitereferrals/Loyalty/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Invitereferrals_Loyalty_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Invitereferrals/Loyalty/etc/config.xml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Invitereferrals_Loyalty>
|
5 |
+
<version>4.0.0</version>
|
6 |
+
</Invitereferrals_Loyalty>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<loyalty>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Invitereferrals_Loyalty</module>
|
14 |
+
<frontName>loyalty</frontName>
|
15 |
+
</args>
|
16 |
+
</loyalty>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<loyalty>
|
21 |
+
<file>loyalty.xml</file>
|
22 |
+
</loyalty>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<models>
|
28 |
+
<loyalty>
|
29 |
+
<class>Invitereferrals_Loyalty_Model</class>
|
30 |
+
</loyalty>
|
31 |
+
</models>
|
32 |
+
<resources>
|
33 |
+
</resources>
|
34 |
+
<blocks>
|
35 |
+
<loyalty>
|
36 |
+
<class>Invitereferrals_Loyalty_Block</class>
|
37 |
+
</loyalty>
|
38 |
+
</blocks>
|
39 |
+
<helpers>
|
40 |
+
<loyalty>
|
41 |
+
<class>Invitereferrals_Loyalty_Helper</class>
|
42 |
+
</loyalty>
|
43 |
+
</helpers>
|
44 |
+
</global>
|
45 |
+
<default>
|
46 |
+
<general>
|
47 |
+
<loyalty>
|
48 |
+
<active>1</active>
|
49 |
+
<title>Loyalty</title>
|
50 |
+
</loyalty>
|
51 |
+
</general>
|
52 |
+
</default>
|
53 |
+
|
54 |
+
</config>
|
app/code/local/Invitereferrals/Loyalty/etc/system.xml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<general>
|
5 |
+
<groups>
|
6 |
+
<loyalty translate="label" module="loyalty">
|
7 |
+
<label>InviteReferrals Customer Referral Program Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>0</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enable Widget</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<brandid translate="label">
|
24 |
+
<label>brandid</label>
|
25 |
+
<comment>You can find this in Invitereferrals.com admin panel -> Website Integration</comment>
|
26 |
+
<frontend_type>text</frontend_type>
|
27 |
+
<sort_order>2</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>0</show_in_store>
|
31 |
+
</brandid>
|
32 |
+
<secretkey translate="label">
|
33 |
+
<label>Secret Key</label>
|
34 |
+
<comment>You can find this in Invitereferrals.com admin panel -> Website Integration</comment>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>3</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
</secretkey>
|
41 |
+
</fields>
|
42 |
+
</loyalty>
|
43 |
+
</groups>
|
44 |
+
</general>
|
45 |
+
</sections>
|
46 |
+
</config>
|
app/design/frontend/default/default/layout/loyalty.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="4.0.0">
|
3 |
+
<default>
|
4 |
+
<reference name="before_body_end" >
|
5 |
+
<block type="loyalty/block" name="page.bottom1" >
|
6 |
+
</block>
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
<checkout_onepage_success>
|
10 |
+
<reference name="before_body_end" >
|
11 |
+
<block type="loyalty/checkout" name="page.bottom" >
|
12 |
+
</block>
|
13 |
+
</reference>
|
14 |
+
</checkout_onepage_success>
|
15 |
+
</layout>
|
app/etc/modules/Invitereferrals_Loyalty.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Invitereferrals_Loyalty>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Invitereferrals_Loyalty>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Invitereferrals_Loyalty</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Design and launch Customer Referral Campaigns in minutes</summary>
|
10 |
+
<description>Design and launch Customer Referral Campaigns in minutes. Let customers become brand ambassadors and refer friends via multiple channels like facebook, twitter, email etc</description>
|
11 |
+
<notes>This is stable version on customer referral program</notes>
|
12 |
+
<authors><author><name>Siddharth Gupta</name><user>auto-converted</user><email>siddharthguptansit@gmail.com</email></author></authors>
|
13 |
+
<date>2013-09-29</date>
|
14 |
+
<time>16:55:30</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Invitereferrals"><dir name="Loyalty"><dir name="Block"><file name="Block.php" hash="59b1dc92014f19ec976104bf81729a3e"/><file name="Checkout.php" hash="cc8a62193bbec371218eaadbdf8064d7"/></dir><dir name="Helper"><file name="Data.php" hash="6607c633bf044f380a164017d8f82d7d"/></dir><dir name="etc"><file name="config.xml" hash="9215266ebfe67d10ef1d740850b47a75"/><file name="system.xml" hash="4e248e9e82d796db746fed5eb5cd0d2f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="loyalty.xml" hash="ecae4adc39cf8fc554205ed98e5f279c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Invitereferrals_Loyalty.xml" hash="aab573200959b1a8a4a2e23b1b3db58b"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|