When you submit the search form at admin/store/orders/search, you get the following errors:

    * Notice: Undefined variable: args in uc_order_usearch() (line 720 of /xxx/sites/all/modules/ubercart/uc_order/uc_order.admin.inc).
    * PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'o_order_status' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {uc_orders} o LEFT OUTER JOIN {uc_order_statuses} os ON o.order_status = os.order_status_id WHERE (o_order_status NOT IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) AND (ob_first_name LIKE :db_condition_placeholder_3 ESCAPE '\\') ) subquery; Array ( [:db_condition_placeholder_0] => canceled [:db_condition_placeholder_1] => in_checkout [:db_condition_placeholder_2] => in_google_checkout [:db_condition_placeholder_3] => andrew ) in PagerDefault->execute() (line 74 of xxx/includes/pager.inc).

Comments

tr’s picture

I eliminated the PHP notice by removing the second parameter from the function uc_order_admin() - it was a legacy of the D6 version. Committed that fix.

The DB problem is the same as in #975194: Create Order does not follow email address tag recommendations, and gives error, just in a different part of the code.

Anonymous’s picture

Version: 7.x-3.x-dev » 7.x-3.0-beta2
Status: Active » Reviewed & tested by the community
StatusFileSize
new5.72 KB

I attach working patch fixing this issue. This patch also cleans code as suggested in #975194: Create Order does not follow email address tag recommendations, and gives error, fixes "page arguments" parameter in uc_order_menu() to get rid of PHP notices and also solves bug due to which all user names in column "Customer" contained "User: none" instead of valid user name.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1076872_error_when_searching_for_customers_fix.patch, failed testing.

Anonymous’s picture

Status: Needs work » Reviewed & tested by the community

I change status to RTBC because it is the actual state of things as of now.

longwave’s picture

Version: 7.x-3.0-beta2 » 7.x-3.x-dev
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new8.24 KB

You should not set your own patches to RTBC - please use "needs review" instead.

I tested your patch and saw "Undefined property: stdClass::$uid" errors on the order search page. The attached patch fixes these and cleans up the code a bit more; uc_order_admin() now takes a condition object instead of a query object, which simplifies uc_order_usearch().

longwave’s picture

StatusFileSize
new8.54 KB

Slight update on the above, that removes the 1==1 condition in favour of DatabaseCondition::count(), and also fixes the hook_menu entry for /admin/store/orders/view so the status and order ID selector show up.

longwave’s picture

StatusFileSize
new10.22 KB

More minor bug fixes. The pager wasn't working, and this patch also removes the /admin/store/orders/sort/% page in favour of using querystrings instead, which seems to work better. Previously, if you selected a status on the order listing and then used the order search page, the status would be filtered during the search - though it wasn't obvious and there was no option shown to change it.

The more I play with this the more I realise this page should just be replaced with a view, though.

Anonymous’s picture

StatusFileSize
new10.86 KB

One more fix - Sales summary report (namely table "Total orders by status" in the bottom of page at admin/store/reports/sales) was still using links to /admin/store/orders/sort/% pages, so I have modified it to use your query strings instead.

I simply appended my patch fixing this issue to your latest patch from message #7. I attach resulting cumulative patch.

longwave’s picture

Committed, thanks for your help with this.

longwave’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.