← All changes
|
includes/admin/components/analytics/coupon/summary.php
+5
-5
1.6.8
→
2.7.0
View file →
| @@ -67,9 +67,9 @@ | ||
| 67 | 67 | $sellkit_prefix = Database::DATABASE_PREFIX; |
| 68 | 68 | $discount_table = "{$wpdb->prefix}{$sellkit_prefix}applied_coupon"; |
| 69 | 69 | $posts_table = "{$wpdb->prefix}posts "; |
| 70 | 70 | $posts_meta_table = "{$wpdb->prefix}postmeta "; |
| 71 | - $coupon_start_date = date( 'Y-m-d H:i:s', time() - ( 60 * 60 * 24 * Analytics::$date_range ) ); | |
| 71 | + $coupon_start_date = gmdate( 'Y-m-d H:i:s', time() - ( 60 * 60 * 24 * Analytics::$date_range ) ); | |
| 72 | 72 | |
| 73 | 73 | // phpcs:disable |
| 74 | 74 | $coupons = $wpdb->get_results( |
| 75 | 75 | $wpdb->prepare( "SELECT count(*) as created_coupon FROM {$posts_table} AS p |
| @@ -90,10 +90,10 @@ | ||
| 90 | 90 | $wpdb->prepare( "SELECT SUM( revenue ) as revenue, SUM( total_discount ) as total_discount FROM {$discount_table} |
| 91 | 91 | where applied_at > {$start_date} and rule_id " . Analytics::target_id_condition( $rule_id ) . " %d", $rule_id ), |
| 92 | 92 | ARRAY_A ); |
| 93 | 93 | |
| 94 | - $this->data['revenue'] = ! empty( $monetary_data[0]['revenue'] ) ? $monetary_data[0]['revenue'] : 0; | |
| 95 | - $this->data['total_discount'] = ! empty( $monetary_data[0]['total_discount'] ) ? $monetary_data[0]['total_discount'] : 0; | |
| 94 | + $this->data['revenue'] = ! empty( $monetary_data[0]['revenue'] ) ? round( $monetary_data[0]['revenue'], 2 ) : 0; | |
| 95 | + $this->data['total_discount'] = ! empty( $monetary_data[0]['total_discount'] ) ? round( $monetary_data[0]['total_discount'], 2 ) : 0; | |
| 96 | 96 | |
| 97 | 97 | $customers = $wpdb->get_results( |
| 98 | 98 | $wpdb->prepare( "SELECT count(DISTINCT(email)) as customers FROM {$discount_table} |
| 99 | 99 | where applied_at > {$start_date} and rule_id " . Analytics::target_id_condition( $rule_id ) . " %d GROUP BY email; ", $rule_id ), |
| @@ -106,11 +106,11 @@ | ||
| 106 | 106 | $this->data['conversion_rate'] = 0; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ( ! empty( $this->data['used_coupon'] ) ) { |
| 110 | - $this->data['conversion_rate'] = ( $this->data['used_coupon'] / $this->data['created_coupon'] ) * 100; | |
| 110 | + $this->data['conversion_rate'] = ( $this->data['customers'] / $this->data['created_coupon'] ) * 100; | |
| 111 | 111 | $this->data['conversion_rate'] = floatval( number_format( $this->data['conversion_rate'], 2 ) ); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $this->data['target_title'] = get_the_title( $rule_id ); | |
| 114 | + $this->data['target_title'] = sellkit_decode_entity_title( get_the_title( $rule_id ) ); | |
| 115 | 115 | } |
| 116 | 116 | } |