Post by diego74 » Fri Jun 24, 2022 11:06 am

Hi there,

I need your help to get the "Latest Orders" (on the Admin Panel) to show only the PENDING orders, and not all of them.

I found that the admin\controller\extension\dashboard\recent.php file might be involved so I edited it as follows:

$filter_data = array(
'sort' => 'o.date_added',
'order_status_id' => 1, <--- This was added by me
'order' => 'DESC',
'start' => 0,
'limit' => 5

But nothing happened, if I change the other values (eg: 'limit' => 10) it gets modified but I could not find the correct value to get what I am looking for.

Any help will be appreciated,
Thanks in advance!

Attachments

LatestOrders.png

I need to list just the PENDING orders - LatestOrders.png (73.42 KiB) Viewed 1052 times


New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by paulfeakins » Fri Jun 24, 2022 6:22 pm

Do the filters at the side not do this?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by diego74 » Fri Jun 24, 2022 8:52 pm

I'm using 2.3.0.2, forgot to mention it, sorry.

I don't see any filter there and I want it to be the default filter.

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by diego74 » Sat Jun 25, 2022 5:47 am

paulfeakins wrote:
Fri Jun 24, 2022 6:22 pm
Do the filters at the side not do this?
Oh, I think you are talking about the "Sales List" and the "Order Status" filter, that is what I would like to accomplish but with the front page at the Admin Panel, where the "Latest Orders" are listed, please see the attached screenshot.

Attachments

LatestOrders2.jpg

LatestOrders2.jpg (195.63 KiB) Viewed 1025 times


New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by DigitCart » Sat Jun 25, 2022 1:19 pm

Hi

Instead of order_status_id use filter_order_status_id.

example:

Code: Select all

$filter_data = array(
'sort' => 'o.date_added',
'filter_order_status_id' => 1,
'order' => 'DESC',
'start' => 0,
'limit' => 5

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by diego74 » Wed Jun 29, 2022 12:41 pm

DigitCart wrote:
Sat Jun 25, 2022 1:19 pm
Hi

Instead of order_status_id use filter_order_status_id.

example:

Code: Select all

$filter_data = array(
'sort' => 'o.date_added',
'filter_order_status_id' => 1,
'order' => 'DESC',
'start' => 0,
'limit' => 5
Hi!, I tried your suggestion but it did not work.

If I change the limit value (11 instead of 5) then more orders appear (with status pending and complete), so it means that settings do modify the "Latest Orders" list but I don't know which value I need to put to filter the results by the status field.

Any further idea will be appreciated.

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by Majnoon » Wed Jun 29, 2022 9:27 pm

diego74 wrote:
Wed Jun 29, 2022 12:41 pm
Any further idea will be appreciated.
The best place to find the value is login to your web hosting and go to phpMyAdmin select your database for the website and look for the table "prefix"order_status.

Attachments

help.png

Look for the table in your database - help.png (249.07 KiB) Viewed 994 times


Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by diego74 » Thu Jun 30, 2022 10:37 am

Majnoon wrote:
Wed Jun 29, 2022 9:27 pm
diego74 wrote:
Wed Jun 29, 2022 12:41 pm
Any further idea will be appreciated.
The best place to find the value is login to your web hosting and go to phpMyAdmin select your database for the website and look for the table "prefix"order_status.
Thank you, yes, that is exactly where I took the value "order_status_id" => 1 from (because 1 is assigned to Pending status) and added it into that config file, but it seems it is being ignored no matter what value I use since also tried with different values but always got the same result, however if I change the number of rows with the value below (see the example) it does take place, so it seems that order_status_id line is being ignored (I also moved it to the bottom with no luck).

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by Majnoon » Thu Jun 30, 2022 12:56 pm

diego74 wrote:
Thu Jun 30, 2022 10:37 am
it seems that order_status_id line is being ignored (I also moved it to the bottom with no luck).
Try using:

Code: Select all

'filter_order_status_id' => 1,
Instead:

Code: Select all

'order_status_id' => 1,

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by diego74 » Fri Jul 01, 2022 9:15 am

Majnoon wrote:
Thu Jun 30, 2022 12:56 pm
diego74 wrote:
Thu Jun 30, 2022 10:37 am
it seems that order_status_id line is being ignored (I also moved it to the bottom with no luck).
Try using:

Code: Select all

'filter_order_status_id' => 1,
Instead:

Code: Select all

'order_status_id' => 1,
This is my actual config:

$filter_data = array(
'sort' => 'o.date_added',
'filter_order_status_id' => 1,
'order' => 'DESC',
'start' => 0,
'limit' => 11
);

But the orders are not filtered. Could this be an issue related to 2.0.3.2?

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by diego74 » Fri Jul 01, 2022 11:06 am

DigiCart, thank you, you were correct, I installed OC 3.0 in a free hosting server and 'filter_order_status_id' => 1, worked like a charm :o (completed orders were removed, just Pendings were listed there, just as I requested)

But I'm using 2.0.3.2 with a lot of mods, upgrading it would be a headache, :( is there anything else I can check?

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by Majnoon » Fri Jul 01, 2022 8:11 pm

Can you tell us more how you are making changes? Via XML modifications or direct into file?
Also do share the file path with us.

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by diego74 » Fri Jul 01, 2022 10:59 pm

Majnoon wrote:
Fri Jul 01, 2022 8:11 pm
Can you tell us more how you are making changes? Via XML modifications or direct into file?
Also do share the file path with us.
By manually editing the admin\controller\extension\dashboard\recent.php file, then Ctrl+F5 a few times to check the change. This seems to be a valid method as it works when the 'limit' => 5value is changed, it automatically takes effect. Same method applied to OC 3.X and it worked.

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by Majnoon » Fri Jul 01, 2022 11:34 pm

diego74 wrote:
Fri Jul 01, 2022 10:59 pm
This seems to be a valid method as it works when the 'limit' => 5value is changed, it automatically takes effect.
You can refresh theme cache and modifications.
And if this is solve you can edit the first post with [SOLVED]

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by diego74 » Wed Jul 06, 2022 10:42 am

Majnoon wrote:
Fri Jul 01, 2022 11:34 pm
diego74 wrote:
Fri Jul 01, 2022 10:59 pm
This seems to be a valid method as it works when the 'limit' => 5value is changed, it automatically takes effect.
You can refresh theme cache and modifications.
And if this is solve you can edit the first post with [SOLVED]
Hi Majnoon!,

1) I went to Extensions - Modifications - clicked 'Refresh' button

2) Made a backup and then deleted the contents of /htdocs/system/storage/cache directory

3) Ctrl+F5 a couple of times with no luck, still showing the unwanted orders even on a new incognito session.

I'm not sure if there is any other step I'm missing, those are the steps I found in the knowledge base.

Thanks!

New member

Posts

Joined
Fri Jun 24, 2022 10:55 am

Post by Majnoon » Wed Jul 06, 2022 10:07 pm

Can you try disabling all of the modifications. And then refresh the theme cache and modifications and see if the code works?

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm
Who is online

Users browsing this forum: No registered users and 73 guests