← All changes
|
includes/Admin/Elementor/Fundraising_Campaign_Widget.php
+8
-12
2.2.1
→
2.4.1
View file →
| @@ -76,9 +76,11 @@ | ||
| 76 | 76 | return 'https://betterpayment.co/docs/configure-fundraising-campaign-in-better-payment'; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function get_style_depends() { |
| 80 | - return apply_filters( 'better_payment/elementor/editor/get_style_depends', [ 'fundraising-campaign-style' ] ); | |
| 80 | + // Better Payment Pro adds its Updates tab styles here, and needs this widget | |
| 81 | + // passed to tell it apart from the other widgets on the filter. | |
| 82 | + return apply_filters( 'better_payment/elementor/editor/get_style_depends', [ 'fundraising-campaign-style' ], $this ); | |
| 81 | 83 | } |
| 82 | 84 | |
| 83 | 85 | public function get_script_depends() { |
| 84 | 86 | return apply_filters( 'better_payment/elementor/editor/get_script_depends', [ 'fundraising-campaign-script' ] ); |
| @@ -3696,19 +3698,13 @@ | ||
| 3696 | 3698 | $bpc_raised_amount_data = $wpdb->get_results( |
| 3697 | 3699 | $wpdb->prepare( "SELECT * FROM $table WHERE campaign_id=%s", sanitize_text_field( $better_payment_campaign_id ) ) |
| 3698 | 3700 | ); |
| 3699 | 3701 | |
| 3700 | - $bpc_total_amount_raised = 0; | |
| 3701 | - $bpc_total_payment_count = 0; | |
| 3702 | - | |
| 3703 | - if ( ! empty( $bpc_raised_amount_data ) ) { | |
| 3704 | - foreach ( $bpc_raised_amount_data as $payment_record ) { | |
| 3705 | - if ( ! empty( $payment_record->status ) && 'paid' === $payment_record->status ) { | |
| 3706 | - $bpc_total_amount_raised += floatval( $payment_record->amount ); | |
| 3707 | - $bpc_total_payment_count++; | |
| 3708 | - } | |
| 3709 | - } | |
| 3710 | - } | |
| 3702 | + // The same rows CampaignStats counts (approved statuses incl. Paystack's `success`, | |
| 3703 | + // a confirmed legacy free checkout worth 0), not only Stripe's `paid`. | |
| 3704 | + $bpc_totals = \Better_Payment\Lite\Classes\Helper::campaign_totals_from_rows( $bpc_raised_amount_data ); | |
| 3705 | + $bpc_total_amount_raised = $bpc_totals['amount']; | |
| 3706 | + $bpc_total_payment_count = $bpc_totals['count']; | |
| 3711 | 3707 | |
| 3712 | 3708 | $bpc_goal_percentage = 0; |
| 3713 | 3709 | if ( ! empty( $bp_goal_amount ) && $bp_goal_amount > 0 && $bpc_total_amount_raised > 0 ) { |
| 3714 | 3710 | $bpc_goal_percentage = floor( ( $bpc_total_amount_raised / floatval( $bp_goal_amount ) ) * 100 ); |