QuBit_UniversalVariable - Version 1.0.11

Version Notes

Deprecated `listing` variable on category pages, because it loops all the products without pagination; only output `listing.query` in search result that contains search queries.

Download this release

Release Info

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


Code changes from version 1.0.10 to 1.0.11

app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php CHANGED
@@ -323,24 +323,12 @@ class QuBit_UniversalVariable_Model_Page_Observer {
323
  $this->_listing = array();
324
  if ($this->_isCategory()) {
325
  $category = $this->_getCurrentCategory();
326
-
327
  } elseif ($this->_isSearch()) {
328
  $category = $this->_getCatalogSearch();
329
  if (isset($_GET['q'])) {
330
  $this->_listing['query'] = $_GET['q'];
331
  }
332
  }
333
- $collection = $category->getProductCollection();
334
- $products = array();
335
- foreach ($collection as $item) {
336
- $productId = $item->getId();
337
- $product = $this->_getProduct($productId);
338
- // only expose visible product
339
- if ($product->isVisibleInSiteVisibility()) {
340
- array_push($products, $this->_getProductModel($product));
341
- }
342
- }
343
- $this->_listing['items'] = $products;
344
  }
345
 
346
  public function _setProduct() {
323
  $this->_listing = array();
324
  if ($this->_isCategory()) {
325
  $category = $this->_getCurrentCategory();
 
326
  } elseif ($this->_isSearch()) {
327
  $category = $this->_getCatalogSearch();
328
  if (isset($_GET['q'])) {
329
  $this->_listing['query'] = $_GET['q'];
330
  }
331
  }
 
 
 
 
 
 
 
 
 
 
 
332
  }
333
 
334
  public function _setProduct() {
app/design/frontend/default/default/template/qubit/universal_variable.phtml CHANGED
@@ -33,18 +33,18 @@
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) :?>
37
- window.universal_variable.product = <?php echo json_encode($product) ?>;
38
  <?php endif; ?>
39
- <?php if ($basket) :?>
40
- window.universal_variable.basket = <?php echo json_encode($basket) ?>;
41
  <?php endif; ?>
42
- <?php if ($listing) :?>
43
- window.universal_variable.listing = <?php echo json_encode($listing) ?>;
44
- <?php endif; ?>
45
- <?php if ($transaction) :?>
46
- window.universal_variable.transaction = <?php echo json_encode($transaction) ?>;
47
  <?php endif; ?>
 
 
 
48
  </script>
49
  <!-- Universal Variable End -->
50
  <?php endif;?>
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) : ?>
37
+ window.universal_variable.product = <?php echo json_encode($product) ?>;
38
  <?php endif; ?>
39
+ <?if ($basket) : ?>
40
+ window.universal_variable.basket = <?php echo json_encode($basket) ?>;
41
  <?php endif; ?>
42
+ <?php if ($listing): ?>
43
+ window.universal_variable.listing = <?php echo json_encode($listing) ?>;
 
 
 
44
  <?php endif; ?>
45
+ <?php if ($transaction): ?>
46
+ window.universal_variable.transaction = <?php echo json_encode($transaction) ?>;
47
+ <?php endif; ?>
48
  </script>
49
  <!-- Universal Variable End -->
50
  <?php endif;?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>QuBit_UniversalVariable</name>
4
- <version>1.0.10</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>when voucher code is not used, use empty string intead of null</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
- <date>2013-01-24</date>
18
- <time>16:44:47</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="e90884de6ce32e2d719dadfe042e466e"/></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="a335515fd0cf17010f281246ae884821"/><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.11</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>Deprecated `listing` variable on category pages, because it loops all the products without pagination; only output `listing.query` in search result that contains search queries.</notes>
16
  <authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
17
+ <date>2013-01-30</date>
18
+ <time>11:05:16</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="a3ff35ccc43874a92c1b38b81ad4f7d1"/></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="e3447f28b40796085ee2febb15da6fef"/><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>