Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is quite easy to add a sorting by date option if you're OK (you shouldn't be) with modifying core files. Simply modify <strong>app/code/core/Mage/Catalog/Model/Config.php</strong> file as in example below:</p> <pre><code>public function getAttributeUsedForSortByArray() { $options = array( 'position' =&gt; Mage::helper('catalog')-&gt;__('Position'), // HERE IS OUR NEW OPTION 'created_at' =&gt; Mage::helper('catalog')-&gt;__('Date') ); foreach ($this-&gt;getAttributesUsedForSortBy() as $attribute) { /* @var $attribute Mage_Eav_Model_Entity_Attribute_Abstract */ $options[$attribute-&gt;getAttributeCode()] = $attribute-&gt;getStoreLabel(); } return $options; } </code></pre> <hr> <p>It is not so easy, if you are not into modifying core files. In that case you must create this bunch of files:</p> <p><strong>app/etc/modules/Stackoverflow_Catalog.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;modules&gt; &lt;Stackoverflow_Catalog&gt; &lt;active&gt;true&lt;/active&gt; &lt;codePool&gt;local&lt;/codePool&gt; &lt;depends&gt; &lt;Mage_Catalog /&gt; &lt;/depends&gt; &lt;/Stackoverflow_Catalog&gt; &lt;/modules&gt; &lt;/config&gt; </code></pre> <p><strong>app/code/local/Stackoverflow/Catalog/etc/config.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;global&gt; &lt;models&gt; &lt;catalog&gt; &lt;rewrite&gt; &lt;config&gt;Stackoverflow_Catalog_Model_Config&lt;/config&gt; &lt;/rewrite&gt; &lt;/catalog&gt; &lt;/models&gt; &lt;/global&gt; &lt;/config&gt; </code></pre> <p><strong>app/code/local/Stackoverflow/Catalog/Model/Config.php</strong></p> <pre><code>&lt;?php class Stackoverflow_Catalog_Model_Config extends Mage_Catalog_Model_Config { public function getAttributeUsedForSortByArray() { $options = parent::getAttributeUsedForSortByArray(); if (!isset($options['created_at'])) { $options['created_at'] = Mage::helper('catalog')-&gt;__('Date'); } return $options; } } </code></pre> <p>TIP: Go for a clean way, it will pay of in a long run.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload