hakeryk2 Posted December 5, 2016 Share Posted December 5, 2016 (edited) Hello community, Is is possible to make a some kind of switch that will enable to show all orders except for those with "delivered" status? In which file should I start to edit or maybe someone has this solution already adapted? Any help will be very appreciated. Is there is any chance to know if in AdminOrdersController there is a way to set default value for column in field_list array? I mean if there is any array element that I can set or hardcore to be vissible in any circumstances. In example like this: 'current_state' => array( 'default' => 4, ), Edited December 5, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
hakeryk2 Posted December 8, 2016 Author Share Posted December 8, 2016 I am bumping this thread - I still have hope that someone with bigger Prestashop knowledge will help me and I think that this will be helpfull for many people who have a lot of orders and they want to see "active" orders. Link to comment Share on other sites More sharing options...
NemoPS Posted December 10, 2016 Share Posted December 10, 2016 What about adding the condition with this->_where? Link to comment Share on other sites More sharing options...
hakeryk2 Posted December 11, 2016 Author Share Posted December 11, 2016 (edited) Can You provide full example? I still did not fully understand this part in Prestashop arrays that is generating content. I tried to modify SQL statement but with no luck. Edited December 13, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
hakeryk2 Posted December 13, 2016 Author Share Posted December 13, 2016 (edited) Sorry for double dump but I achieved my effect with JavaScript, maybe someone will find it useful. You will need an extension like Custom JavaScript for Chrome https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija or Tempermonkey and paste my code from below to this extension when You will be on your orders page, hit save and reload the page. You can test it as well by opening a console (ctrl+shift+j) and paste and run (enter) on admin orders page.After paste You will notice one extra button on Orders page (where the title is) if (window.location.href.indexOf("AdminOrders") > -1) { $( ".panel-heading > span.badge" ).after("<span class='btn btn-default hideOrders'>Hide Delivered and Cancelled orders</span>"); $(".hideOrders").on( "click", function() { $('.color_field').each(function(i, obj) { var myString = $(this).text().trim(); if (myString == 'Delivered' || myString == 'Cancelled') { $(this).closest('tr').remove(); } console.log(myString); }); }); } If someone wants to hide other just append myString == 'Your Status name' in "if" statement. I made few others for my needs and they're ok.I will made cookie for it in future but right now I supose it is ok. Well that is my workaround Edited December 13, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
npiazza Posted January 3, 2017 Share Posted January 3, 2017 Awesome work around! How would I implement this on the orders page itself? I tried adding it to the code and removing the console.log but it's not working. What am I missing? Thanks in advance! Link to comment Share on other sites More sharing options...
hakeryk2 Posted March 3, 2017 Author Share Posted March 3, 2017 (edited) Just install tampermonkey extension for Your browser. Look in google to install it (just type Tampermonkey Chrome, Tampermonkey Opera or Tampermonkey Firefox). You will not have to interfer with original JS files which will be updated when You will update prestashop. When You will have tampermonkey extension installed then just click on its icon in the top right corner (red square with 2 circles) and choose "Add new script" and then paste this into window and hit save. Ofcourse first edit YOURDOMAINHERE.com to your proper domain // ==UserScript== // @name Hide succesful orders in shop // @namespace http://yourdomain.com/ // @version 0.1 // @description On admin order page creates a buttons which hides delivered orders // @author Eryk Wróbel // @match http://yourdomain.com/* // @match https://yourdomain.com/* // @grant none // ==/UserScript== (function() { if (window.location.href.indexOf("AdminOrders") > -1) { $( ".panel-heading > span.badge" ).after("<span class='btn btn-default hideOrders'>Hide Delivered and Cancelled orders</span>"); $(".hideOrders").on( "click", function() { $('.color_field').each(function(i, obj) { var myString = $(this).text().trim(); if (myString == 'Delivered' || myString == 'Cancelled') { $(this).closest('tr').remove(); } console.log(myString); }); }); } })(); Edited March 3, 2017 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
taniacr Posted December 16, 2021 Share Posted December 16, 2021 Wondering if there's a better solution for 1.7? 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