Version Notes
- pending commission (with revenue & transaction id) is created when order is placed
- commission is approved when `Submit Invoice` or `Ship` button is clicked
- commission is denied when `Cancel` button is clicked
Download this release
Release Info
Developer | Jeffrey Epstein |
Extension | Ambassador |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- app/code/community/Ambassador/Event/Model/Observer.php +76 -46
- app/code/community/Ambassador/Event/controllers/CallbackController.php +28 -0
- app/code/community/Ambassador/Event/etc/config.xml +20 -2
- app/design/frontend/default/default/template/ambassador/checkout/ecommerce.phtml +16 -6
- app/design/frontend/default/default/template/ambassador/checkout/img.phtml +12 -1
- app/design/frontend/enterprise/default/template/ambassador/checkout/ecommerce.phtml +36 -26
- app/design/frontend/enterprise/default/template/ambassador/checkout/img.phtml +12 -1
- package.xml +8 -6
app/code/community/Ambassador/Event/Model/Observer.php
CHANGED
@@ -23,77 +23,67 @@ class Ambassador_Event_Model_Observer extends Varien_Event_Observer
|
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
-
* Calls
|
27 |
*
|
28 |
* @param Varien_Event_Observer $observer
|
29 |
* @return Ambassador_Event
|
30 |
*/
|
31 |
-
public function
|
32 |
{
|
33 |
$snippet_type = Mage::getModel('core/variable')->loadByCode('getambassador_snippet_type')->getValue('plain');
|
34 |
-
$campaign_uid = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
35 |
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
36 |
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
37 |
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
38 |
|
39 |
-
if (empty($username) || empty($api_key)
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
$revenue = $order->getSubtotal()+$order->getDiscountAmount();
|
48 |
-
$email = $order->getCustomerEmail();
|
49 |
-
$first_name = $order->getCustomerFirstname();
|
50 |
-
$last_name = $order->getCustomerLastname();
|
51 |
-
$uid = $order->getCustomerId();
|
52 |
$transaction_uid = $order->getRealOrderId();
|
53 |
-
$ip_address = $order->getRemoteIp();
|
54 |
|
55 |
-
$api_url = $this->ambassador_url."api/v2/$username/$api_key/json/
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
$data = array(
|
65 |
-
'campaign_uid' => $campaign,
|
66 |
-
'email' => $email,
|
67 |
-
'revenue' => $revenue,
|
68 |
-
'transaction_uid' => $transaction_uid,
|
69 |
-
'first_name' => $first_name,
|
70 |
-
'last_name' => $last_name
|
71 |
-
);
|
72 |
-
|
73 |
-
if ($mode != 'dev') {
|
74 |
-
$data['ip_address'] = $ip_address;
|
75 |
-
}
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
// Output
|
89 |
-
$returnData = json_decode($buffer, true);
|
90 |
-
}
|
91 |
|
92 |
return $this;
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
-
* Adds initial code snippet to record
|
97 |
*
|
98 |
* @param Varien_Event_Observer $observer
|
99 |
* @return Ambassador_Event
|
@@ -104,6 +94,11 @@ class Ambassador_Event_Model_Observer extends Varien_Event_Observer
|
|
104 |
$campaign_uid = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
105 |
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
106 |
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
if (empty($username) || empty($api_key) || empty($campaign_uid) || $campaign_uid == 'disabled') {
|
109 |
return $this;
|
@@ -124,6 +119,8 @@ class Ambassador_Event_Model_Observer extends Varien_Event_Observer
|
|
124 |
array('template' => "ambassador/checkout/$template.phtml")
|
125 |
);
|
126 |
|
|
|
|
|
127 |
Mage::app()->getLayout()->getBlock('content')->append($block);
|
128 |
|
129 |
return $this;
|
@@ -205,6 +202,39 @@ class Ambassador_Event_Model_Observer extends Varien_Event_Observer
|
|
205 |
|
206 |
return $this;
|
207 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
209 |
|
210 |
?>
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
+
* Calls commission/update API method
|
27 |
*
|
28 |
* @param Varien_Event_Observer $observer
|
29 |
* @return Ambassador_Event
|
30 |
*/
|
31 |
+
public function callCommissionUpdate($observer)
|
32 |
{
|
33 |
$snippet_type = Mage::getModel('core/variable')->loadByCode('getambassador_snippet_type')->getValue('plain');
|
|
|
34 |
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
35 |
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
36 |
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
37 |
|
38 |
+
if (empty($username) || empty($api_key)) {
|
39 |
return $this;
|
40 |
}
|
41 |
|
42 |
+
switch ($observer->getEvent()->getName()) {
|
43 |
|
44 |
+
case 'sales_order_invoice_pay':
|
45 |
+
$order = $observer->getEvent()->getInvoice()->getOrder();
|
46 |
+
$is_approved = 1;
|
47 |
+
break;
|
48 |
+
case 'sales_order_shipment_save_after':
|
49 |
+
$order = $observer->getEvent()->getShipment()->getOrder();
|
50 |
+
$is_approved = 1;
|
51 |
+
break;
|
52 |
+
case 'order_cancel_after':
|
53 |
+
$order = $observer->getEvent()->getOrder();
|
54 |
+
$is_approved = 2;
|
55 |
+
break;
|
56 |
+
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
58 |
$transaction_uid = $order->getRealOrderId();
|
|
|
59 |
|
60 |
+
$api_url = $this->ambassador_url."api/v2/$username/$api_key/json/commission/update";
|
61 |
|
62 |
+
// Data for API call
|
63 |
+
$data = array(
|
64 |
+
'transaction_uid' => $transaction_uid,
|
65 |
+
'is_approved' => $is_approved
|
66 |
+
);
|
67 |
|
68 |
+
$data = http_build_query($data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
+
// Call to API via CURL
|
71 |
+
$curl_handle = curl_init();
|
72 |
+
curl_setopt($curl_handle, CURLOPT_URL, $api_url);
|
73 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
|
74 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
|
75 |
+
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
76 |
+
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
|
77 |
+
$buffer = curl_exec($curl_handle);
|
78 |
+
curl_close($curl_handle);
|
79 |
+
// Output
|
80 |
+
$returnData = json_decode($buffer, true);
|
|
|
|
|
|
|
81 |
|
82 |
return $this;
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
+
* Adds initial code snippet to record commission
|
87 |
*
|
88 |
* @param Varien_Event_Observer $observer
|
89 |
* @return Ambassador_Event
|
94 |
$campaign_uid = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
95 |
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
96 |
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
97 |
+
$is_approved = Mage::getModel('core/variable')->loadByCode('getambassador_is_approved')->getValue('plain');
|
98 |
+
|
99 |
+
if (is_null($is_approved)) {
|
100 |
+
$is_approved = $this->addMissingCustomVariable('getambassador_is_approved');
|
101 |
+
}
|
102 |
|
103 |
if (empty($username) || empty($api_key) || empty($campaign_uid) || $campaign_uid == 'disabled') {
|
104 |
return $this;
|
119 |
array('template' => "ambassador/checkout/$template.phtml")
|
120 |
);
|
121 |
|
122 |
+
$block->assign('mbsy_is_approved', $is_approved);
|
123 |
+
|
124 |
Mage::app()->getLayout()->getBlock('content')->append($block);
|
125 |
|
126 |
return $this;
|
202 |
|
203 |
return $this;
|
204 |
}
|
205 |
+
|
206 |
+
public function addMissingCustomVariable($name)
|
207 |
+
{
|
208 |
+
switch ($name) {
|
209 |
+
|
210 |
+
case 'getambassador_is_approved':
|
211 |
+
|
212 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_is_approved');
|
213 |
+
$variableData = $variable->getData();
|
214 |
+
|
215 |
+
if (empty($variableData)) {
|
216 |
+
|
217 |
+
$variable->cleanModelCache();
|
218 |
+
$variable = Mage::getModel('core/variable');
|
219 |
+
|
220 |
+
$variable_data = array(
|
221 |
+
'code' => 'getambassador_is_approved',
|
222 |
+
'name' => 'getambassador Approve commission while placing order',
|
223 |
+
'plain_value' => '0',
|
224 |
+
'html_value' => ''
|
225 |
+
);
|
226 |
+
|
227 |
+
$variable->setData($variable_data);
|
228 |
+
}
|
229 |
+
|
230 |
+
try {
|
231 |
+
$variable->save();
|
232 |
+
} catch (Exception $e) {}
|
233 |
+
|
234 |
+
return $variable_data['plain_value'];
|
235 |
+
break;
|
236 |
+
}
|
237 |
+
}
|
238 |
}
|
239 |
|
240 |
?>
|
app/code/community/Ambassador/Event/controllers/CallbackController.php
CHANGED
@@ -262,6 +262,34 @@ class Ambassador_Event_CallbackController extends Mage_Core_Controller_Front_Act
|
|
262 |
echo json_encode($e->getMessage());
|
263 |
}
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
echo json_encode(true);
|
266 |
|
267 |
} else {
|
262 |
echo json_encode($e->getMessage());
|
263 |
}
|
264 |
|
265 |
+
// save default is_approved
|
266 |
+
$variable->cleanModelCache();
|
267 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_is_approved');
|
268 |
+
$variableData = $variable->getData();
|
269 |
+
|
270 |
+
if (empty($variableData)) {
|
271 |
+
|
272 |
+
$variable->cleanModelCache();
|
273 |
+
$variable = Mage::getModel('core/variable');
|
274 |
+
|
275 |
+
$variable_data = array(
|
276 |
+
'code' => 'getambassador_is_approved',
|
277 |
+
'name' => 'getambassador Approve commission while placing order',
|
278 |
+
'plain_value' => '0',
|
279 |
+
'html_value' => ''
|
280 |
+
);
|
281 |
+
|
282 |
+
$variable->setData($variable_data);
|
283 |
+
}
|
284 |
+
|
285 |
+
try {
|
286 |
+
$variable->save();
|
287 |
+
|
288 |
+
} catch (Exception $e) {
|
289 |
+
|
290 |
+
echo json_encode($e->getMessage());
|
291 |
+
}
|
292 |
+
|
293 |
echo json_encode(true);
|
294 |
|
295 |
} else {
|
app/code/community/Ambassador/Event/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ambassador_Event>
|
5 |
-
<version>1.1.
|
6 |
</Ambassador_Event>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -55,10 +55,28 @@
|
|
55 |
<Ambassador_Event_Model_Observer>
|
56 |
<type>singleton</type>
|
57 |
<class>Ambassador_Event_Model_Observer</class>
|
58 |
-
<method>
|
59 |
</Ambassador_Event_Model_Observer>
|
60 |
</observers>
|
61 |
</sales_order_invoice_pay>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
</events>
|
63 |
</adminhtml>
|
64 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ambassador_Event>
|
5 |
+
<version>1.1.3</version>
|
6 |
</Ambassador_Event>
|
7 |
</modules>
|
8 |
<frontend>
|
55 |
<Ambassador_Event_Model_Observer>
|
56 |
<type>singleton</type>
|
57 |
<class>Ambassador_Event_Model_Observer</class>
|
58 |
+
<method>callCommissionUpdate</method>
|
59 |
</Ambassador_Event_Model_Observer>
|
60 |
</observers>
|
61 |
</sales_order_invoice_pay>
|
62 |
+
<sales_order_shipment_save_after>
|
63 |
+
<observers>
|
64 |
+
<Ambassador_Event_Model_Observer>
|
65 |
+
<type>singleton</type>
|
66 |
+
<class>Ambassador_Event_Model_Observer</class>
|
67 |
+
<method>callCommissionUpdate</method>
|
68 |
+
</Ambassador_Event_Model_Observer>
|
69 |
+
</observers>
|
70 |
+
</sales_order_shipment_save_after>
|
71 |
+
<order_cancel_after>
|
72 |
+
<observers>
|
73 |
+
<Ambassador_Event_Model_Observer>
|
74 |
+
<type>singleton</type>
|
75 |
+
<class>Ambassador_Event_Model_Observer</class>
|
76 |
+
<method>callCommissionUpdate</method>
|
77 |
+
</Ambassador_Event_Model_Observer>
|
78 |
+
</observers>
|
79 |
+
</order_cancel_after>
|
80 |
</events>
|
81 |
</adminhtml>
|
82 |
<global>
|
app/design/frontend/default/default/template/ambassador/checkout/ecommerce.phtml
CHANGED
@@ -16,6 +16,11 @@ $lastId = $checkout->getLastOrderId();
|
|
16 |
if ($lastId) {
|
17 |
$order = Mage::getModel('sales/order');
|
18 |
$order->load($lastId);
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
if (!empty($order)) {
|
@@ -35,17 +40,22 @@ if (!empty($order)) {
|
|
35 |
var mbsy_campaign_uid='<?php echo $campaign ?>'; // Required
|
36 |
var mbsy_email='<?php echo $email ?>'; // Required - replace with your new customer's email
|
37 |
// Put additional optional variables here
|
38 |
-
var mbsy_revenue='
|
39 |
-
var mbsy_has_trial=1; // Required
|
40 |
var mbsy_first_name='<?php echo $first_name ?>';
|
41 |
var mbsy_last_name='<?php echo $last_name ?>';
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
var addthis_config = {
|
43 |
-
|
44 |
}
|
45 |
var addthis_share = {
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
}
|
50 |
</script>
|
51 |
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
16 |
if ($lastId) {
|
17 |
$order = Mage::getModel('sales/order');
|
18 |
$order->load($lastId);
|
19 |
+
$revenue = $order->getSubtotal()+$order->getDiscountAmount();
|
20 |
+
$transaction_id = $order->getRealOrderId();
|
21 |
+
} else {
|
22 |
+
$revenue = 0;
|
23 |
+
$transaction_id = false;
|
24 |
}
|
25 |
|
26 |
if (!empty($order)) {
|
40 |
var mbsy_campaign_uid='<?php echo $campaign ?>'; // Required
|
41 |
var mbsy_email='<?php echo $email ?>'; // Required - replace with your new customer's email
|
42 |
// Put additional optional variables here
|
43 |
+
var mbsy_revenue='<?php echo $revenue ?>'; // Required
|
|
|
44 |
var mbsy_first_name='<?php echo $first_name ?>';
|
45 |
var mbsy_last_name='<?php echo $last_name ?>';
|
46 |
+
<?php if (in_array($mbsy_is_approved, array('1', '0'))) { ?>
|
47 |
+
var mbsy_is_approved='<?php echo $mbsy_is_approved ?>';
|
48 |
+
<?php } ?>
|
49 |
+
<?php if ($transaction_id) { ?>
|
50 |
+
var mbsy_transaction_uid = '<?php echo $transaction_id ?>';
|
51 |
+
<?php } ?>
|
52 |
var addthis_config = {
|
53 |
+
data_track_clickback: false
|
54 |
}
|
55 |
var addthis_share = {
|
56 |
+
templates : {
|
57 |
+
twitter : "{{title}} {{url}} (via @GetAmbassador)"
|
58 |
+
}
|
59 |
}
|
60 |
</script>
|
61 |
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
app/design/frontend/default/default/template/ambassador/checkout/img.phtml
CHANGED
@@ -25,6 +25,11 @@ $lastId = $checkout->getLastOrderId();
|
|
25 |
if ($lastId) {
|
26 |
$order = Mage::getModel('sales/order');
|
27 |
$order->load($lastId);
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
if (!empty($order)) {
|
@@ -38,6 +43,12 @@ if (!empty($order)) {
|
|
38 |
$last_name = '';
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
?>
|
42 |
|
43 |
-
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue
|
25 |
if ($lastId) {
|
26 |
$order = Mage::getModel('sales/order');
|
27 |
$order->load($lastId);
|
28 |
+
$revenue = $order->getSubtotal()+$order->getDiscountAmount();
|
29 |
+
$transaction_uid = '&mbsy_transaction_uid='.$order->getRealOrderId();
|
30 |
+
} else {
|
31 |
+
$revenue = 0;
|
32 |
+
$transaction_uid = '';
|
33 |
}
|
34 |
|
35 |
if (!empty($order)) {
|
43 |
$last_name = '';
|
44 |
}
|
45 |
|
46 |
+
if (in_array($mbsy_is_approved, array('1', '0'))) {
|
47 |
+
$mbsy_is_approved = '&mbsy_is_approved='.$mbsy_is_approved;
|
48 |
+
} else {
|
49 |
+
$mbsy_is_approved = '';
|
50 |
+
}
|
51 |
+
|
52 |
?>
|
53 |
|
54 |
+
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue=<?php echo $revenue ?><?php echo $auto_create ?><?php echo $transaction_uid ?><?php echo $mbsy_is_approved ?>" style="border: none; display: none" alt="" />
|
app/design/frontend/enterprise/default/template/ambassador/checkout/ecommerce.phtml
CHANGED
@@ -5,47 +5,57 @@ $campaign = Mage::getModel('core/variable')->loadByCode('getambassador_active_ca
|
|
5 |
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
|
7 |
if ($mode === 'dev') {
|
8 |
-
|
9 |
} else {
|
10 |
-
|
11 |
}
|
12 |
|
13 |
$checkout = Mage::getSingleton('checkout/session');
|
14 |
$lastId = $checkout->getLastOrderId();
|
15 |
|
16 |
if ($lastId) {
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
if (!empty($order)) {
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
} else {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
?>
|
33 |
|
34 |
<script type="text/javascript">
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
</script>
|
51 |
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
5 |
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
|
7 |
if ($mode === 'dev') {
|
8 |
+
$mbsy_url = 'http://mbsy.dev/';
|
9 |
} else {
|
10 |
+
$mbsy_url = 'https://mbsy.co/';
|
11 |
}
|
12 |
|
13 |
$checkout = Mage::getSingleton('checkout/session');
|
14 |
$lastId = $checkout->getLastOrderId();
|
15 |
|
16 |
if ($lastId) {
|
17 |
+
$order = Mage::getModel('sales/order');
|
18 |
+
$order->load($lastId);
|
19 |
+
$revenue = $order->getSubtotal()+$order->getDiscountAmount();
|
20 |
+
$transaction_id = $order->getRealOrderId();
|
21 |
+
} else {
|
22 |
+
$revenue = 0;
|
23 |
+
$transaction_id = false;
|
24 |
}
|
25 |
|
26 |
if (!empty($order)) {
|
27 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
28 |
+
$email = $order->getCustomerEmail();
|
29 |
+
$first_name = $order->getBillingAddress()->getFirstname();
|
30 |
+
$last_name = $order->getBillingAddress()->getLastname();
|
31 |
} else {
|
32 |
+
$email = '';
|
33 |
+
$first_name = '';
|
34 |
+
$last_name = '';
|
35 |
}
|
36 |
|
37 |
?>
|
38 |
|
39 |
<script type="text/javascript">
|
40 |
+
var mbsy_campaign_uid='<?php echo $campaign ?>'; // Required
|
41 |
+
var mbsy_email='<?php echo $email ?>'; // Required - replace with your new customer's email
|
42 |
+
// Put additional optional variables here
|
43 |
+
var mbsy_revenue='<?php echo $revenue ?>'; // Required
|
44 |
+
var mbsy_first_name='<?php echo $first_name ?>';
|
45 |
+
var mbsy_last_name='<?php echo $last_name ?>';
|
46 |
+
<?php if (in_array($mbsy_is_approved, array('1', '0'))) { ?>
|
47 |
+
var mbsy_is_approved='<?php echo $mbsy_is_approved ?>';
|
48 |
+
<?php } ?>
|
49 |
+
<?php if ($transaction_id) { ?>
|
50 |
+
var mbsy_transaction_uid = '<?php echo $transaction_id ?>';
|
51 |
+
<?php } ?>
|
52 |
+
var addthis_config = {
|
53 |
+
data_track_clickback: false
|
54 |
+
}
|
55 |
+
var addthis_share = {
|
56 |
+
templates : {
|
57 |
+
twitter : "{{title}} {{url}} (via @GetAmbassador)"
|
58 |
+
}
|
59 |
+
}
|
60 |
</script>
|
61 |
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
app/design/frontend/enterprise/default/template/ambassador/checkout/img.phtml
CHANGED
@@ -25,6 +25,11 @@ $lastId = $checkout->getLastOrderId();
|
|
25 |
if ($lastId) {
|
26 |
$order = Mage::getModel('sales/order');
|
27 |
$order->load($lastId);
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
if (!empty($order)) {
|
@@ -38,6 +43,12 @@ if (!empty($order)) {
|
|
38 |
$last_name = '';
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
?>
|
42 |
|
43 |
-
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue
|
25 |
if ($lastId) {
|
26 |
$order = Mage::getModel('sales/order');
|
27 |
$order->load($lastId);
|
28 |
+
$revenue = $order->getSubtotal()+$order->getDiscountAmount();
|
29 |
+
$transaction_uid = '&mbsy_transaction_uid='.$order->getRealOrderId();
|
30 |
+
} else {
|
31 |
+
$revenue = 0;
|
32 |
+
$transaction_uid = '';
|
33 |
}
|
34 |
|
35 |
if (!empty($order)) {
|
43 |
$last_name = '';
|
44 |
}
|
45 |
|
46 |
+
if (in_array($mbsy_is_approved, array('1', '0'))) {
|
47 |
+
$mbsy_is_approved = '&mbsy_is_approved='.$mbsy_is_approved;
|
48 |
+
} else {
|
49 |
+
$mbsy_is_approved = '';
|
50 |
+
}
|
51 |
+
|
52 |
?>
|
53 |
|
54 |
+
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue=<?php echo $revenue ?><?php echo $auto_create ?><?php echo $transaction_uid ?><?php echo $mbsy_is_approved ?>" style="border: none; display: none" alt="" />
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ambassador</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://getambassador.com/terms">Zferral, Inc, magento@getAmbassador.com</license>
|
7 |
<channel>community</channel>
|
@@ -14,11 +14,13 @@ Use Ambassador to easily create, track & manage custom incentives that drive
|
|
14 |
Integrate Ambassador into the other existing applications you already use, including Salesforce, Sendgrid, MailChimp, Campaign Monitor, Sailthru, PayPal and Dwolla.
|
15 |

|
16 |
Get started on Ambassador with a free trial, simply follow the instructions on how to get up and running in just minutes.</description>
|
17 |
-
<notes
|
|
|
|
|
18 |
<authors><author><name>Jeffrey Epstein</name><user>getAmbassador</user><email>magento@getambassador.com</email></author><author><name>Greg Szymczak</name><user>gpszymczak</user><email>gpszymczak@gmail.com</email></author></authors>
|
19 |
-
<date>2013-
|
20 |
-
<time>
|
21 |
-
<contents><target name="magecommunity"><dir name="Ambassador"><dir name="Affiliate"><dir name="Model"><file name="Observer.php" hash="b8bb353e129bf09f5eeb6cc9d21a107c"/></dir><dir name="controllers"><file name="AffiliateController.php" hash="675abd910b45ea4320cd30455c36a200"/></dir><dir name="etc"><file name="config.xml" hash="98de110422ad3fe68c234eebba9c401a"/></dir></dir><dir name="Event"><dir name="Model"><file name="Observer.php" hash="
|
22 |
<compatible/>
|
23 |
-
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ambassador</name>
|
4 |
+
<version>1.1.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://getambassador.com/terms">Zferral, Inc, magento@getAmbassador.com</license>
|
7 |
<channel>community</channel>
|
14 |
Integrate Ambassador into the other existing applications you already use, including Salesforce, Sendgrid, MailChimp, Campaign Monitor, Sailthru, PayPal and Dwolla.
|
15 |

|
16 |
Get started on Ambassador with a free trial, simply follow the instructions on how to get up and running in just minutes.</description>
|
17 |
+
<notes>- pending commission (with revenue & transaction id) is created when order is placed
|
18 |
+
- commission is approved when `Submit Invoice` or `Ship` button is clicked
|
19 |
+
- commission is denied when `Cancel` button is clicked</notes>
|
20 |
<authors><author><name>Jeffrey Epstein</name><user>getAmbassador</user><email>magento@getambassador.com</email></author><author><name>Greg Szymczak</name><user>gpszymczak</user><email>gpszymczak@gmail.com</email></author></authors>
|
21 |
+
<date>2013-12-03</date>
|
22 |
+
<time>13:28:31</time>
|
23 |
+
<contents><target name="magecommunity"><dir name="Ambassador"><dir name="Affiliate"><dir name="Model"><file name="Observer.php" hash="b8bb353e129bf09f5eeb6cc9d21a107c"/></dir><dir name="controllers"><file name="AffiliateController.php" hash="675abd910b45ea4320cd30455c36a200"/></dir><dir name="etc"><file name="config.xml" hash="98de110422ad3fe68c234eebba9c401a"/></dir></dir><dir name="Event"><dir name="Model"><file name="Observer.php" hash="6738b87068e51a739fda753645b8a840"/></dir><dir name="controllers"><file name="CallbackController.php" hash="b0c8b2595bace2b5805febf9360545fd"/></dir><dir name="etc"><file name="config.xml" hash="2243df59895e012f99412670ed16039c"/></dir></dir><dir name="Payout"><dir name="controllers"><file name="PayoutController.php" hash="487bb4245152f0f0d584005a3e92d464"/></dir><dir name="etc"><file name="config.xml" hash="23dbf12c8a05edce63499f19087367a1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="ambassador"><dir name="checkout"><file name="ecommerce.phtml" hash="38d66b1e639cd623f3f255aea2e42665"/><file name="img.phtml" hash="93450ac8ed4df0aa33e29c0c58fbb3b2"/></dir><dir name="sso"><file name="affiliate_program.phtml" hash="983bfe455fa6bfb67f78966e9a5d607a"/><file name="sso.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="sso_logout.phtml" hash="0721023e06005ca9d102a3218ca0d32f"/></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="template"><dir name="ambassador"><dir name="checkout"><file name="ecommerce.phtml" hash="38d66b1e639cd623f3f255aea2e42665"/><file name="img.phtml" hash="93450ac8ed4df0aa33e29c0c58fbb3b2"/></dir><dir name="sso"><file name="affiliate_program.phtml" hash="983bfe455fa6bfb67f78966e9a5d607a"/><file name="sso.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="sso_logout.phtml" hash="0721023e06005ca9d102a3218ca0d32f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ambassador_Event.xml" hash="531c19fe928c2fd3b008cf00bc865246"/><file name="Ambassador_Affiliate.xml" hash="806b368fde635b60f5dabad5cfa9e1d8"/><file name="Ambassador_Payout.xml" hash="24f665e03b13562e03b871957e959ae2"/></dir></target></contents>
|
24 |
<compatible/>
|
25 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><extension><name>curl</name><min></min><max></max></extension><extension><name>json</name><min></min><max></max></extension></required></dependencies>
|
26 |
</package>
|