QuBit_UniversalVariable - Version 1.0.5

Version Notes

verbosely check shipping and billing address, some systems does not have such value

Download this release

Release Info

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


Code changes from version 1.0.4 to 1.0.5

app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php CHANGED
@@ -63,12 +63,14 @@ class QuBit_UniversalVariable_Model_Page_Observer {
63
 
64
  public function _getAddress($address) {
65
  $billing = array();
66
- $billing['name'] = $address->getName();
67
- $billing['address'] = $address->getStreetFull();
68
- $billing['city'] = $address->getCity();
 
 
 
 
69
  // TODO: $billing['state']
70
- $billing['postcode'] = $address->getPostcode();
71
- $billing['country'] = $address->getCountry();
72
  return $billing;
73
  }
74
 
@@ -85,26 +87,24 @@ class QuBit_UniversalVariable_Model_Page_Observer {
85
  $transaction = array();
86
  $order = Mage::getModel('sales/order')->load($orderId);
87
  $items = $order->getAllItems();
88
- $line_items = $this->_getInvoicedLineItems($items);
89
- $shippingId = $order->getShippingAddress()->getId();
90
- $address = Mage::getModel('sales/order_address')->load($shippingId);
91
- $billingAddress = $order->getBillingAddress();
92
  $shippingAddress = $order->getShippingAddress();
 
93
 
94
- $transaction['order_id'] = $order->getIncrementId();
95
- $transaction['currency'] = $this->_getCurrency();
96
- $transaction['subtotal'] = (float) $order->getSubtotal();
97
  // TODO: subtotal_include_tax
98
- $transaction['total'] = (float) $order->getGrandTotal();
99
- $transaction['voucher'] = $order->getCouponCode();
100
  // TODO: voucher_discount
101
- $transaction['tax'] = (float) $order->getTax();
102
- $transaction['shipping_cost'] = (float) $order->getShippingAmount();
103
  $transaction['shipping_method'] = $order->getShippingMethod();
104
- $transaction['billing'] = $this->_getAddress($billingAddress);
105
- $transaction['delivery'] = $this->_getAddress($shippingAddress);
106
- $transaction['line_items'] = $line_items;
107
- $this->_transaction = $transaction;
108
  }
109
  }
110
  }
63
 
64
  public function _getAddress($address) {
65
  $billing = array();
66
+ if ($address) {
67
+ $billing['name'] = $address->getName();
68
+ $billing['address'] = $address->getStreetFull();
69
+ $billing['city'] = $address->getCity();
70
+ $billing['postcode'] = $address->getPostcode();
71
+ $billing['country'] = $address->getCountry();
72
+ }
73
  // TODO: $billing['state']
 
 
74
  return $billing;
75
  }
76
 
87
  $transaction = array();
88
  $order = Mage::getModel('sales/order')->load($orderId);
89
  $items = $order->getAllItems();
90
+ $line_items = $this->_getInvoicedLineItems($items);
 
 
 
91
  $shippingAddress = $order->getShippingAddress();
92
+ $billingAddress = $order->getBillingAddress();
93
 
94
+ $transaction['order_id'] = $order->getIncrementId();
95
+ $transaction['currency'] = $this->_getCurrency();
96
+ $transaction['subtotal'] = (float) $order->getSubtotal();
97
  // TODO: subtotal_include_tax
98
+ $transaction['total'] = (float) $order->getGrandTotal();
99
+ $transaction['voucher'] = $order->getCouponCode();
100
  // TODO: voucher_discount
101
+ $transaction['tax'] = (float) $order->getTax();
102
+ $transaction['shipping_cost'] = (float) $order->getShippingAmount();
103
  $transaction['shipping_method'] = $order->getShippingMethod();
104
+ $transaction['billing'] = $this->_getAddress($billingAddress);
105
+ $transaction['delivery'] = $this->_getAddress($shippingAddress);
106
+ $transaction['line_items'] = $line_items;
107
+ $this->_transaction = $transaction;
108
  }
109
  }
110
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>QuBit_UniversalVariable</name>
4
- <version>1.0.4</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>handle more transaction pages provided by other checkout systems</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
- <date>2012-12-20</date>
18
- <time>11:24:33</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="a824d30801fd1e90e4299b4a13d0fd57"/></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="db054d84a48d9dd833e99eca1d9fc8e0"/><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.5</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>verbosely check shipping and billing address, some systems does not have such value</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
+ <date>2013-01-02</date>
18
+ <time>15:50:17</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="420780c924364678c53beaacd7eafb59"/></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="db054d84a48d9dd833e99eca1d9fc8e0"/><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>