I ran into a problem with the current v2.0.0c plugin installed on 1.5.7. When logged in to the shop side and in my account. If you have orders and click on "show all orders it causes an error
PHP Code:
[25-Nov-2020 14:50:44 UTC] Request URI: /upgrade/index.php?main_page=account_history, IP address: 152.44.114.186
#1 trigger_error() called at [/home//public_html/upgrade/includes/classes/db/mysql/query_factory.php:170]
#2 queryFactory->show_error() called at [/home//public_html/upgrade/includes/classes/db/mysql/query_factory.php:142]
#3 queryFactory->set_error() called at [/home//public_html/upgrade/includes/classes/db/mysql/query_factory.php:269]
#4 queryFactory->Execute() called at [/home//public_html/upgrade/includes/classes/zca/zca_split_page_results.php:86]
#5 zca_splitPageResults->__construct() called at [/home//public_html/upgrade/includes/modules/pages/account_history/header_php_account_history_zca_bootstrap.php:6]
#6 require(/home//public_html/upgrade/includes/modules/pages/account_history/header_php_account_history_zca_bootstrap.php) called at [/home//public_html/upgrade/index.php:35]
--> PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 :: select count(*) as total FROM znc_orders o, znc_orders_total ot, znc_orders_status s WHERE o.customers_id = 15 AND o.orders_id = ot.orders_id AND ot.class = 'ot_total' AND s.orders_status_id = (SELECT orders_status_id FROM znc_orders_status_history osh WHERE osh.orders_id = o.orders_id AND osh.customer_notified >= 0 ==> (as called by) /home//public_html/upgrade/includes/classes/zca/zca_split_page_results.php on line 86 <== in /home//public_html/upgrade/includes/classes/db/mysql/query_factory.php on line 170.
The error is the result of the embedded select statement and the missing closing ). I verified that this exists on other sites at the same level.
The way I got around it was by modifying ZCA_split_page_results to test if the query contained "(select".
PHP Code:
//bof test for (select and add closing paren if needed
if (strpos($query_lower, "(select", $pos_from)){
$count_query = "select count(" . $count_string . ") as total " . substr($this->countQuery, $pos_from, ($pos_to - $pos_from)) . ") ";
} else {
$count_query = "select count(" . $count_string . ") as total " . substr($this->countQuery, $pos_from, ($pos_to - $pos_from));
}
//eof test select
Hope this helps if others run into it. BTW just adding the closing paren breaks the product listing page which is why I needed the if/else.