diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..003c634
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.idea
+*.zip
+.DS_Store
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100755
index 0000000..6b3f86f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# Sort By Date for Magento® 1
+
+Sort your product listing by date to show the newest product first.
+
+## Development by Magmodules
+
+We are a Dutch Magento® Only Agency dedicated to the development of extensions for Magento® 1 and Magento® 2. All our extensions are coded by our own team and our support team is always there to help you out.
+
+## Links
+
+[Visit Magmodules.eu](https://www.magmodules.eu/)
+
+[Terms and Conditions](https://www.magmodules.eu/terms.html)
+
+[Contact Us](https://www.magmodules.eu/contact-us.html)
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Button.php b/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Button.php
new file mode 100755
index 0000000..d61b907
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Button.php
@@ -0,0 +1,60 @@
+
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Magmodules_Sortbydate_Block_Adminhtml_Render_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
+{
+
+ /**
+ * @param Varien_Data_Form_Element_Abstract $element
+ *
+ * @return mixed
+ */
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+
+ $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
+ $attributeId = $eavAttribute->getIdByCode('catalog_product', 'created_at');
+
+ if ($attributeId) {
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
+ $sort = $attributeModel['used_for_sort_by'];
+ if ($sort) {
+ $url = $this->getUrl('*/updatesort/index');
+ $title = Mage::helper('sortbydate')->__('Remove as listing option');
+ } else {
+ $url = $this->getUrl('*/updatesort/index');
+ $title = Mage::helper('sortbydate')->__('Add as listing option');
+ }
+ } else {
+ $url = $this->getUrl('*/updatesort/index');
+ $title = Mage::helper('sortbydate')->__('Add as listing option');
+ }
+
+ $this->setElement($element);
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
+ ->setType('button')
+ ->setClass('scalable')
+ ->setLabel($title)
+ ->setOnClick("setLocation('$url')")
+ ->toHtml();
+
+ return $html;
+ }
+}
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Status.php b/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Status.php
new file mode 100755
index 0000000..eab45b4
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/Block/Adminhtml/Render/Status.php
@@ -0,0 +1,49 @@
+
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Magmodules_Sortbydate_Block_Adminhtml_Render_Status extends Mage_Adminhtml_Block_System_Config_Form_Field
+{
+
+ /**
+ * @param Varien_Data_Form_Element_Abstract $element
+ *
+ * @return string
+ */
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+
+ $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
+ $attributeId = $eavAttribute->getIdByCode('catalog_product', 'created_at');
+
+ if ($attributeId) {
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
+ $sort = $attributeModel['used_for_sort_by'];
+ if ($sort) {
+ $html = '' . Mage::helper('sortbydate')->__('Installed!') . '';
+ } else {
+ $html = '' . Mage::helper('sortbydate')->__('Not Installed') . '';
+ }
+ } else {
+ $html = '' . Mage::helper('sortbydate')->__('Not Installed') . '';
+ }
+ return $html;
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/Helper/Data.php b/app/code/local/Magmodules/Sortbydate/Helper/Data.php
new file mode 100755
index 0000000..4739672
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/Helper/Data.php
@@ -0,0 +1,24 @@
+
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Magmodules_Sortbydate_Helper_Data extends Mage_Core_Helper_Abstract
+{
+
+}
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/Model/System/Config/Source/Sorting.php b/app/code/local/Magmodules/Sortbydate/Model/System/Config/Source/Sorting.php
new file mode 100755
index 0000000..8ab47aa
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/Model/System/Config/Source/Sorting.php
@@ -0,0 +1,34 @@
+
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Magmodules_Sortbydate_Model_System_Config_Source_Sorting
+{
+
+ /**
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ $sorting = array();
+ $sorting[] = array('value' => '', 'label' => Mage::helper('sortbydate')->__('Default'));
+ $sorting[] = array('value' => '1', 'label' => Mage::helper('sortbydate')->__('Newest First'));
+ return $sorting;
+ }
+}
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/controllers/Adminhtml/UpdatesortController.php b/app/code/local/Magmodules/Sortbydate/controllers/Adminhtml/UpdatesortController.php
new file mode 100755
index 0000000..00f0b60
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/controllers/Adminhtml/UpdatesortController.php
@@ -0,0 +1,58 @@
+
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Magmodules_Sortbydate_Adminhtml_UpdatesortController extends Mage_Adminhtml_Controller_Action
+{
+
+ /**
+ *
+ */
+ public function indexAction()
+ {
+ $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
+ $attributeId = $eavAttribute->getIdByCode('catalog_product', 'created_at');
+
+ if($attributeId) {
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'created_at');
+ $sort = $attributeModel['used_for_sort_by'];
+ if($sort) {
+ $attributeModel->setUsedForSortBy(0);
+ $attributeModel->save();
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been removed as listing option'));
+ } else {
+ $attributeModel->setUsedForSortBy(1);
+ $attributeModel->save();
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been added to the listing options'));
+ }
+ } else {
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sortbydate')->__('Sort by date has been added to the listing options'));
+ }
+
+ $this->_redirect('adminhtml/system_config/edit/section/sortbydate');
+ }
+
+ /**
+ * @return mixed
+ */
+ protected function _isAllowed()
+ {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/app/code/local/Magmodules/Sortbydate/etc/adminhtml.xml b/app/code/local/Magmodules/Sortbydate/etc/adminhtml.xml
new file mode 100755
index 0000000..2ae3cf1
--- /dev/null
+++ b/app/code/local/Magmodules/Sortbydate/etc/adminhtml.xml
@@ -0,0 +1,50 @@
+
+
+