Version Notes
Fix tax number export in basket and transaction page
Download this release
Release Info
Developer | Jing Dong |
Extension | QuBit_UniversalVariable |
Version | 1.0.17 |
Comparing to | |
See all releases |
Code changes from version 1.0.16 to 1.0.17
app/code/community/QuBit/UniversalVariable/Model/Page/Observer.php
CHANGED
@@ -374,8 +374,8 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
374 |
}
|
375 |
$basket['currency'] = $this->_getCurrency();
|
376 |
$basket['subtotal'] = (float) $quote->getSubtotal();
|
377 |
-
$basket['
|
378 |
-
$basket['
|
379 |
$basket['shipping_cost'] = (float) $quote->getShippingAmount();
|
380 |
$basket['shipping_method'] = $quote->getShippingMethod();
|
381 |
$basket['total'] = (float) $quote->getGrandTotal();
|
@@ -387,15 +387,15 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
387 |
$this->_basket = $basket;
|
388 |
}
|
389 |
|
390 |
-
public function _doesSubtotalIncludeTax($order) {
|
391 |
/* Conditions:
|
392 |
- if tax is zero, then set to false
|
393 |
- Assume that if grand total is bigger than total after subtracting shipping, then subtotal does NOT include tax
|
394 |
*/
|
395 |
$grandTotalWithoutShipping = $order->getGrandTotal() - $order->getShippingAmount();
|
396 |
-
if ($
|
397 |
return false;
|
398 |
-
} {
|
399 |
return true;
|
400 |
}
|
401 |
}
|
@@ -410,7 +410,8 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
410 |
$transaction['order_id'] = $order->getIncrementId();
|
411 |
$transaction['currency'] = $this->_getCurrency();
|
412 |
$transaction['subtotal'] = (float) $order->getSubtotal();
|
413 |
-
$transaction['
|
|
|
414 |
$transaction['payment_type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
415 |
$transaction['total'] = (float) $order->getGrandTotal();
|
416 |
|
@@ -419,7 +420,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
|
|
419 |
$voucher_discount = -1 * $order->getDiscountAmount();
|
420 |
$transaction['voucher_discount'] = $voucher_discount ? $voucher_discount : 0;
|
421 |
|
422 |
-
|
423 |
$transaction['shipping_cost'] = (float) $order->getShippingAmount();
|
424 |
$transaction['shipping_method'] = $order->getShippingMethod();
|
425 |
|
374 |
}
|
375 |
$basket['currency'] = $this->_getCurrency();
|
376 |
$basket['subtotal'] = (float) $quote->getSubtotal();
|
377 |
+
$basket['tax'] = $quote->getShippingAddress()->getTaxAmount();
|
378 |
+
$basket['subtotal_include_tax'] = $this->_doesSubtotalIncludeTax($quote, $basket['tax']);
|
379 |
$basket['shipping_cost'] = (float) $quote->getShippingAmount();
|
380 |
$basket['shipping_method'] = $quote->getShippingMethod();
|
381 |
$basket['total'] = (float) $quote->getGrandTotal();
|
387 |
$this->_basket = $basket;
|
388 |
}
|
389 |
|
390 |
+
public function _doesSubtotalIncludeTax($order, $tax) {
|
391 |
/* Conditions:
|
392 |
- if tax is zero, then set to false
|
393 |
- Assume that if grand total is bigger than total after subtracting shipping, then subtotal does NOT include tax
|
394 |
*/
|
395 |
$grandTotalWithoutShipping = $order->getGrandTotal() - $order->getShippingAmount();
|
396 |
+
if ($tax == 0 || $grandTotalWithoutShipping > $order->getSubtotal()) {
|
397 |
return false;
|
398 |
+
} else {
|
399 |
return true;
|
400 |
}
|
401 |
}
|
410 |
$transaction['order_id'] = $order->getIncrementId();
|
411 |
$transaction['currency'] = $this->_getCurrency();
|
412 |
$transaction['subtotal'] = (float) $order->getSubtotal();
|
413 |
+
$transaction['tax'] = (float) $order->getTaxAmount();
|
414 |
+
$transaction['subtotal_include_tax'] = $this->_doesSubtotalIncludeTax($order, $transaction['tax']);
|
415 |
$transaction['payment_type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
416 |
$transaction['total'] = (float) $order->getGrandTotal();
|
417 |
|
420 |
$voucher_discount = -1 * $order->getDiscountAmount();
|
421 |
$transaction['voucher_discount'] = $voucher_discount ? $voucher_discount : 0;
|
422 |
|
423 |
+
|
424 |
$transaction['shipping_cost'] = (float) $order->getShippingAmount();
|
425 |
$transaction['shipping_method'] = $order->getShippingMethod();
|
426 |
|
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-
|
18 |
-
<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="
|
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.17</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>Fix tax number export in basket and transaction page</notes>
|
16 |
<authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
|
17 |
+
<date>2013-08-18</date>
|
18 |
+
<time>19:24:58</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="f18f2f340160e3dc302ac7f08147e8ea"/></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>
|