Jump to content

Exclude orders with some status or in Admin Orders list.


hakeryk2
 Share

Recommended Posts

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 by hakeryk2 (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :D

Edited by hakeryk2 (see edit history)

Share this post


Link to post
Share on other sites

  • 3 weeks later...

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!

Share this post


Link to post
Share on other sites

  • 1 month later...

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 by hakeryk2 (see edit history)

Share this post


Link to post
Share on other sites

  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More