Rayfox_Catalog - Version 0.2.1

Version Notes

Add support to search results.

Download this release

Release Info

Developer Rayfox
Extension Rayfox_Catalog
Version 0.2.1
Comparing to
See all releases


Code changes from version 0.2.0 to 0.2.1

app/code/community/Rayfox/Catalog/Helper/Data.php CHANGED
@@ -9,14 +9,20 @@
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';
 
17
 
18
  public function isSortOutOfStockProductsAtBottomEnabled()
19
  {
20
  return $this->isShowOutOfStock() && Mage::getStoreConfigFlag(self::XML_PATH_SORT_OUT_OF_STOCK);
21
  }
 
 
 
 
 
22
  }
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.1
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';
17
+ const XML_PATH_SORT_OUT_OF_STOCK_SEARCH_RESULT = 'cataloginventory/options/sort_out_of_stock_at_bottom_for_search';
18
 
19
  public function isSortOutOfStockProductsAtBottomEnabled()
20
  {
21
  return $this->isShowOutOfStock() && Mage::getStoreConfigFlag(self::XML_PATH_SORT_OUT_OF_STOCK);
22
  }
23
+
24
+ public function isEnabledForSearchResults()
25
+ {
26
+ return $this->isShowOutOfStock() && Mage::getStoreConfigFlag(self::XML_PATH_SORT_OUT_OF_STOCK_SEARCH_RESULT);
27
+ }
28
  }
app/code/community/Rayfox/Catalog/Model/Layer.php CHANGED
@@ -9,7 +9,7 @@
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
  {
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.1
13
  */
14
  class Rayfox_Catalog_Model_Layer extends Mage_Catalog_Model_Layer
15
  {
app/code/community/Rayfox/Catalog/Model/Search/Layer.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1
13
+ */
14
+ class Rayfox_Catalog_Model_Search_Layer extends Mage_CatalogSearch_Model_Layer
15
+ {
16
+ public function prepareProductCollection($collection)
17
+ {
18
+ parent::prepareProductCollection($collection);
19
+ if(!Mage::helper('rayfox_catalog')->isEnabledForSearchResults()){
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.2.0</version>
32
  </Rayfox_Catalog>
33
  </modules>
34
  <global>
@@ -38,6 +38,11 @@
38
  <layer>Rayfox_Catalog_Model_Layer</layer>
39
  </rewrite>
40
  </catalog>
 
 
 
 
 
41
  </models>
42
  <helpers>
43
  <rayfox_catalog>
28
  <config>
29
  <modules>
30
  <Rayfox_Catalog>
31
+ <version>0.2.1</version>
32
  </Rayfox_Catalog>
33
  </modules>
34
  <global>
38
  <layer>Rayfox_Catalog_Model_Layer</layer>
39
  </rewrite>
40
  </catalog>
41
+ <catalogsearch>
42
+ <rewrite>
43
+ <layer>Rayfox_Catalog_Model_Search_Layer</layer>
44
+ </rewrite>
45
+ </catalogsearch>
46
  </models>
47
  <helpers>
48
  <rayfox_catalog>
app/code/community/Rayfox/Catalog/etc/system.xml CHANGED
@@ -41,6 +41,16 @@
41
  <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  </sort_out_of_stock_at_bottom>
 
 
 
 
 
 
 
 
 
 
44
  </fields>
45
  </options>
46
  </groups>
41
  <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  </sort_out_of_stock_at_bottom>
44
+ <sort_out_of_stock_at_bottom_for_search>
45
+ <label>Enabled for search results</label>
46
+ <frontend_type>select</frontend_type>
47
+ <depends><show_out_of_stock>1</show_out_of_stock></depends>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>1000</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </sort_out_of_stock_at_bottom_for_search>
54
  </fields>
55
  </options>
56
  </groups>
package.xml CHANGED
@@ -1,26 +1,28 @@
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rayfox_Catalog</name>
4
+ <version>0.2.1</version>
5
  <stability>stable</stability>
6
+ <license>OSL v3.0</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 &amp;quot;show out of stock product&amp;quot;, it will be hidden if not allowed display out of stock products.&#xD;
13
+ &lt;p /&gt;&#xD;
14
+ &lt;h3&gt;Features:&lt;/h3&gt;&#xD;
15
+ &lt;ul&gt;&#xD;
16
+ &lt;li&gt; Always show out of stock products on the bottom of the category page. &lt;/li&gt;&#xD;
17
+ &lt;li&gt;Easy setup, just turn on from Magento backend, and it works! &lt;/li&gt;&#xD;
18
+ &lt;li&gt; Configurable settings, it depends on &amp;quot;show out of stock product&amp;quot;, it will be hidden if not allowed display out of stock products. &lt;/li&gt;&#xD;
19
+ &lt;li&gt;Support both configurable and simple products now.&lt;/li&gt;&#xD;
20
+ &lt;/ul&gt;</description>
21
+ <notes>Add support to search results.</notes>
22
+ <authors><author><name>Rayfox</name><user>rayfox</user><email>rayzhang@email.com</email></author></authors>
23
+ <date>2014-10-15</date>
24
+ <time>06:49:30</time>
25
+ <contents><target name="magecommunity"><dir name="Rayfox"><dir name="Catalog"><dir name="Helper"><file name="Data.php" hash="1bf6dd400e723b13c790b4a08bfd7f4d"/></dir><dir name="Model"><file name="Layer.php" hash="f7ae75d4cbe430501bc2fa3188f06850"/><dir name="Search"><file name="Layer.php" hash="0944ffeab2934918b193cee2d0f47431"/></dir><file name=".DS_Store" hash="64ef2c9424e6b3669c041438abea4fdf"/></dir><dir name="etc"><file name="config.xml" hash="d1bb7daa665cc265b31c572cfec8bf8a"/><file name="system.xml" hash="63ef7de3d3bb5b82eb6cdd5be28d5f7d"/></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>
26
  <compatible/>
27
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
28
  </package>