Rayfox_Catalog - Version 0.1.0

Version Notes

Stable Release

Download this release

Release Info

Developer Ray Zhang
Extension Rayfox_Catalog
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Rayfox/Catalog/.DS_Store ADDED
Binary file
app/code/community/Rayfox/Catalog/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
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';
5
+
6
+ public function isSortOutOfStockProductsAtBottomEnabled()
7
+ {
8
+ return $this->isShowOutOfStock() && Mage::getStoreConfigFlag(self::XML_PATH_SORT_OUT_OF_STOCK);
9
+ }
10
+ }
app/code/community/Rayfox/Catalog/Model/.DS_Store ADDED
Binary file
app/code/community/Rayfox/Catalog/Model/Layer.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
app/code/community/Rayfox/Catalog/etc/config.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Rayfox
23
+ * @package Rayfox_Catalog
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Rayfox_Catalog>
31
+ <version>0.1.0</version>
32
+ </Rayfox_Catalog>
33
+ </modules>
34
+ <global>
35
+ <models>
36
+ <catalog>
37
+ <rewrite>
38
+ <layer>Rayfox_Catalog_Model_Layer</layer>
39
+ </rewrite>
40
+ </catalog>
41
+ </models>
42
+ <helpers>
43
+ <rayfox_catalog>
44
+ <class>Rayfox_Catalog_Helper</class>
45
+ </rayfox_catalog>
46
+ </helpers>
47
+ </global>
48
+ </config>
app/code/community/Rayfox/Catalog/etc/system.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_CatalogInventory
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <sections>
30
+ <cataloginventory>
31
+ <groups>
32
+ <options translate="label">
33
+ <fields>
34
+ <sort_out_of_stock_at_bottom>
35
+ <label>Out of Stock Products At Bottom</label>
36
+ <frontend_type>select</frontend_type>
37
+ <depends><show_out_of_stock>1</show_out_of_stock></depends>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>999</sort_order>
40
+ <show_in_default>1</show_in_default>
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>
47
+ </cataloginventory>
48
+ </sections>
49
+ </config>
50
+
app/etc/modules/Rayfox_Catalog.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Rayfox
23
+ * @package Rayfox_Catalog
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Rayfox_Catalog>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Rayfox_Catalog>
34
+ </modules>
35
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Rayfox_Catalog</name>
4
+ <version>0.1.0</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>2011-12-12</date>
16
+ <time>06:11:53</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="fd41b1df991cdc1e59e08ddf06ae1e8e"/></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.3.6</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>