Wrong order status if clause #2722

danijelGombac opened this Issue Feb 27, 2015 · 10 comments


None yet

4 participants


In opencart/upload/admin/model/sale/order.php

public function getTotalOrders($data = array()) {}


if (!empty($data['filter_order_status'])) {

must be

if (isset($data['filter_order_status'])) {

Now displays all orders, if filtered by order_status_id = 0.


isset() is implicitly checked by empty() so I don't see any improvement there


The improvement is, that with isset() total_orders display right values, with if !empty() missing orders with 0 value for order_status_id is not displayed. Go to demo page and in order list filter by missing orders and you see that filtered total orders is the same that not filtered.


No such issue in Opencart as you claim. Attached is the proof


Not total of individual order, but the number of orders in the list is wrong. Look down.


'Missing Order' filter is for those orders which customers put in cart but did not 'confirm'. Down in the list I have such orders. Would you please establish your point more clearly and with an image if possible?




Look, go to demo page in opencart.com and filter order list by order_status_id=0. Go down to pagination and look how many orders is in the list. Go to page 15 and you see.

Showing 281 to 300 of 965 (49 Pages)

but the list is empty...


It is installation specific issue not Opencart issue in general


the demo is the first 2.0 version released.


Yes is the first, but the function structure is the same. Download and 2.01.1 and no difference.


@GomDani is right:

if $data['filter_status_id'] is equal to '0' (Missing orders), !empty($data['filter_order_status']) returns false skipping the if statement and going down into the else which do:

$sql .= " WHERE order_status_id > '0'";

You can reproduce the same issue if you filter by order ID: if you type, for example, 1669, you will have the 1669 order as unique result. If you type 0 you will have all the orders as results!

@mrnfrancesco mrnfrancesco added a commit to mrnfrancesco/opencart that referenced this issue Jun 4, 2015
@mrnfrancesco mrnfrancesco Changed use of `!empty` with `isset` to avoid results error if argume…
…nt is '0' (see #2722)
@danielkerr danielkerr closed this Aug 14, 2015
@danielkerr danielkerr added a commit that referenced this issue Aug 14, 2015
@danielkerr danielkerr #2722 986ab78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment