Wmd_Productneworder - Version 1.0.0

Version Notes

This module is rewriting the block


Mage_Catalog_Block_Product_New

Therefore it will not work as expected if you have another extension rewriting that very block. Or the other extension rewriting this block might stop working as it should.


This will only matter, if the other extension is allready affecting 'New Products' list

Download this release

Release Info

Developer Dominik Wyss
Extension Wmd_Productneworder
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Wmd/Productneworder/Block/Catalog/Product/New.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Wmd_Productneworder_Block_Catalog_Product_New
4
+ *
5
+ * WMD Web-Manufaktur/Digiswiss
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that you find at http://wmdextensions.com/WMD-License-Community.txt
10
+ *
11
+ * @category Wmd
12
+ * @package Wmd_Productneworder
13
+ * @author Dominik Wyss <info@wmdextensions.com>
14
+ * @copyright 2011 Dominik Wyss | Digiswiss (http://www.digiswiss.ch)
15
+ * @link http://www.wmdextensions.com/
16
+ * @license http://wmdextensions.com/WMD-License-Community.txt
17
+ */
18
+
19
+ class Wmd_Productneworder_Block_Catalog_Product_New extends Mage_Catalog_Block_Product_New
20
+ {
21
+
22
+ /**
23
+ * Prepare collection with new products and applied page limits.
24
+ *
25
+ * return Mage_Catalog_Block_Product_New
26
+ */
27
+ protected function _beforeToHtml()
28
+ {
29
+
30
+ $collection = Mage::getResourceModel('catalog/product_collection');
31
+ $collection->getSelect()
32
+ ->join(
33
+ array('category_product' => $collection->getTable('catalog/category_product')),
34
+ 'e.entity_id = category_product.product_id',
35
+ array('category_id', 'position')
36
+ )
37
+ ->where('category_product.category_id = ?', Mage::app()->getStore()->getRootCategoryId())
38
+ ->order('category_product.position', 'desc');
39
+
40
+ $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
41
+
42
+ $collection = $this->_addProductAttributesAndPrices($collection)
43
+ ->setPageSize($this->getProductsCount())
44
+ ->setCurPage(1);
45
+
46
+ $this->setProductCollection($collection);
47
+
48
+ }
49
+ }
app/code/community/Wmd/Productneworder/Helper/Data.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Wmd_Productneworder_Helper_Data
4
+ *
5
+ * WMD Web-Manufaktur/Digiswiss
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the EULA
9
+ * that you find at http://wmdextensions.com/WMD-License-Community.txt
10
+ *
11
+ * @category Wmd
12
+ * @package Wmd_Productneworder
13
+ * @author Dominik Wyss <info@wmdextensions.com>
14
+ * @copyright 2011 Dominik Wyss | Digiswiss (http://www.digiswiss.ch)
15
+ * @link http://www.wmdextensions.com/
16
+ * @license http://wmdextensions.com/WMD-License-Community.txt
17
+ */
18
+
19
+ class Wmd_Productneworder_Helper_Data extends Mage_Core_Helper_Abstract
20
+ {
21
+
22
+ }
app/code/community/Wmd/Productneworder/etc/config.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WMD Web-Manufaktur/Digiswiss
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that you find at http://wmdextensions.com/WMD-License-Community.txt
9
+ *
10
+ * @category Wmd
11
+ * @package Wmd_Productneworder
12
+ * @author Dominik Wyss <info@wmdextensions.com>
13
+ * @copyright 2011 Dominik Wyss | Digiswiss (http://www.digiswiss.ch)
14
+ * @link http://wmdextensions.com/
15
+ * @license http://wmdextensions.com/WMD-License-Community.txt
16
+ */
17
+ -->
18
+ <config>
19
+ <modules>
20
+ <Wmd_Productneworder>
21
+ <version>1.0.0</version>
22
+ </Wmd_Productneworder>
23
+ </modules>
24
+ <global>
25
+ <blocks>
26
+ <productneworder>
27
+ <class>Wmd_Productneworder_Block</class>
28
+ </productneworder>
29
+ <catalog>
30
+ <rewrite>
31
+ <product_new>Wmd_Productneworder_Block_Catalog_Product_New</product_new>
32
+ </rewrite>
33
+ </catalog>
34
+ </blocks>
35
+ <helpers>
36
+ <productneworder>
37
+ <class>Wmd_Productneworder_Helper</class>
38
+ </productneworder>
39
+ </helpers>
40
+ </global>
41
+ </config>
app/etc/modules/Wmd_Productneworder.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wmd_Productneworder>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Wmd_Productneworder>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Wmd_Productneworder</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://wmdextensions.com/WMD-License-Community.txt">EULA</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Gain control over 'New Products' by adding them to default category and giving them a position value.</summary>
10
+ <description>&lt;p&gt;This extension is replacing the default behavior of displaying new products on the home or other cms page by 'Set Product as New from Date', 'Set Product as New to Date' values being parsed to determine existence and order of the product in the list.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;After the installation of this extension you can add the products you want to have on the 'New Products' list to the default category and give it a position value there.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;Removing the product from the default category products list will remove it from the 'New Products' list again.&lt;/p&gt;&#xD;
13
+ </description>
14
+ <notes>&lt;p&gt;This module is rewriting the block&lt;/p&gt;&#xD;
15
+ &lt;p&gt;Mage_Catalog_Block_Product_New&lt;/p&gt; &lt;p&gt;Therefore it will not work as expected if you have another extension rewriting that very block. Or the other extension rewriting this block might stop working as it should.&lt;/p&gt;&#xD;
16
+ &lt;p&gt;This will only matter, if the other extension is allready affecting 'New Products' list&lt;/p&gt;</notes>
17
+ <authors><author><name>Dominik Wyss</name><user>justanother</user><email>info@digiswiss.ch</email></author></authors>
18
+ <date>2012-11-11</date>
19
+ <time>16:09:25</time>
20
+ <contents><target name="magecommunity"><dir name="Wmd"><dir name="Productneworder"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="New.php" hash="4eb56e25ba8d546513e0a904bebb8da4"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="752139650947ba2424e34426ca597888"/></dir><dir name="etc"><file name="config.xml" hash="7fd8acc523d2d90791603a7c6a4f377e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wmd_Productneworder.xml" hash="3f6ce516918cf92e31e7af5405145a24"/></dir></target></contents>
21
+ <compatible/>
22
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
+ </package>