Version Notes
1.0.1 - Added uninstall file
1.0.0 - First stable release
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Magmodules_Sortbydate |
| Version | 1.5.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.1 to 1.5.0
- app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Button.php +61 -0
- app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Status.php +47 -0
- app/code/local/Magmodules/Sortbydate/{uninstall-sortbydate.php → Helper/Data.php} +7 -21
- app/code/local/Magmodules/Sortbydate/Model/System/Config/Source/Sorting.php +32 -0
- app/code/local/Magmodules/Sortbydate/controllers/Adminhtml/UpdatesortController.php +54 -0
- app/code/local/Magmodules/Sortbydate/etc/adminhtml.xml +54 -0
- app/code/local/Magmodules/Sortbydate/etc/config.xml +34 -12
- app/code/local/Magmodules/Sortbydate/etc/system.xml +91 -0
- app/code/local/Magmodules/Sortbydate/sql/sortbydate_setup/mysql4-install-0.1.0.php +1 -1
- app/design/frontend/base/default/layout/magmodules_sortbydate.xml +13 -0
- app/locale/en_US/Magmodules_Sortbydate.csv +1 -1
- app/locale/nl_NL/Magmodules_Sortbydate.csv +1 -1
- package.xml +6 -6
app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Button.php
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magmodules.eu
|
| 4 |
+
* http://www.magmodules.eu
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-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 info@magmodules.eu so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Magmodules
|
| 17 |
+
* @package Magmodules_Sortbydate
|
| 18 |
+
* @author Magmodules <info@magmodules.eu)
|
| 19 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class Magmodules_Sortbydate_Block_Adminhtml_Render_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
// CHECK IF ATTRIBUTE EXISTS
|
| 30 |
+
$eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
|
| 31 |
+
$attribute_id = $eavAttribute->getIdByCode('catalog_product', 'created_at');
|
| 32 |
+
|
| 33 |
+
if($attribute_id) {
|
| 34 |
+
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
|
| 35 |
+
$sort = $attributeModel['used_for_sort_by'];
|
| 36 |
+
if($sort) {
|
| 37 |
+
$installed = '1';
|
| 38 |
+
$url = $this->getUrl('*/updatesort/index');
|
| 39 |
+
$button_title = Mage::helper('sortbydate')->__('Remove as listing option');
|
| 40 |
+
} else {
|
| 41 |
+
$installed = '0';
|
| 42 |
+
$url = $this->getUrl('*/updatesort/index');
|
| 43 |
+
$button_title = Mage::helper('sortbydate')->__('Add as listing option');
|
| 44 |
+
}
|
| 45 |
+
} else {
|
| 46 |
+
$installed = '0';
|
| 47 |
+
$url = $this->getUrl('*/updatesort/index');
|
| 48 |
+
$button_title = Mage::helper('sortbydate')->__('Add as listing option');
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
$this->setElement($element);
|
| 52 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
| 53 |
+
->setType('button')
|
| 54 |
+
->setClass('scalable')
|
| 55 |
+
->setLabel($button_title)
|
| 56 |
+
->setOnClick("setLocation('$url')")
|
| 57 |
+
->toHtml();
|
| 58 |
+
|
| 59 |
+
return $html;
|
| 60 |
+
}
|
| 61 |
+
}
|
app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Status.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magmodules.eu
|
| 4 |
+
* http://www.magmodules.eu
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-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 info@magmodules.eu so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Magmodules
|
| 17 |
+
* @package Magmodules_Sortbydate
|
| 18 |
+
* @author Magmodules <info@magmodules.eu)
|
| 19 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class Magmodules_Sortbydate_Block_Adminhtml_Render_Status extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
// CHECK IF ATTRIBUTE EXISTS
|
| 30 |
+
$eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
|
| 31 |
+
$attribute_id = $eavAttribute->getIdByCode('catalog_product', 'created_at');
|
| 32 |
+
|
| 33 |
+
if($attribute_id) {
|
| 34 |
+
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
|
| 35 |
+
$sort = $attributeModel['used_for_sort_by'];
|
| 36 |
+
if($sort) {
|
| 37 |
+
$html = '<strong>' . Mage::helper('sortbydate')->__('Installed!') . '</strong>';
|
| 38 |
+
} else {
|
| 39 |
+
$html = '<strong>' . Mage::helper('sortbydate')->__('Not Installed') . '</strong>';
|
| 40 |
+
}
|
| 41 |
+
} else {
|
| 42 |
+
$html = '<strong>' . Mage::helper('sortbydate')->__('Not Installed') . '</strong>';
|
| 43 |
+
}
|
| 44 |
+
return $html;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
}
|
app/code/local/Magmodules/Sortbydate/{uninstall-sortbydate.php → Helper/Data.php}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<?php
|
| 2 |
/**
|
| 3 |
* Magmodules.eu
|
| 4 |
* http://www.magmodules.eu
|
|
@@ -16,25 +16,11 @@
|
|
| 16 |
* @category Magmodules
|
| 17 |
* @package Magmodules_Sortbydate
|
| 18 |
* @author Magmodules <info@magmodules.eu)
|
| 19 |
-
* @copyright Copyright (c)
|
| 20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
*/
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
// Load attribute_id of created_at
|
| 28 |
-
$eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
|
| 29 |
-
$attribute_id = $eavAttribute->getIdByCode('catalog_product', 'created_at');
|
| 30 |
-
|
| 31 |
-
// Update database
|
| 32 |
-
if($attribute_id) {
|
| 33 |
-
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 34 |
-
$sql = "UPDATE catalog_eav_attribute SET used_for_sort_by = 1 WHERE attribute_id = '$attribute_id' LIMIT 1";
|
| 35 |
-
$write->query($sql);
|
| 36 |
-
echo 'Uninstalled!';
|
| 37 |
-
} else {
|
| 38 |
-
echo 'Error!';
|
| 39 |
-
}
|
| 40 |
-
?>
|
| 1 |
+
<?php
|
| 2 |
/**
|
| 3 |
* Magmodules.eu
|
| 4 |
* http://www.magmodules.eu
|
| 16 |
* @category Magmodules
|
| 17 |
* @package Magmodules_Sortbydate
|
| 18 |
* @author Magmodules <info@magmodules.eu)
|
| 19 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
*/
|
| 22 |
+
|
| 23 |
+
class Magmodules_Sortbydate_Helper_Data extends Mage_Core_Helper_Abstract
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Magmodules/Sortbydate/Model/System/Config/Source/Sorting.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magmodules.eu
|
| 4 |
+
* http://www.magmodules.eu
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-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 info@magmodules.eu so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Magmodules
|
| 17 |
+
* @package Magmodules_Sortbydate
|
| 18 |
+
* @author Magmodules <info@magmodules.eu)
|
| 19 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class Magmodules_Sortbydate_Model_System_Config_Source_Sorting
|
| 24 |
+
{
|
| 25 |
+
public function toOptionArray()
|
| 26 |
+
{
|
| 27 |
+
$sorting = array();
|
| 28 |
+
$sorting[] = array('value'=>'', 'label'=> Mage::helper('sortbydate')->__('Default'));
|
| 29 |
+
$sorting[] = array('value'=>'1', 'label'=> Mage::helper('sortbydate')->__('Newest First'));
|
| 30 |
+
return $sorting;
|
| 31 |
+
}
|
| 32 |
+
}
|
app/code/local/Magmodules/Sortbydate/controllers/Adminhtml/UpdatesortController.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magmodules.eu
|
| 4 |
+
* http://www.magmodules.eu
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-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 info@magmodules.eu so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Magmodules
|
| 17 |
+
* @package Magmodules_Sortbydate
|
| 18 |
+
* @author Magmodules <info@magmodules.eu)
|
| 19 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class Magmodules_Sortbydate_Adminhtml_UpdatesortController extends Mage_Adminhtml_Controller_Action
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
public function indexAction()
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
// CHECK IF ATTRIBUTE EXISTS
|
| 30 |
+
$eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
|
| 31 |
+
$attribute_id = $eavAttribute->getIdByCode('catalog_product', 'created_at');
|
| 32 |
+
|
| 33 |
+
if($attribute_id) {
|
| 34 |
+
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
|
| 35 |
+
$sort = $attributeModel['used_for_sort_by'];
|
| 36 |
+
$id = $attributeModel['attribute_id'];
|
| 37 |
+
if($sort) {
|
| 38 |
+
$attributeModel->setUsedForSortBy(0);
|
| 39 |
+
$attributeModel->save();
|
| 40 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been removed as listing option'));
|
| 41 |
+
} else {
|
| 42 |
+
$attributeModel->setUsedForSortBy(1);
|
| 43 |
+
$attributeModel->save();
|
| 44 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been added to the listing options'));
|
| 45 |
+
}
|
| 46 |
+
} else {
|
| 47 |
+
$installed = '0';
|
| 48 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been added to the listing options'));
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
$this->_redirect('adminhtml/system_config/edit/section/sortbydate');
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
}
|
app/code/local/Magmodules/Sortbydate/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magmodules.eu
|
| 5 |
+
* http://www.magmodules.eu
|
| 6 |
+
*
|
| 7 |
+
* NOTICE OF LICENSE
|
| 8 |
+
*
|
| 9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 11 |
+
* It is also available through the world-wide-web at this URL:
|
| 12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 13 |
+
* If you did not receive a copy of the license and are unable to
|
| 14 |
+
* obtain it through the world-wide-web, please send an email
|
| 15 |
+
* to info@magmodules.eu so we can send you a copy immediately.
|
| 16 |
+
*
|
| 17 |
+
* @category Magmodules
|
| 18 |
+
* @package Magmodules_Sortbydate
|
| 19 |
+
* @author Magmodules <info@magmodules.eu)
|
| 20 |
+
* @copyright Copyright (c) 2013 (http://www.magmodules.eu)
|
| 21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 22 |
+
*/
|
| 23 |
+
-->
|
| 24 |
+
<config>
|
| 25 |
+
<acl>
|
| 26 |
+
<resources>
|
| 27 |
+
<admin>
|
| 28 |
+
<children>
|
| 29 |
+
<updatesort translate="title" module="sortbydate">
|
| 30 |
+
<title>Sort By Date</title>
|
| 31 |
+
<sort_order>-100</sort_order>
|
| 32 |
+
<children>
|
| 33 |
+
<index translate="title">
|
| 34 |
+
<title>Index Action</title>
|
| 35 |
+
<sort_order>1</sort_order>
|
| 36 |
+
</index>
|
| 37 |
+
</children>
|
| 38 |
+
</updatesort>
|
| 39 |
+
<system>
|
| 40 |
+
<children>
|
| 41 |
+
<config>
|
| 42 |
+
<children>
|
| 43 |
+
<sortbydate translate="title" module="sortbydate">
|
| 44 |
+
<title>Sort by Date</title>
|
| 45 |
+
</sortbydate>
|
| 46 |
+
</children>
|
| 47 |
+
</config>
|
| 48 |
+
</children>
|
| 49 |
+
</system>
|
| 50 |
+
</children>
|
| 51 |
+
</admin>
|
| 52 |
+
</resources>
|
| 53 |
+
</acl>
|
| 54 |
+
</config>
|
app/code/local/Magmodules/Sortbydate/etc/config.xml
CHANGED
|
@@ -17,17 +17,32 @@
|
|
| 17 |
* @category Magmodules
|
| 18 |
* @package Magmodules_Sortbydate
|
| 19 |
* @author Magmodules <info@magmodules.eu)
|
| 20 |
-
* @copyright Copyright (c)
|
| 21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 22 |
*/
|
| 23 |
-->
|
| 24 |
<config>
|
| 25 |
<modules>
|
| 26 |
<Magmodules_Sortbydate>
|
| 27 |
-
<version>1.
|
| 28 |
</Magmodules_Sortbydate>
|
| 29 |
</modules>
|
| 30 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
<resources>
|
| 32 |
<sortbydate_setup>
|
| 33 |
<setup>
|
|
@@ -50,16 +65,23 @@
|
|
| 50 |
</Magmodules_Sortbydate>
|
| 51 |
</modules>
|
| 52 |
</translate>
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
<translate>
|
| 56 |
-
<modules>
|
| 57 |
<Magmodules_Sortbydate>
|
| 58 |
-
<
|
| 59 |
-
<default>Magmodules_Sortbydate.csv</default>
|
| 60 |
-
</files>
|
| 61 |
</Magmodules_Sortbydate>
|
| 62 |
-
</
|
| 63 |
-
</
|
| 64 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
</config>
|
| 17 |
* @category Magmodules
|
| 18 |
* @package Magmodules_Sortbydate
|
| 19 |
* @author Magmodules <info@magmodules.eu)
|
| 20 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 22 |
*/
|
| 23 |
-->
|
| 24 |
<config>
|
| 25 |
<modules>
|
| 26 |
<Magmodules_Sortbydate>
|
| 27 |
+
<version>1.5.0</version>
|
| 28 |
</Magmodules_Sortbydate>
|
| 29 |
</modules>
|
| 30 |
<global>
|
| 31 |
+
<helpers>
|
| 32 |
+
<sortbydate>
|
| 33 |
+
<class>Magmodules_Sortbydate_Helper</class>
|
| 34 |
+
</sortbydate>
|
| 35 |
+
</helpers>
|
| 36 |
+
<models>
|
| 37 |
+
<sortbydate>
|
| 38 |
+
<class>Magmodules_Sortbydate_Model</class>
|
| 39 |
+
</sortbydate>
|
| 40 |
+
</models>
|
| 41 |
+
<blocks>
|
| 42 |
+
<sortbydate>
|
| 43 |
+
<class>Magmodules_Sortbydate_Block</class>
|
| 44 |
+
</sortbydate>
|
| 45 |
+
</blocks>
|
| 46 |
<resources>
|
| 47 |
<sortbydate_setup>
|
| 48 |
<setup>
|
| 65 |
</Magmodules_Sortbydate>
|
| 66 |
</modules>
|
| 67 |
</translate>
|
| 68 |
+
<layout>
|
| 69 |
+
<updates>
|
|
|
|
|
|
|
| 70 |
<Magmodules_Sortbydate>
|
| 71 |
+
<file>magmodules_sortbydate.xml</file>
|
|
|
|
|
|
|
| 72 |
</Magmodules_Sortbydate>
|
| 73 |
+
</updates>
|
| 74 |
+
</layout>
|
| 75 |
+
</frontend>
|
| 76 |
+
<admin>
|
| 77 |
+
<routers>
|
| 78 |
+
<adminhtml>
|
| 79 |
+
<args>
|
| 80 |
+
<modules>
|
| 81 |
+
<magmodules_sortbydate after="Mage_Adminhtml">Magmodules_Sortbydate_Adminhtml</magmodules_sortbydate>
|
| 82 |
+
</modules>
|
| 83 |
+
</args>
|
| 84 |
+
</adminhtml>
|
| 85 |
+
</routers>
|
| 86 |
+
</admin>
|
| 87 |
</config>
|
app/code/local/Magmodules/Sortbydate/etc/system.xml
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magmodules.eu
|
| 5 |
+
* http://www.magmodules.eu
|
| 6 |
+
*
|
| 7 |
+
* NOTICE OF LICENSE
|
| 8 |
+
*
|
| 9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 11 |
+
* It is also available through the world-wide-web at this URL:
|
| 12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 13 |
+
* If you did not receive a copy of the license and are unable to
|
| 14 |
+
* obtain it through the world-wide-web, please send an email
|
| 15 |
+
* to info@magmodules.eu so we can send you a copy immediately.
|
| 16 |
+
*
|
| 17 |
+
* @category Magmodules
|
| 18 |
+
* @package Magmodules_Sortbydate
|
| 19 |
+
* @author Magmodules <info@magmodules.eu)
|
| 20 |
+
* @copyright Copyright (c) 2014 (http://www.magmodules.eu)
|
| 21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 22 |
+
*/
|
| 23 |
+
-->
|
| 24 |
+
<config>
|
| 25 |
+
<tabs>
|
| 26 |
+
<magmodules translate="label" module="sortbydate">
|
| 27 |
+
<label>Magmodules</label>
|
| 28 |
+
<sort_order>200</sort_order>
|
| 29 |
+
</magmodules>
|
| 30 |
+
</tabs>
|
| 31 |
+
<sections>
|
| 32 |
+
<sortbydate translate="label" module="sortbydate">
|
| 33 |
+
<label>Sort By Date</label>
|
| 34 |
+
<tab>magmodules</tab>
|
| 35 |
+
<header_css>mm-moduleheader</header_css>
|
| 36 |
+
<frontend_type>text</frontend_type>
|
| 37 |
+
<sort_order>40</sort_order>
|
| 38 |
+
<show_in_default>1</show_in_default>
|
| 39 |
+
<show_in_website>1</show_in_website>
|
| 40 |
+
<show_in_store>1</show_in_store>
|
| 41 |
+
<groups>
|
| 42 |
+
<general translate="label" module="sortbydate">
|
| 43 |
+
<label>Sort By Date</label>
|
| 44 |
+
<frontend_type>text</frontend_type>
|
| 45 |
+
<sort_order>1</sort_order>
|
| 46 |
+
<show_in_default>1</show_in_default>
|
| 47 |
+
<show_in_website>1</show_in_website>
|
| 48 |
+
<show_in_store>1</show_in_store>
|
| 49 |
+
<expanded>1</expanded>
|
| 50 |
+
<comment>
|
| 51 |
+
<![CDATA[
|
| 52 |
+
<p>
|
| 53 |
+
<b>Need help with this extension?</b>
|
| 54 |
+
Please visit <a href="http://help.magmodules.eu/sortbydate">help.magmodules.eu/sortbydate</a> for tips and tricks.
|
| 55 |
+
</p>
|
| 56 |
+
]]>
|
| 57 |
+
</comment>
|
| 58 |
+
<fields>
|
| 59 |
+
<sorting_desc translate="label">
|
| 60 |
+
<label>Default Sorting Direction</label>
|
| 61 |
+
<frontend_type>select</frontend_type>
|
| 62 |
+
<source_model>sortbydate/system_config_source_sorting</source_model>
|
| 63 |
+
<sort_order>1</sort_order>
|
| 64 |
+
<show_in_default>1</show_in_default>
|
| 65 |
+
<show_in_website>1</show_in_website>
|
| 66 |
+
<show_in_store>1</show_in_store>
|
| 67 |
+
</sorting_desc>
|
| 68 |
+
<installation_status translate="label">
|
| 69 |
+
<label>Installation Status</label>
|
| 70 |
+
<frontend_type>text</frontend_type>
|
| 71 |
+
<frontend_model>sortbydate/adminhtml_render_status</frontend_model>
|
| 72 |
+
<sort_order>2</sort_order>
|
| 73 |
+
<show_in_default>1</show_in_default>
|
| 74 |
+
<show_in_website>1</show_in_website>
|
| 75 |
+
<show_in_store>1</show_in_store>
|
| 76 |
+
</installation_status>
|
| 77 |
+
<installation_update translate="label">
|
| 78 |
+
<label>Add / Remove</label>
|
| 79 |
+
<frontend_type>button</frontend_type>
|
| 80 |
+
<frontend_model>sortbydate/adminhtml_render_button</frontend_model>
|
| 81 |
+
<sort_order>3</sort_order>
|
| 82 |
+
<show_in_default>1</show_in_default>
|
| 83 |
+
<show_in_website>1</show_in_website>
|
| 84 |
+
<show_in_store>1</show_in_store>
|
| 85 |
+
</installation_update>
|
| 86 |
+
</fields>
|
| 87 |
+
</general>
|
| 88 |
+
</groups>
|
| 89 |
+
</sortbydate>
|
| 90 |
+
</sections>
|
| 91 |
+
</config>
|
app/code/local/Magmodules/Sortbydate/sql/sortbydate_setup/mysql4-install-0.1.0.php
CHANGED
|
@@ -24,7 +24,7 @@ $installer = $this;
|
|
| 24 |
$installer->startSetup();
|
| 25 |
|
| 26 |
$prodEntityTypeId = $installer->getEntityTypeId('catalog_product');
|
| 27 |
-
$installer->updateAttribute($prodEntityTypeId, 'created_at', 'frontend_label', 'Date
|
| 28 |
$installer->updateAttribute($prodEntityTypeId, 'created_at', 'used_for_sort_by', 1);
|
| 29 |
|
| 30 |
$installer->endSetup();
|
| 24 |
$installer->startSetup();
|
| 25 |
|
| 26 |
$prodEntityTypeId = $installer->getEntityTypeId('catalog_product');
|
| 27 |
+
$installer->updateAttribute($prodEntityTypeId, 'created_at', 'frontend_label', 'Date');
|
| 28 |
$installer->updateAttribute($prodEntityTypeId, 'created_at', 'used_for_sort_by', 1);
|
| 29 |
|
| 30 |
$installer->endSetup();
|
app/design/frontend/base/default/layout/magmodules_sortbydate.xml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<catalog_category_default>
|
| 4 |
+
<reference name="product_list">
|
| 5 |
+
<action method="setDefaultDirection" ifconfig="sortbydate/general/sorting_desc"><dir>desc</dir></action>
|
| 6 |
+
</reference>
|
| 7 |
+
</catalog_category_default>
|
| 8 |
+
<catalog_category_layered>
|
| 9 |
+
<reference name="product_list">
|
| 10 |
+
<action method="setDefaultDirection" ifconfig="sortbydate/general/sorting_desc"><dir>desc</dir></action>
|
| 11 |
+
</reference>
|
| 12 |
+
</catalog_category_layered>
|
| 13 |
+
</layout>
|
app/locale/en_US/Magmodules_Sortbydate.csv
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
"
|
| 1 |
+
"Created at", "Newest"
|
app/locale/nl_NL/Magmodules_Sortbydate.csv
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
"
|
| 1 |
+
"Created at", "Datum"
|
package.xml
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Magmodules_Sortbydate</name>
|
| 4 |
-
<version>1.0
|
| 5 |
<stability>stable</stability>
|
| 6 |
-
<license
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Sort category products by date</summary>
|
| 10 |
<description>Sort category products by date</description>
|
| 11 |
<notes>1.0.1 - Added uninstall file
|
| 12 |
-
1.0.0
|
| 13 |
<authors><author><name>Magmodules</name><user>auto-converted</user><email>info@magmodules.eu</email></author></authors>
|
| 14 |
-
<date>
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magelocal"><dir name="Magmodules"><dir name="Sortbydate"><dir name="
|
| 17 |
<compatible/>
|
| 18 |
<dependencies/>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Magmodules_Sortbydate</name>
|
| 4 |
+
<version>1.5.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
+
<license/>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Sort category products by date</summary>
|
| 10 |
<description>Sort category products by date</description>
|
| 11 |
<notes>1.0.1 - Added uninstall file
|
| 12 |
+
1.0.0 - First stable release</notes>
|
| 13 |
<authors><author><name>Magmodules</name><user>auto-converted</user><email>info@magmodules.eu</email></author></authors>
|
| 14 |
+
<date>2014-07-09</date>
|
| 15 |
+
<time>14:33:53</time>
|
| 16 |
+
<contents><target name="magelocal"><dir name="Magmodules"><dir name="Sortbydate"><dir name="Block"><dir name="Adminhtml"><dir name="Render"><file name="Button.php" hash="b681600532f304a840af33eacf3d2976"/><file name="Status.php" hash="4dbd6d44fadd1ef80115e4caeb9dcf53"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c9b3f86b5eb17f344574b8ea746125ee"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Sorting.php" hash="990b04fd5d7936c628a28295dafe17c2"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="UpdatesortController.php" hash="c0fc482d9493311da9a012ba051cad4d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8d713d602b1ac422597489b09559683e"/><file name="config.xml" hash="8d0660254541881b85d295c2547a3e13"/><file name="system.xml" hash="509293f73ad818bdd71a4d7c3a612876"/></dir><dir name="sql"><dir name="sortbydate_setup"><file name="mysql4-install-0.1.0.php" hash="908dd664b5329b47eee40e380c17207c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Sortbydate.xml" hash="468544b2c4df08e194b19fb0ac0fdc33"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magmodules_Sortbydate.csv" hash="85b312df796f3e56bda1ba18af5ac77b"/></dir><dir name="nl_NL"><file name="Magmodules_Sortbydate.csv" hash="e169797cd2c91bd2b8ba14059d6c9b81"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="magmodules_sortbydate.xml" hash="5b70605bafe4f7eb609dcf48a230f3d8"/></dir></dir></dir></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
<dependencies/>
|
| 19 |
</package>
|
