Created
June 12, 2011 05:07
-
-
Save forshariq/1021274 to your computer and use it in GitHub Desktop.
Override Core Modules Mage/Catalog/Block/Product/List.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config> | |
<global> | |
<blocks> | |
<catalog> | |
<rewrite> | |
<product_list>MyCompany_Catalog_Product_List</product_list> | |
</rewrite> | |
</catalog> | |
</blocks> | |
</global> | |
</config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyCompany_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List{ | |
/*override this function*/ | |
protected function _getProductCollection(){ | |
/*Add below line to add existing line of code to display stock in descending order*/ | |
$this->_productCollection = $layer->getProductCollection()->addAttributeToSort('created_at','DESC'); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config> | |
<modules> | |
<MyCompany_Catalog> | |
<active>true</active> | |
<codePool>local</codePool> | |
</MyCompany_Catalog> | |
</modules> | |
</config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a Block missing in config.xml – must be: