jijaybajay Posted September 27, 2013 Share Posted September 27, 2013 Hi, I need a module to show the latest modified products. Is it possible to make some code modification on the existing 'New Product Module'? How to do it? Thanks a lot for reading. Link to comment Share on other sites More sharing options...
vekia Posted September 27, 2013 Share Posted September 27, 2013 you can change query in function Product::getNewProducts all that you will have to do is.. change queries to database, just remove WHERE date_add and add ORDER BY date_upd 1 Link to comment Share on other sites More sharing options...
jijaybajay Posted September 27, 2013 Author Share Posted September 27, 2013 (edited) I've found my own solution. Go to .../classes/Product.php in getNewProducts function, find: if (empty($order_by) || $order_by == 'position') $order_by = 'date_add'; change $order_by = 'date_add' to $order_by = 'date_upd' if (empty($order_by) || $order_by == 'position') $order_by = 'date_upd'; Save it as a new file Product.php in .../override/classes/Product.php. This will help you keeping the original core file untouched. Don't forget to also change the product controller. Go to .../controllers/front/NewProductsController.php in initContent() function, find $this->orderBy = 'date_add'; change it to $this->orderBy = 'date_upd'; Save it as a new file NewProductsController.php in .../override/controllers/front/NewProductsController.php Remember, always delete your class_index.php file in .../cache folder when you create a new overriden file Edited September 28, 2013 by jijaybajay (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now