QuBit_UniversalVariable - Version 1.0.14

Version Notes

Corrected line_item quantity for non-transaction pages

Download this release

Release Info

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


Code changes from version 1.0.13 to 1.0.14

app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php CHANGED
@@ -301,7 +301,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
301
  }
302
 
303
 
304
- public function _getLineItems($items) {
305
  $line_items = array();
306
  foreach($items as $item) {
307
  $productId = $item->getProductId();
@@ -310,9 +310,17 @@ class QuBit_UniversalVariable_Model_Page_Observer {
310
  if ($product->isVisibleInSiteVisibility()) {
311
  $litem_model = array();
312
  $litem_model['product'] = $this->_getProductModel($product);
313
- $litem_model['quantity'] = (float) $item->getQtyOrdered();
 
314
  $litem_model['subtotal'] = (float) $item->getRowTotalInclTax();
315
  $litem_model['total_discount'] = (float) $item->getDiscountAmount();
 
 
 
 
 
 
 
316
  array_push($line_items, $litem_model);
317
  }
318
  }
@@ -363,7 +371,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
363
 
364
  // Line items
365
  $items = $quote->getAllItems();
366
- $basket['line_items'] = $this->_getLineItems($items);
367
 
368
  $this->_basket = $basket;
369
  }
@@ -414,7 +422,7 @@ class QuBit_UniversalVariable_Model_Page_Observer {
414
 
415
  // Get items
416
  $items = $order->getAllItems();
417
- $line_items = $this->_getLineItems($items);
418
  $transaction['line_items'] = $line_items;
419
 
420
  $this->_transaction = $transaction;
301
  }
302
 
303
 
304
+ public function _getLineItems($items, $page_type) {
305
  $line_items = array();
306
  foreach($items as $item) {
307
  $productId = $item->getProductId();
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
+
318
+ if ($page_type == 'basket') {
319
+ $litem_model['quantity'] = (float) $item->getQty();
320
+ } else {
321
+ $litem_model['quantity'] = (float) $item->getQtyOrdered();
322
+ }
323
+
324
  array_push($line_items, $litem_model);
325
  }
326
  }
371
 
372
  // Line items
373
  $items = $quote->getAllItems();
374
+ $basket['line_items'] = $this->_getLineItems($items, 'basket');
375
 
376
  $this->_basket = $basket;
377
  }
422
 
423
  // Get items
424
  $items = $order->getAllItems();
425
+ $line_items = $this->_getLineItems($items, 'transaction');
426
  $transaction['line_items'] = $line_items;
427
 
428
  $this->_transaction = $transaction;
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>QuBit_UniversalVariable</name>
4
- <version>1.0.13</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>Added `voucher_discount` in transaction</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
- <date>2013-02-12</date>
18
- <time>11:42:54</time>
19
- <contents><target name="magelocal"><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="a72392c9b0d2d4006166d94dd68de78d"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="fd936ed3360902482e81d86b6747543c"/><file name="system.xml" hash="944a9a1ca7984eae63f1e2e0800404f9"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="qubit"><file name="universal_variable.xml" hash="f568ad884f941850720324d35868c45c"/><file name=".DS_Store" hash="2632898af4a7dd21eb81072ff8eb1f04"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="67e5965b455c5fc56217d621118ec147"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="549545c1cf35f87658a129ad5093d13f"/></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.14</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>Corrected line_item quantity for non-transaction pages</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
+ <date>2013-03-13</date>
18
+ <time>18:34:37</time>
19
+ <contents><target name="magelocal"><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="42062ddc831ce37cc3958ea818969fef"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="fd936ed3360902482e81d86b6747543c"/><file name="system.xml" hash="944a9a1ca7984eae63f1e2e0800404f9"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="qubit"><file name="universal_variable.xml" hash="f568ad884f941850720324d35868c45c"/><file name=".DS_Store" hash="2632898af4a7dd21eb81072ff8eb1f04"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="67e5965b455c5fc56217d621118ec147"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="549545c1cf35f87658a129ad5093d13f"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>