Post by jsmsnet » Wed May 28, 2014 6:36 am

Hello,

I've just install Opencart, i delete all the demo data and now if i try to sort order from X to Y (where x,y is a date) a get the following error:

Code: Select all

( ! ) Fatal error: Uncaught exception 'ErrorException' with message 'Error: Unknown column 'o.date_modified' in 'where clause'<br />Error No: 1054<br />SELECT COUNT(*) AS total FROM `order` WHERE order_status_id > '0' AND DATE(date_added) = DATE('2014-05-25') AND DATE(o.date_modified) = DATE('2014-05-27')' in D:\wamp\www\shop.dev\system\database\mysqli.php on line 41
I didn't change anything but when i install opencart i left the table prefix blank.

Any help?!

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Wed May 28, 2014 7:11 am

Run the following query in your PHPMyAdmin:

Code: Select all

ALTER TABLE `oc_order` ADD `date_modified` datetime NOT NULL;
Note: Rename oc_ prefix name if using another prefix name from database.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Wed May 28, 2014 12:15 pm

My order table is "order", i don't have a prefix. Also, the column date_modified, exist in table order.

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Wed May 28, 2014 6:36 pm

Bug found on OC v1.5.6.4.

In admin/model/sale/order.php file,

find around line 626 (2nd instance from the search):

Code: Select all

$sql .= " AND DATE(o.date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
replace with:

Code: Select all

$sql .= " AND DATE(date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
This should resolved the problem.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Wed May 28, 2014 8:51 pm

Well, i made the changes but now i don't get any result if i choose to sort order from date - to date. (Ex. filter_date_added=2014-05-27&filter_date_modified=2014-05-28) There is something strange in this file.

PS: Of course, i have orders in those days :)

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Wed May 28, 2014 9:01 pm

Let's do a little test.

In your admin/controller/sale/order.php file,

find:

Code: Select all

$results = $this->model_sale_order->getOrders($data);
add below:

Code: Select all

echo "<pre />\n";
print_r($results);
echo "</pre>\n";
Reproduce the same action as you did previously above. Then, tell me if you see the date_modified key with the value in the array from the top of your page.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Wed May 28, 2014 9:54 pm

Ok, i add:

When i go to admin/index.php?route=sale/order&token=3720cff8b365f0c4971ebc15f630a727
i see the orders with array.

Code: Select all

Array
(
    [0] => Array
        (
            [order_id] => 8
            [customer] => Customer Name
            [status] => Complete
            [total] => 192.2000
            [currency_code] => EUR
            [currency_value] => 1.00000000
            [date_added] => 2014-05-28 10:19:14
            [date_modified] => 2014-05-28 16:25:10
        )
.......................etc
The problem is when i try to sort filter -> admin/index.php?route=sale/order&token=3720cff8b365f0c4971ebc15f630a727&filter_date_added=2014-05-27&filter_date_modified=2014-05-28

i get a:

Array
(
)

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Wed May 28, 2014 9:57 pm

Did you installed any contributions on your store in order for this behavior to happen?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Thu May 29, 2014 12:32 am

Nope.

The only things i do.

- i delete all demo data (including products, categories, attributes, options)
- i change the taxes (with local VAT)
- i delete all countries, except 1.

oh, i install vqmod and vqmod manager.

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Thu May 29, 2014 12:48 am

oh, i install vqmod and vqmod manager.
So, technically, you did. ;)

If you disable VQMod and try the sort order again, does the problem persists?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Thu May 29, 2014 3:59 am

I disable vqmod. No luck.

The thing is that when i choose to filter order by filter_date_modified=2014-05-28 everything it's ok. I get normal results.

The problem is when i choose both filter_date_added=2014-05-27&filter_date_modified=2014-05-28 - 0 results :(

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Thu May 29, 2014 7:26 am

Are you using the latest release of OC?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jsmsnet » Fri May 30, 2014 12:44 am

Yes. 1.5.6.4

New member

Posts

Joined
Mon Jan 13, 2014 4:56 am

Post by straightlight » Sat Jun 07, 2014 7:17 pm

In PHPMyAdmin, on the SQL query window, execute:

Code: Select all

SELECT `date_added`, `date_modified` FROM oc_`order` WHERE `date_added` >= '2014-05-27' AND `date_modified` <= '2014-05-28';
Note: Replace oc_ with your actual table prefix name if different. Then, hit go or save.

Do you see any results on the next screen?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 15 guests