QuBit_UniversalVariable - Version 1.0.22

Version Notes

Fix #39: when shipping method is not provided, export as empty string instead of null.

Download this release

Release Info

Developer Jing Dong
Extension QuBit_UniversalVariable
Version 1.0.22
Comparing to
See all releases


Code changes from version 1.0.21 to 1.0.22

app/code/community/QuBit/UniversalVariable/Model/Page/Observer.php CHANGED
@@ -282,7 +282,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
282
  return $billing;
283
  }
284
 
285
- public function _getProuctStock($product) {
286
  return (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
287
  }
288
 
@@ -300,7 +300,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
300
  $product_model['unit_sale_price'] = (float) $product->getFinalPrice();
301
  $product_model['currency'] = $this->_getCurrency();
302
  $product_model['description'] = strip_tags($product->getShortDescription());
303
- $product_model['stock'] = (int) $this->_getProuctStock($product);
304
 
305
  $categories = $this->_getProductCategories($product);
306
  if (isset($categories[0])) {
@@ -398,7 +398,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
398
  $basket['tax'] = (float) $quote->getShippingAddress()->getTaxAmount();
399
  $basket['subtotal_include_tax'] = (boolean) $this->_doesSubtotalIncludeTax($quote, $basket['tax']);
400
  $basket['shipping_cost'] = (float) $quote->getShippingAmount();
401
- $basket['shipping_method'] = $quote->getShippingMethod();
402
  $basket['total'] = (float) $quote->getGrandTotal();
403
 
404
  // Line items
@@ -421,6 +421,11 @@ class QuBit_UniversalVariable_Model_Page_Observer {
421
  }
422
  }
423
 
 
 
 
 
 
424
  public function _setTranscation() {
425
  $orderId = $this->_getCheckoutSession()->getLastOrderId();
426
  if ($orderId) {
@@ -443,7 +448,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
443
 
444
 
445
  $transaction['shipping_cost'] = (float) $order->getShippingAmount();
446
- $transaction['shipping_method'] = $order->getShippingMethod();
447
 
448
  // Get addresses
449
  $shippingId = $order->getShippingAddress()->getId();
282
  return $billing;
283
  }
284
 
285
+ public function _getProductStock($product) {
286
  return (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
287
  }
288
 
300
  $product_model['unit_sale_price'] = (float) $product->getFinalPrice();
301
  $product_model['currency'] = $this->_getCurrency();
302
  $product_model['description'] = strip_tags($product->getShortDescription());
303
+ $product_model['stock'] = (int) $this->_getProductStock($product);
304
 
305
  $categories = $this->_getProductCategories($product);
306
  if (isset($categories[0])) {
398
  $basket['tax'] = (float) $quote->getShippingAddress()->getTaxAmount();
399
  $basket['subtotal_include_tax'] = (boolean) $this->_doesSubtotalIncludeTax($quote, $basket['tax']);
400
  $basket['shipping_cost'] = (float) $quote->getShippingAmount();
401
+ $basket['shipping_method'] = $this->_extractShippingMethod($quote);
402
  $basket['total'] = (float) $quote->getGrandTotal();
403
 
404
  // Line items
421
  }
422
  }
423
 
424
+ public function _extractShippingMethod($order) {
425
+ $shipping_method = $order->getShippingMethod();
426
+ return $shipping_method ? $shipping_method : '';
427
+ }
428
+
429
  public function _setTranscation() {
430
  $orderId = $this->_getCheckoutSession()->getLastOrderId();
431
  if ($orderId) {
448
 
449
 
450
  $transaction['shipping_cost'] = (float) $order->getShippingAmount();
451
+ $transaction['shipping_method'] = $this->_extractShippingMethod($order);
452
 
453
  // Get addresses
454
  $shippingId = $order->getShippingAddress()->getId();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>QuBit_UniversalVariable</name>
4
- <version>1.0.21</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,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.&#xD;
13
  &#xD;
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>* Apply voucher discount on top of product unit_sale_price. GitHub issue #35</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
- <date>2014-04-07</date>
18
- <time>16:23:59</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="ba0227af39ad69cc95c25ee81a24bb5b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35f6ea94bc8984d18119a6fc5e63ec9f"/><file name="config.xml" hash="fa918eeac4d6e2b9692642b23789d7c8"/><file name="system.xml" hash="26e9e0d4d1559c8c5fbb69fe707e43a3"/></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="d492e66356dadf46ead546118d8b91ac"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="1775b4ca50c1df8e9542dd2c7bcd14f1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="a0b70506c32aeeb4198d59d86a019ec9"/></dir></target></contents>
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.22</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.&#xD;
13
  &#xD;
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 #39: when shipping method is not provided, export as empty string instead of null.</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
+ <date>2014-04-24</date>
18
+ <time>09:37:36</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="310b8798c401a6d313754841389493e3"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35f6ea94bc8984d18119a6fc5e63ec9f"/><file name="config.xml" hash="fa918eeac4d6e2b9692642b23789d7c8"/><file name="system.xml" hash="26e9e0d4d1559c8c5fbb69fe707e43a3"/></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="d492e66356dadf46ead546118d8b91ac"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="1775b4ca50c1df8e9542dd2c7bcd14f1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="a0b70506c32aeeb4198d59d86a019ec9"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>