QuBit_UniversalVariable - Version 1.0.6

Version Notes

address get product details compatibility issue; output system version in universal variable for diagnosing.

Download this release

Release Info

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


Code changes from version 1.0.5 to 1.0.6

app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php CHANGED
@@ -141,8 +141,11 @@ class QuBit_UniversalVariable_Model_Page_Observer {
141
  public function _getLineItems($items) {
142
  $line_items = array();
143
  foreach($items as $item) {
144
- $product = $item->getProduct();
145
- if ($product->isVisibleInSiteVisibility()) {
 
 
 
146
  $litem_model = array();
147
  $litem_model['product'] = $this->_getProductModel($product);
148
  $litem_model['quantity'] = $item->getQty();
@@ -156,8 +159,11 @@ class QuBit_UniversalVariable_Model_Page_Observer {
156
  public function _getInvoicedLineItems($items) {
157
  $line_items = array();
158
  foreach($items as $item) {
159
- $product = $item->getProduct();
160
- if ($product->isVisibleInSiteVisibility()) {
 
 
 
161
  $litem_model = array();
162
  $litem_model['product'] = $this->_getProductModel($product);
163
  $litem_model['quantity'] = (float) $item->getQtyOrdered();
@@ -235,5 +241,9 @@ class QuBit_UniversalVariable_Model_Page_Observer {
235
  public function getListing() {
236
  return $this->_listing;
237
  }
 
 
 
 
238
  }
239
  ?>
141
  public function _getLineItems($items) {
142
  $line_items = array();
143
  foreach($items as $item) {
144
+ // backwards compaibility, getProduct() is not supported in older version
145
+ $productId = $item->getProductId();
146
+ $product = Mage::getModel('catalog/product')->load($productId);
147
+
148
+ if ($product && $product->isVisibleInSiteVisibility()) {
149
  $litem_model = array();
150
  $litem_model['product'] = $this->_getProductModel($product);
151
  $litem_model['quantity'] = $item->getQty();
159
  public function _getInvoicedLineItems($items) {
160
  $line_items = array();
161
  foreach($items as $item) {
162
+ // backwards compaibility, getProduct() is not supported in older version
163
+ $productId = $item->getProductId();
164
+ $product = Mage::getModel('catalog/product')->load($productId);
165
+
166
+ if ($product && $product->isVisibleInSiteVisibility()) {
167
  $litem_model = array();
168
  $litem_model['product'] = $this->_getProductModel($product);
169
  $litem_model['quantity'] = (float) $item->getQtyOrdered();
241
  public function getListing() {
242
  return $this->_listing;
243
  }
244
+
245
+ public function getMageVersion() {
246
+ return Mage::getVersion();
247
+ }
248
  }
249
  ?>
app/design/frontend/default/default/template/qubit/universal_variable.phtml CHANGED
@@ -17,18 +17,20 @@
17
  <?php if ($qubit_universal_variable_enabled == 1):?>
18
  <?php
19
  // extract variable only when universal variable is enabled
20
- $version = $mage->getVersion();
21
- $page = $mage->getPage();
22
- $user = $mage->getUser();
23
- $product = $mage->getProduct();
24
- $basket = $mage->getBasket();
25
- $listing = $mage->getListing();
26
- $transaction = $mage->getTransaction();
 
27
  ?>
28
  <!-- Universal Variable Start -->
29
  <script type="text/javascript">
30
  window.universal_variable = window.universal_variable || {};
31
- window.universal_variable.version = <?php echo json_encode($version) ?>;
 
32
  window.universal_variable.page = <?php echo json_encode($page) ?>;
33
  window.universal_variable.user = <?php echo json_encode($user) ?>;
34
  <?php if ($product) : ?>
17
  <?php if ($qubit_universal_variable_enabled == 1):?>
18
  <?php
19
  // extract variable only when universal variable is enabled
20
+ $version = $mage->getVersion();
21
+ $page = $mage->getPage();
22
+ $user = $mage->getUser();
23
+ $product = $mage->getProduct();
24
+ $basket = $mage->getBasket();
25
+ $listing = $mage->getListing();
26
+ $transaction = $mage->getTransaction();
27
+ $magento_version = $mage->getMageVersion();
28
  ?>
29
  <!-- Universal Variable Start -->
30
  <script type="text/javascript">
31
  window.universal_variable = window.universal_variable || {};
32
+ window.universal_variable.version = <?php echo json_encode($version) ?>;
33
+ window.universal_variable.magento_version = <?php echo json_encode($magento_version) ?>;
34
  window.universal_variable.page = <?php echo json_encode($page) ?>;
35
  window.universal_variable.user = <?php echo json_encode($user) ?>;
36
  <?php if ($product) : ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
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,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>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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>QuBit_UniversalVariable</name>
4
+ <version>1.0.6</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>address get product details compatibility issue; output system version in universal variable for diagnosing.</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
+ <date>2013-01-03</date>
18
+ <time>15:05:57</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="c8df7b3f90641093e4eb6c313f14df9b"/></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="f0d43cc0642c05a7a647042e244fe7e8"/><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>