Rayfox_Catalog - Version 0.2.0

Version Notes

Bug fix

Download this release

Release Info

Developer Ray
Extension Rayfox_Catalog
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.1 to 0.2.0

app/code/community/Rayfox/Catalog/Helper/Data.php CHANGED
@@ -1,4 +1,16 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Rayfox_Catalog_Helper_Data extends Mage_CatalogInventory_Helper_Data
3
  {
4
  const XML_PATH_SORT_OUT_OF_STOCK = 'cataloginventory/options/sort_out_of_stock_at_bottom';
1
  <?php
2
+ /**
3
+ * Sort products by stock status.
4
+ *
5
+ * Features:
6
+ * 1. Always show out of stock products on the bottom of the category page.
7
+ * 2. Easy setup, just turn on from Magento backend, and it works!
8
+ * 2. Configurable settings, it depends on "show out of stock product", it will be hidden if not allowed display out of stock products.
9
+ * 3. Support both configurable and simple products now.
10
+ * This source file is subject to the Open Software License (OSL 3.0)
11
+ *
12
+ * @version 0.2.0
13
+ */
14
  class Rayfox_Catalog_Helper_Data extends Mage_CatalogInventory_Helper_Data
15
  {
16
  const XML_PATH_SORT_OUT_OF_STOCK = 'cataloginventory/options/sort_out_of_stock_at_bottom';
app/code/community/Rayfox/Catalog/Model/Layer.php CHANGED
@@ -1,23 +1,35 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Rayfox_Catalog_Model_Layer extends Mage_Catalog_Model_Layer
3
  {
4
  public function prepareProductCollection($collection)
5
  {
6
- //call parent prepareProductCollection
7
  parent::prepareProductCollection($collection);
8
-
9
- //check enabled
10
  if(!Mage::helper('rayfox_catalog')->isSortOutOfStockProductsAtBottomEnabled()){
11
  return $this;
12
  }
13
-
14
- //sort by stock status
15
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
16
- Mage::getModel('cataloginventory/stock_item')->addCatalogInventoryToProductCollection($collection);
 
 
 
 
 
 
17
  }
18
-
19
- $collection->getSelect()->order('is_in_stock desc');
20
-
21
  return $this;
22
  }
23
  }
1
  <?php
2
+ /**
3
+ * Sort products by stock status.
4
+ *
5
+ * Features:
6
+ * 1. Always show out of stock products on the bottom of the category page.
7
+ * 2. Easy setup, just turn on from Magento backend, and it works!
8
+ * 2. Configurable settings, it depends on "show out of stock product", it will be hidden if not allowed display out of stock products.
9
+ * 3. Support both configurable and simple products now.
10
+ * This source file is subject to the Open Software License (OSL 3.0)
11
+ *
12
+ * @version 0.2.0
13
+ */
14
  class Rayfox_Catalog_Model_Layer extends Mage_Catalog_Model_Layer
15
  {
16
  public function prepareProductCollection($collection)
17
  {
 
18
  parent::prepareProductCollection($collection);
 
 
19
  if(!Mage::helper('rayfox_catalog')->isSortOutOfStockProductsAtBottomEnabled()){
20
  return $this;
21
  }
22
+ $websiteId = Mage::app()->getStore()->getWebsiteId();
 
23
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
24
+ $collection->joinTable(
25
+ array('cisi' => 'cataloginventory/stock_status'),
26
+ 'product_id=entity_id',
27
+ 'stock_status',
28
+ array('website_id'=> $websiteId),
29
+ 'left'
30
+ );
31
  }
32
+ $collection->getSelect()->order('stock_status desc');
 
 
33
  return $this;
34
  }
35
  }
app/code/community/Rayfox/Catalog/etc/config.xml CHANGED
@@ -28,7 +28,7 @@
28
  <config>
29
  <modules>
30
  <Rayfox_Catalog>
31
- <version>0.1.0</version>
32
  </Rayfox_Catalog>
33
  </modules>
34
  <global>
28
  <config>
29
  <modules>
30
  <Rayfox_Catalog>
31
+ <version>0.2.0</version>
32
  </Rayfox_Catalog>
33
  </modules>
34
  <global>
package.xml CHANGED
@@ -1,20 +1,26 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rayfox_Catalog</name>
4
- <version>0.1.1</version>
5
  <stability>stable</stability>
6
- <license>AFL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Sort products by stock status, move all out of stock products to the bottom.&#xD;
10
- You can select use or not use it at admin configuration. </summary>
11
- <description>Sort products by stock status, move all out of stock products to the bottom.&#xD;
12
- You can select use or not use it at admin configuration. </description>
13
- <notes>Stable Release</notes>
14
- <authors><author><name>Ray Zhang</name><user>Ray</user><email>cgzhang@gmail.com</email></author></authors>
15
- <date>2012-03-22</date>
16
- <time>01:48:49</time>
17
- <contents><target name="magecommunity"><dir name="Rayfox"><dir name="Catalog"><dir name="Helper"><file name="Data.php" hash="0a89c4bf7899290d87712d91bd420c3d"/></dir><dir name="Model"><file name="Layer.php" hash="8c9b3f7d46d5f3a8a79f2dd093bb03d5"/><file name=".DS_Store" hash="64ef2c9424e6b3669c041438abea4fdf"/></dir><dir name="etc"><file name="config.xml" hash="368e9984a7bd7c65b63f8152c1cfe8ef"/><file name="system.xml" hash="d11f439589df04a71e8eb8ef047978b1"/></dir><file name=".DS_Store" hash="ce6e6b7b4d09237a2e3c9362b3b30466"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rayfox_Catalog.xml" hash="45279cdc4ceec7308127aae41ec7badd"/></dir></target></contents>
 
 
 
 
 
 
18
  <compatible/>
19
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rayfox_Catalog</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>This extension will move all out of stock products to the bottom of the category product list page.</summary>
10
+ <description> If you want to show out of stock products but don't want them to on the top of your product list page, this extension can help you.&#xD;
11
+ You only need to switch it on on Magento configuration and it will move all out of stock products to the bottom of the product list page.&#xD;
12
+ The configuration depends on "show out of stock product", it will be hidden if not allowed display out of stock products.&#xD;
13
+ &#xD;
14
+ * Features:&#xD;
15
+ * 1. Always show out of stock products on the bottom of the category page.&#xD;
16
+ * 2. Easy setup, just turn on from Magento backend, and it works!&#xD;
17
+ * 2. Configurable settings, it depends on "show out of stock product", it will be hidden if not allowed display out of stock products.&#xD;
18
+ * 3. Support both configurable and simple products now.</description>
19
+ <notes>Bug fix </notes>
20
+ <authors><author><name>Rayfox</name><user>cgzhang</user><email>rayzhang@email.com</email></author></authors>
21
+ <date>2014-05-23</date>
22
+ <time>07:24:48</time>
23
+ <contents><target name="magecommunity"><dir name="Rayfox"><dir name="Catalog"><dir name="Helper"><file name="Data.php" hash="a699208745efe63c665f6e5003f067d3"/></dir><dir name="Model"><file name="Layer.php" hash="2b189c52b61a8670e3af22c927849747"/><file name=".DS_Store" hash="64ef2c9424e6b3669c041438abea4fdf"/></dir><dir name="etc"><file name="config.xml" hash="85df6c44a10e295f65f3bca681f7654a"/><file name="system.xml" hash="d11f439589df04a71e8eb8ef047978b1"/></dir><file name=".DS_Store" hash="ce6e6b7b4d09237a2e3c9362b3b30466"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rayfox_Catalog.xml" hash="45279cdc4ceec7308127aae41ec7badd"/></dir></target></contents>
24
  <compatible/>
25
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
26
  </package>