Tweak reports query generator to reference table names

Fixes #5278
This commit is contained in:
Mike Jolley 2014-04-08 15:46:55 +01:00
parent b97181c08a
commit 6fa57f707d
2 changed files with 6 additions and 6 deletions

View File

@ -98,12 +98,12 @@ class WC_Admin_Report {
} elseif ( $value['type'] == 'order_item_meta' ) {
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_id";
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_items.order_id";
$joins["order_item_meta_{$key}"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON order_items.order_item_id = order_item_meta_{$key}.order_item_id";
} elseif ( $value['type'] == 'order_item' ) {
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_id";
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_items.order_id";
}
}
@ -117,7 +117,7 @@ class WC_Admin_Report {
if ( isset( $value['type'] ) && $value['type'] == 'order_item_meta' ) {
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_id";
$joins["order_items"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON posts.ID = order_items.order_id";
$joins["order_item_meta_{$key}"] = "LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_{$key} ON order_items.order_item_id = order_item_meta_{$key}.order_item_id";
} else {

View File

@ -65,7 +65,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
),
'where' => array(
array(
'key' => 'order_item_type',
'key' => 'order_items.order_item_type',
'value' => 'coupon',
'operator' => '='
)
@ -226,7 +226,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
),
'where' => array(
array(
'key' => 'order_item_type',
'key' => 'order_items.order_item_type',
'value' => 'line_item',
'operator' => '='
)
@ -259,7 +259,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
),
'where' => array(
array(
'key' => 'order_item_type',
'key' => 'order_items.order_item_type',
'value' => 'coupon',
'operator' => '='
)