Version Notes
Export guest email on transaction pages
Download this release
Release Info
Developer | Jing Dong |
Extension | QuBit_UniversalVariable |
Version | 1.0.16 |
Comparing to | |
See all releases |
Code changes from version 1.0.15 to 1.0.16
app/code/community/QuBit/UniversalVariable/Model/Page/Observer.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
class QuBit_UniversalVariable_Model_Page_Observer {
|
4 |
|
@@ -73,7 +73,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
73 |
protected function _getOrderAddress() {
|
74 |
return Mage::getModel('sales/order_address');
|
75 |
}
|
76 |
-
|
77 |
|
78 |
/*
|
79 |
* Creates Block View
|
@@ -154,7 +154,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
154 |
// somecheckout systems has different prefix/postfix,
|
155 |
// but all contains checkout
|
156 |
if (strpos($this->_getModuleName(), 'checkout') !== false && $this->_getActionName() == "success") {
|
157 |
-
return true;
|
158 |
} else {
|
159 |
return false;
|
160 |
}
|
@@ -229,21 +229,32 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
229 |
$this->_page['category'] = $this->_getPage();
|
230 |
}
|
231 |
|
232 |
-
// Set the user info
|
233 |
public function _setUser() {
|
234 |
$this->_user = array();
|
235 |
$user = $this->_getCustomer();
|
236 |
-
$email = $user->getEmail();
|
237 |
$user_id = $user->getEntityId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
if ($email) {
|
239 |
-
$this->_user['email'] = $email;
|
240 |
}
|
|
|
241 |
if ($user_id) {
|
242 |
$this->_user['user_id'] = $user_id;
|
243 |
}
|
244 |
$this->_user['returning'] = $user_id ? true : false;
|
245 |
$this->_user['language'] = Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId());;
|
246 |
-
|
247 |
}
|
248 |
|
249 |
public function _getAddress($address) {
|
@@ -289,7 +300,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
289 |
foreach ($cats as $category_id) {
|
290 |
$_cat = $this->_getCategory($category_id);
|
291 |
$category_names[] = $_cat->getName();
|
292 |
-
}
|
293 |
if (is_array($category_names) and !empty($category_names)) {
|
294 |
return implode(', ', $category_names);
|
295 |
} else {
|
@@ -310,8 +321,8 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
310 |
if ($product->isVisibleInSiteVisibility()) {
|
311 |
$litem_model = array();
|
312 |
$litem_model['product'] = $this->_getProductModel($product);
|
313 |
-
|
314 |
-
|
315 |
$litem_model['subtotal'] = (float) $item->getRowTotalInclTax();
|
316 |
$litem_model['total_discount'] = (float) $item->getDiscountAmount();
|
317 |
|
@@ -333,10 +344,10 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
333 |
$category = $this->_getCurrentCategory();
|
334 |
} elseif ($this->_isSearch()) {
|
335 |
$category = $this->_getCatalogSearch();
|
336 |
-
if (isset($_GET['q'])) {
|
337 |
$this->_listing['query'] = $_GET['q'];
|
338 |
}
|
339 |
-
}
|
340 |
}
|
341 |
|
342 |
public function _setProduct() {
|
@@ -346,7 +357,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
346 |
}
|
347 |
|
348 |
public function _setBasket() {
|
349 |
-
// Get from different model depending on page
|
350 |
if ($this->_isBasket()) {
|
351 |
$cart = $this->_getCheckoutCart();
|
352 |
} elseif ($this->_isCheckout()) {
|
@@ -358,7 +369,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
358 |
|
359 |
// Set normal params
|
360 |
$basket_id = $this->_getCheckoutSession()->getQuoteId();
|
361 |
-
if ($basket_id) {
|
362 |
$basket['id'] = $basket_id;
|
363 |
}
|
364 |
$basket['currency'] = $this->_getCurrency();
|
@@ -402,12 +413,12 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
402 |
$transaction['subtotal_include_tax'] = $this->_doesSubtotalIncludeTax($order);
|
403 |
$transaction['payment_type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
404 |
$transaction['total'] = (float) $order->getGrandTotal();
|
405 |
-
|
406 |
$voucher = $order->getCouponCode();
|
407 |
$transaction['voucher'] = $voucher ? $voucher : "";
|
408 |
$voucher_discount = -1 * $order->getDiscountAmount();
|
409 |
$transaction['voucher_discount'] = $voucher_discount ? $voucher_discount : 0;
|
410 |
-
|
411 |
$transaction['tax'] = (float) $order->getTax();
|
412 |
$transaction['shipping_cost'] = (float) $order->getShippingAmount();
|
413 |
$transaction['shipping_method'] = $order->getShippingMethod();
|
@@ -424,7 +435,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
424 |
$items = $order->getAllItems();
|
425 |
$line_items = $this->_getLineItems($items, 'transaction');
|
426 |
$transaction['line_items'] = $line_items;
|
427 |
-
|
428 |
$this->_transaction = $transaction;
|
429 |
}
|
430 |
}
|
@@ -449,7 +460,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
449 |
$this->_setBasket();
|
450 |
}
|
451 |
|
452 |
-
if ($this->_isConfirmation()) {
|
453 |
$this->_setTranscation();
|
454 |
}
|
455 |
|
1 |
+
<?php
|
2 |
|
3 |
class QuBit_UniversalVariable_Model_Page_Observer {
|
4 |
|
73 |
protected function _getOrderAddress() {
|
74 |
return Mage::getModel('sales/order_address');
|
75 |
}
|
76 |
+
|
77 |
|
78 |
/*
|
79 |
* Creates Block View
|
154 |
// somecheckout systems has different prefix/postfix,
|
155 |
// but all contains checkout
|
156 |
if (strpos($this->_getModuleName(), 'checkout') !== false && $this->_getActionName() == "success") {
|
157 |
+
return true;
|
158 |
} else {
|
159 |
return false;
|
160 |
}
|
229 |
$this->_page['category'] = $this->_getPage();
|
230 |
}
|
231 |
|
232 |
+
// Set the user info
|
233 |
public function _setUser() {
|
234 |
$this->_user = array();
|
235 |
$user = $this->_getCustomer();
|
|
|
236 |
$user_id = $user->getEntityId();
|
237 |
+
|
238 |
+
if ($this->_isConfirmation()) {
|
239 |
+
$orderId = $this->_getCheckoutSession()->getLastOrderId();
|
240 |
+
if ($orderId) {
|
241 |
+
$order = $this->_getSalesOrder()->load($orderId);
|
242 |
+
$email = $order->getCustomerEmail();
|
243 |
+
}
|
244 |
+
} else {
|
245 |
+
$email = $user->getEmail();
|
246 |
+
}
|
247 |
+
|
248 |
if ($email) {
|
249 |
+
$this->_user['email'] = $email;
|
250 |
}
|
251 |
+
|
252 |
if ($user_id) {
|
253 |
$this->_user['user_id'] = $user_id;
|
254 |
}
|
255 |
$this->_user['returning'] = $user_id ? true : false;
|
256 |
$this->_user['language'] = Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId());;
|
257 |
+
|
258 |
}
|
259 |
|
260 |
public function _getAddress($address) {
|
300 |
foreach ($cats as $category_id) {
|
301 |
$_cat = $this->_getCategory($category_id);
|
302 |
$category_names[] = $_cat->getName();
|
303 |
+
}
|
304 |
if (is_array($category_names) and !empty($category_names)) {
|
305 |
return implode(', ', $category_names);
|
306 |
} else {
|
321 |
if ($product->isVisibleInSiteVisibility()) {
|
322 |
$litem_model = array();
|
323 |
$litem_model['product'] = $this->_getProductModel($product);
|
324 |
+
|
325 |
+
|
326 |
$litem_model['subtotal'] = (float) $item->getRowTotalInclTax();
|
327 |
$litem_model['total_discount'] = (float) $item->getDiscountAmount();
|
328 |
|
344 |
$category = $this->_getCurrentCategory();
|
345 |
} elseif ($this->_isSearch()) {
|
346 |
$category = $this->_getCatalogSearch();
|
347 |
+
if (isset($_GET['q'])) {
|
348 |
$this->_listing['query'] = $_GET['q'];
|
349 |
}
|
350 |
+
}
|
351 |
}
|
352 |
|
353 |
public function _setProduct() {
|
357 |
}
|
358 |
|
359 |
public function _setBasket() {
|
360 |
+
// Get from different model depending on page
|
361 |
if ($this->_isBasket()) {
|
362 |
$cart = $this->_getCheckoutCart();
|
363 |
} elseif ($this->_isCheckout()) {
|
369 |
|
370 |
// Set normal params
|
371 |
$basket_id = $this->_getCheckoutSession()->getQuoteId();
|
372 |
+
if ($basket_id) {
|
373 |
$basket['id'] = $basket_id;
|
374 |
}
|
375 |
$basket['currency'] = $this->_getCurrency();
|
413 |
$transaction['subtotal_include_tax'] = $this->_doesSubtotalIncludeTax($order);
|
414 |
$transaction['payment_type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
415 |
$transaction['total'] = (float) $order->getGrandTotal();
|
416 |
+
|
417 |
$voucher = $order->getCouponCode();
|
418 |
$transaction['voucher'] = $voucher ? $voucher : "";
|
419 |
$voucher_discount = -1 * $order->getDiscountAmount();
|
420 |
$transaction['voucher_discount'] = $voucher_discount ? $voucher_discount : 0;
|
421 |
+
|
422 |
$transaction['tax'] = (float) $order->getTax();
|
423 |
$transaction['shipping_cost'] = (float) $order->getShippingAmount();
|
424 |
$transaction['shipping_method'] = $order->getShippingMethod();
|
435 |
$items = $order->getAllItems();
|
436 |
$line_items = $this->_getLineItems($items, 'transaction');
|
437 |
$transaction['line_items'] = $line_items;
|
438 |
+
|
439 |
$this->_transaction = $transaction;
|
440 |
}
|
441 |
}
|
460 |
$this->_setBasket();
|
461 |
}
|
462 |
|
463 |
+
if ($this->_isConfirmation()) {
|
464 |
$this->_setTranscation();
|
465 |
}
|
466 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>QuBit_UniversalVariable</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
@@ -12,11 +12,11 @@
|
|
12 |
<description>QuBit OpenTag recommends creating the releavant JavaScript object on your page prior to the OpenTag container script. This will assure the values are present on the page when a script tries to access them.
|
13 |

|
14 |
If a page does not have the variables of an object that are mentioned below, simply do not even declare them. For example, if your pages only have category and no subcategory, just declare your category. Likewise, if you feel the need to extend the objects below or feel like renaming them, please do so. However, please take a note of the new variable names or the edited ones, because in order to access them from your scripts in your OpenTag container, you will need to use the new variable names.</description>
|
15 |
-
<notes>
|
16 |
<authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
|
17 |
-
<date>2013-04-
|
18 |
-
<time>15:
|
19 |
-
<contents><target name="magecommunity"><dir name="QuBit"><dir name="UniversalVariable"><dir name="Block"><file name="Uv.php" hash="9b5cd71bebc9576b5d0714b3fe5c13bb"/></dir><dir name="Helper"><file name="Data.php" hash="b05ea847c16520d5e6eec91e9f604886"/></dir><dir name="Model"><dir name="Page"><file name="Observer.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>QuBit_UniversalVariable</name>
|
4 |
+
<version>1.0.16</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
12 |
<description>QuBit OpenTag recommends creating the releavant JavaScript object on your page prior to the OpenTag container script. This will assure the values are present on the page when a script tries to access them.
|
13 |

|
14 |
If a page does not have the variables of an object that are mentioned below, simply do not even declare them. For example, if your pages only have category and no subcategory, just declare your category. Likewise, if you feel the need to extend the objects below or feel like renaming them, please do so. However, please take a note of the new variable names or the edited ones, because in order to access them from your scripts in your OpenTag container, you will need to use the new variable names.</description>
|
15 |
+
<notes>Export guest email on transaction pages</notes>
|
16 |
<authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
|
17 |
+
<date>2013-04-07</date>
|
18 |
+
<time>15:50:28</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="QuBit"><dir name="UniversalVariable"><dir name="Block"><file name="Uv.php" hash="9b5cd71bebc9576b5d0714b3fe5c13bb"/></dir><dir name="Helper"><file name="Data.php" hash="b05ea847c16520d5e6eec91e9f604886"/></dir><dir name="Model"><dir name="Page"><file name="Observer.php" hash="f43c5df1e18ae37c8c2e9e5bfb05f417"/></dir></dir><dir name="etc"><file name="config.xml" hash="fd936ed3360902482e81d86b6747543c"/><file name="system.xml" hash="944a9a1ca7984eae63f1e2e0800404f9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="qubit"><file name="universal_variable.xml" hash="f568ad884f941850720324d35868c45c"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="67e5965b455c5fc56217d621118ec147"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="2fb177af411fe4b32940867a9448a38b"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|