Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BrianHenryIE/f564943d3014f359cfb6e51c05ffea94 to your computer and use it in GitHub Desktop.
Save BrianHenryIE/f564943d3014f359cfb6e51c05ffea94 to your computer and use it in GitHub Desktop.
diff --git a/class/dashboard_report.php b/class/dashboard_report.php
index 608c265..a59c6c9 100755
--- a/class/dashboard_report.php
+++ b/class/dashboard_report.php
@@ -6,7 +6,7 @@
$order_date="SELECT pw_posts.ID AS order_id, pw_posts.post_date AS order_date, pw_posts.post_status AS order_status FROM {$wpdb->prefix}posts as pw_posts WHERE pw_posts.post_type='shop_order' AND pw_posts.post_status IN ('wc-completed', 'wc-on-hold', 'wc-processing') AND pw_posts.post_status NOT IN ('trash') GROUP BY pw_posts.ID Order By pw_posts.post_date ASC LIMIT 5";
$results= $wpdb->get_results($order_date);
- $first_date='';
+ $first_date = array();
$i=0;
while($i<5){
@@ -22,7 +22,7 @@
$order_date="SELECT pw_posts.ID AS order_id, pw_posts.post_date AS order_date, pw_posts.post_status AS order_status FROM {$wpdb->prefix}posts as pw_posts WHERE pw_posts.post_type='shop_order' AND pw_posts.post_status IN ('wc-completed', 'wc-on-hold', 'wc-processing') AND pw_posts.post_status NOT IN ('trash') GROUP BY pw_posts.ID Order By pw_posts.post_date DESC LIMIT 1";
$results= $wpdb->get_results($order_date);
- $pw_to_date='';
+ $pw_to_date = array();
if(isset($results[0]))
$pw_to_date=$results[0]->order_date;
@@ -388,10 +388,10 @@
//echo $first_date.' - '.$pw_to_date;
- $country_values='';
- $areas='';
+ $country_values = array();
+ $areas = array();
- $all_country='';
+ $all_country = array();
for($year=$first_date;$year<=$pw_to_date;$year++){
$Country_sql="SELECT SUM(pw_postmeta1.meta_value) AS 'Total' ,pw_postmeta2.meta_value AS 'BillingCountry' ,Count(*) AS 'OrderCount' FROM {$wpdb->prefix}posts as pw_posts LEFT JOIN {$wpdb->prefix}postmeta as pw_postmeta1 ON pw_postmeta1.post_id=pw_posts.ID LEFT JOIN {$wpdb->prefix}postmeta as pw_postmeta2 ON pw_postmeta2.post_id=pw_posts.ID WHERE pw_posts.post_type = 'shop_order' AND pw_postmeta1.meta_key = '_order_total' AND pw_postmeta2.meta_key = '_billing_country' AND pw_posts.post_status IN ('wc-completed', 'wc-on-hold', 'wc-processing') AND DATE(pw_posts.post_date) BETWEEN '".$year."-01-01' AND '".$year."-12-30' AND pw_posts.post_status NOT IN ('trash') GROUP BY pw_postmeta2.meta_value Order By Total DESC";
@@ -413,7 +413,7 @@
$results= $wpdb->get_results($Country_sql);
- $this_year_country='';
+ $this_year_country = array();
foreach($results as $items){
@@ -457,11 +457,11 @@
}
}
- $plots='';
- $state_values='';
- $state='';
+ $plots = array();
+ $state_values = array();
+ $state = array();
- $all_states='';
+ $all_states = array();
//GET ALL STATES
for($year=$first_date;$year<=$pw_to_date;$year++){
@@ -492,7 +492,7 @@
$results= $wpdb->get_results($State_sql);
- $this_year_states='';
+ $this_year_states = array();
foreach($results as $items){
@@ -553,7 +553,7 @@
//print_r($plots);
- $map_date='';
+ $map_date = array();
if($first_date!=$pw_to_date){
for($year=$first_date;$year<=$pw_to_date;$year++){
$map_date[$year]=array("areas" =>$areas[$year],"plots" =>$plots[$year]);
diff --git a/includes/actions.php b/includes/actions.php
old mode 100755
new mode 100644
index ad94e25..dfb35bc
--- a/includes/actions.php
+++ b/includes/actions.php
@@ -220,7 +220,7 @@
$order_items_week=$pw_rpt_main_class->pw_get_dashboard_sale_weeks_chart($pw_shop_order_status, $pw_hide_os, $pw_from_date, $pw_to_date);
- $final_json='';
+ $final_json = array();
$currency_decimal=get_option('woocommerce_price_decimal_sep','.');
$currency_thousand=get_option('woocommerce_price_thousand_sep',',');
@@ -229,7 +229,7 @@
//SALE BY MONTH MULTIPLE CHART
////////////////////
- $pw_fetchs_data='';
+ $pw_fetchs_data = array();
$i=0;
foreach ($order_items_months_multiple as $key => $order_item) {
$value = (is_numeric($order_item->TotalAmount) ? number_format($order_item->TotalAmount,2):0);
@@ -274,7 +274,7 @@
//////////////////
$item_dates = array();
$item_data = array();
- $pw_fetchs_data = '';
+ $pw_fetchs_data = array();
$i=0;
foreach ($order_items_days as $item) {
$item_dates[] = trim($item->Date);
diff --git a/includes/fetch_data_dashboard_monthly_summary.php b/includes/fetch_data_dashboard_monthly_summary.php
index e3de3bd..dd5e877 100755
--- a/includes/fetch_data_dashboard_monthly_summary.php
+++ b/includes/fetch_data_dashboard_monthly_summary.php
@@ -97,12 +97,12 @@ if($file_used=="sql_table")
$months = array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");
- $projected_amounts ='';
+ $projected_amounts = array();
foreach($months as $month){
$key= $month;
$value=get_option(__PW_REPORT_WCREPORT_FIELDS_PERFIX__.'monthes_'.$pw_cur_projected_sales_year.'_'.$month);
if($value=='')
- $value=$month;
+ $value = 0; //$month;
$projected_amounts[$key]=$value;
}
diff --git a/includes/fetch_data_dashboard_report.php b/includes/fetch_data_dashboard_report.php
index 0121ce8..419aa8c 100755
--- a/includes/fetch_data_dashboard_report.php
+++ b/includes/fetch_data_dashboard_report.php
@@ -175,7 +175,7 @@
//////////////////////////////////
$months = array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");
- $projected_amounts ='';
+ $projected_amounts = array();
foreach($months as $month){
$key= $month;
$value=get_option(__PW_REPORT_WCREPORT_FIELDS_PERFIX__.'monthes_'.$pw_cur_projected_sales_year.'_'.$month);
@@ -197,7 +197,7 @@
$months = array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");
- $projected_amounts ='';
+ $projected_amounts = array();
foreach($months as $month){
$key= $month;
$value=get_option(__PW_REPORT_WCREPORT_FIELDS_PERFIX__.'monthes_'.$pw_cur_projected_sales_year.'_'.$month);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment