-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01d78be
commit c5ac9ee
Showing
16 changed files
with
734 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('wc-currency', 'wp-hooks', 'wp-i18n'), 'version' => '7b6f317d163d5c7b12c941a24e999608'); | ||
<?php return array('dependencies' => array('wc-currency', 'wp-hooks', 'wp-i18n'), 'version' => '88284d9f0100029c3f4db1731212c699'); |
Large diffs are not rendered by default.
Oops, something went wrong.
127 changes: 127 additions & 0 deletions
127
includes/analytics/class-alg-wc-cog-analytics-customers.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
/** | ||
* Cost of Goods for WooCommerce - Analytics - Orders. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* @author WPFactory | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} // Exit if accessed directly | ||
|
||
use Automattic\WooCommerce\Utilities\OrderUtil; | ||
|
||
if ( ! class_exists( 'Alg_WC_Cost_of_Goods_Analytics_Customers' ) ) : | ||
|
||
class Alg_WC_Cost_of_Goods_Analytics_Customers { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
*/ | ||
function __construct() { | ||
// Script localization info. | ||
add_filter( 'alg_wc_cog_analytics_localization_info', array( $this, 'add_analytics_localization_info' ) ); | ||
|
||
// Costs. | ||
add_filter( 'woocommerce_analytics_clauses_join_customers_subquery', array( $this, 'add_costs_join_customers' ) ); | ||
add_filter( 'woocommerce_analytics_clauses_select_customers_subquery', array( $this, 'add_costs_select_orders_stats_total' ) ); | ||
|
||
// Profit. | ||
add_filter( 'woocommerce_analytics_clauses_join_customers_subquery', array( $this, 'add_profit_join_customers' ) ); | ||
add_filter( 'woocommerce_analytics_clauses_select_customers_subquery', array( $this, 'add_profit_select_orders_stats_total' ) ); | ||
} | ||
|
||
/** | ||
* add_analytics_localization_info. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* | ||
* @param $info | ||
* | ||
* @return mixed | ||
*/ | ||
function add_analytics_localization_info( $info ) { | ||
$info['cost_and_profit_columns_enabled_on_customers'] = 'yes' ===alg_wc_cog_get_option( 'alg_wc_cog_analytics_customers_cost_and_profit_columns', 'no' ); | ||
return $info; | ||
} | ||
|
||
/** | ||
* add_costs_select_orders_stats_total. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* | ||
* @param $clauses | ||
* | ||
* @return mixed | ||
*/ | ||
function add_costs_select_orders_stats_total( $clauses ) { | ||
if ( 'yes' === alg_wc_cog_get_option( 'alg_wc_cog_analytics_customers_cost_and_profit_columns', 'no' ) ) { | ||
$clauses[] = alg_wc_cog()->core->analytics->orders->get_order_costs_total_meta_select_clauses(); | ||
} | ||
return $clauses; | ||
} | ||
|
||
/** | ||
* add_costs_join_customers. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* | ||
* @param $clauses | ||
* | ||
* @return mixed | ||
*/ | ||
function add_costs_join_customers( $clauses ) { | ||
if ( 'yes' === alg_wc_cog_get_option( 'alg_wc_cog_analytics_customers_cost_and_profit_columns', 'no' ) ) { | ||
$clauses[] = alg_wc_cog()->core->analytics->orders->get_order_cost_meta_join_clauses(); | ||
} | ||
|
||
return $clauses; | ||
} | ||
|
||
/** | ||
* add_profit_join_customers. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* | ||
* @param $clauses | ||
* | ||
* @return mixed | ||
*/ | ||
function add_profit_join_customers( $clauses ) { | ||
if ( 'yes' === alg_wc_cog_get_option( 'alg_wc_cog_analytics_customers_cost_and_profit_columns', 'no' ) ) { | ||
$clauses[] = alg_wc_cog()->core->analytics->orders->get_order_profit_meta_join_clauses(); | ||
} | ||
return $clauses; | ||
} | ||
|
||
/** | ||
* add_profit_select_orders_stats_total. | ||
* | ||
* @version 3.4.6 | ||
* @since 3.4.6 | ||
* | ||
* @param $clauses | ||
* | ||
* @return mixed | ||
*/ | ||
function add_profit_select_orders_stats_total( $clauses ) { | ||
if ( 'yes' === alg_wc_cog_get_option( 'alg_wc_cog_analytics_customers_cost_and_profit_columns', 'no' ) ) { | ||
$clauses[] = alg_wc_cog()->core->analytics->orders->get_order_profit_total_meta_select_clauses(); | ||
} | ||
return $clauses; | ||
} | ||
|
||
} | ||
|
||
endif; | ||
|
||
return new Alg_WC_Cost_of_Goods_Analytics_Customers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.