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.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / ecommerce / checkout.php
tutor / templates / ecommerce Last commit date
billing-form-fields.php 1 year ago billing.php 1 year ago cart.php 1 year ago checkout-details.php 1 year ago checkout.php 1 year ago order-placement-failed.php 1 year ago order-placement-success.php 1 year ago
checkout.php
191 lines
1 <?php
2 /**
3 * Checkout Template.
4 *
5 * @package Tutor\Views
6 * @author Themeum <support@themeum.com>
7 * @link https://themeum.com
8 * @since 3.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 use Tutor\Ecommerce\CheckoutController;
16 use Tutor\Ecommerce\CartController;
17 use TUTOR\Input;
18
19 $user_id = apply_filters( 'tutor_checkout_user_id', get_current_user_id() );
20
21 $tutor_toc_page_link = tutor_utils()->get_toc_page_link();
22 $tutor_privacy_page_link = tutor_utils()->get_privacy_page_link();
23
24 $cart_controller = new CartController();
25 $get_cart = $cart_controller->get_cart_items();
26 $courses = $get_cart['courses'];
27 $total_count = $courses['total_count'];
28 $course_list = $courses['results'];
29 $subtotal = 0;
30 $course_ids = implode( ', ', array_values( array_column( $course_list, 'ID' ) ) );
31 $plan_id = Input::get( 'plan', 0, Input::TYPE_INT );
32
33 $is_checkout_page = true;
34
35 ?>
36 <div class="tutor-checkout-page">
37 <div class="tutor-container">
38 <div class="tutor-checkout-container">
39 <?php
40 $echo_before_return = true;
41 $user_has_subscription = apply_filters( 'tutor_checkout_user_has_subscription', false, $plan_id, $echo_before_return );
42 if ( $user_has_subscription ) {
43 return;
44 }
45 ?>
46
47 <form method="post" id="tutor-checkout-form">
48 <?php tutor_nonce_field(); ?>
49 <input type="hidden" name="tutor_action" value="tutor_pay_now">
50 <div class="tutor-row tutor-g-5">
51 <div class="tutor-col-md-6" tutor-checkout-details>
52 <?php
53 $file = __DIR__ . '/checkout-details.php';
54 if ( file_exists( $file ) ) {
55 include $file;
56 }
57 ?>
58 </div>
59 <div class="tutor-col-md-6">
60 <div class="tutor-checkout-billing">
61 <div class="tutor-checkout-billing-inner">
62 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24">
63 <?php echo esc_html_e( 'Billing Address', 'tutor' ); ?>
64 </h5>
65
66 <div class="tutor-billing-fields">
67 <?php require tutor()->path . 'templates/ecommerce/billing-form-fields.php'; ?>
68 </div>
69
70 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24 tutor-mt-20">
71 <?php esc_html_e( 'Payment Method', 'tutor' ); ?>
72 </h5>
73 <div class="tutor-checkout-payment-options tutor-mb-24">
74 <input type="hidden" name="payment_type">
75 <?php
76 $payment_gateways = tutor_get_all_active_payment_gateways();
77 if ( empty( $payment_gateways ) ) {
78 ?>
79 <div class="tutor-alert tutor-warning">
80 <?php esc_html_e( 'No payment method has been configured. Please contact the site administrator.', 'tutor' ); ?>
81 </div>
82 <?php
83 } else {
84 $supported_gateways = tutor_get_supported_payment_gateways( $plan_id );
85
86 if ( empty( $supported_gateways ) ) {
87 ?>
88
89 <div class="tutor-alert tutor-warning">
90 <?php esc_html_e( 'No payment method found. Please contact the site administrator.', 'tutor' ); ?>
91 </div>
92 <?php
93 } else {
94 foreach ( $supported_gateways as $gateway ) {
95 list( 'is_manual' => $is_manual, 'name' => $name, 'label' => $label, 'icon' => $icon ) = $gateway;
96
97 if ( $is_manual ) {
98 ?>
99 <label class="tutor-checkout-payment-item" data-payment-method="<?php echo esc_attr( $name ); ?>" data-payment-type="manual" data-payment-details="<?php echo esc_attr( $gateway['additional_details'] ?? '' ); ?>" data-payment-instruction="<?php echo esc_attr( $gateway['payment_instructions'] ?? '' ); ?>">
100 <input type="radio" value="<?php echo esc_attr( $name ); ?>" name="payment_method" class="tutor-form-check-input" required>
101 <div class="tutor-payment-item-content">
102 <?php if ( ! empty( $icon ) ) : ?>
103 <img src ="<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
104 <?php endif; ?>
105 <?php echo esc_html( $label ); ?>
106 </div>
107 </label>
108 <?php
109 } else {
110 ?>
111 <label class="tutor-checkout-payment-item" data-payment-type="automate">
112 <input type="radio" name="payment_method" value="<?php echo esc_attr( $name ); ?>" class="tutor-form-check-input" <?php echo count( $supported_gateways ) === 1 ? 'checked' : ''; ?> required>
113 <div class="tutor-payment-item-content">
114 <?php if ( ! empty( $icon ) ) : ?>
115 <img src = "<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
116 <?php endif; ?>
117 <?php echo esc_html( $label ); ?>
118 </div>
119 </label>
120 <?php
121 }
122 }
123 }
124 }
125 ?>
126 </div>
127
128 <div class="tutor-payment-instructions tutor-mb-20 tutor-d-none"></div>
129
130 <?php if ( null !== $tutor_toc_page_link ) : ?>
131 <div class="tutor-mb-16">
132 <div class="tutor-form-check tutor-d-flex">
133 <input type="checkbox" id="tutor_checkout_agree_to_terms" name="agree_to_terms" class="tutor-form-check-input" required>
134 <label for="tutor_checkout_agree_to_terms">
135 <span class="tutor-color-subdued tutor-fw-normal">
136 <?php esc_html_e( 'I agree with the website\'s', 'tutor' ); ?>
137 <a target="_blank" href="<?php echo esc_url( $tutor_toc_page_link ); ?>" class="tutor-color-primary"><?php esc_html_e( 'Terms of Use', 'tutor' ); ?></a>
138 <?php if ( null !== $tutor_privacy_page_link ) : ?>
139 <?php esc_html_e( 'and', 'tutor' ); ?>
140 <a target="_blank" href="<?php echo esc_url( $tutor_privacy_page_link ); ?>" class="tutor-color-primary"><?php esc_html_e( 'Privacy Policy', 'tutor' ); ?></a>
141 <?php endif; ?>
142 </span>
143 </label>
144 </div>
145 </div>
146 <?php endif; ?>
147
148 <!-- handle errors -->
149 <?php
150 $pay_now_errors = get_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
151 $pay_now_alert_msg = get_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
152
153 delete_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
154 delete_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
155 if ( $pay_now_errors || $pay_now_alert_msg ) :
156 ?>
157 <div class="tutor-break-word">
158 <?php
159 if ( ! empty( $pay_now_alert_msg ) ) :
160 list( $alert, $message ) = array_values( $pay_now_alert_msg );
161 ?>
162 <div class="tutor-alert tutor-<?php echo esc_attr( $alert ); ?>">
163 <div class="tutor-color-<?php echo esc_attr( $alert ); ?>"><?php echo esc_html( $message ); ?></div>
164 </div>
165 <?php endif; ?>
166
167 <?php if ( is_array( $pay_now_errors ) && count( $pay_now_errors ) ) : ?>
168 <div class="tutor-alert tutor-danger">
169 <ul class="tutor-mb-0">
170 <?php foreach ( $pay_now_errors as $pay_now_err ) : ?>
171 <li class="tutor-color-danger"><?php echo esc_html( ucfirst( str_replace( '_', ' ', $pay_now_err ) ) ); ?></li>
172 <?php endforeach; ?>
173 </ul>
174 </div>
175 <?php endif; ?>
176 </div>
177 <?php endif; ?>
178 <!-- handle errors end -->
179
180 <button type="submit" id="tutor-checkout-pay-now-button" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-w-100 tutor-justify-center">
181 <?php esc_html_e( 'Pay Now', 'tutor' ); ?>
182 </button>
183 </div>
184 </div>
185 </div>
186 </div>
187 </form>
188 </div>
189 </div>
190 </div>
191