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
billing-form-fields.php
136 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Billing form fields child template |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Dashboard\Settings |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 3.0.0 |
| 10 | */ |
| 11 | |
| 12 | use Tutor\Ecommerce\BillingController; |
| 13 | |
| 14 | $billing_controller = new BillingController( false ); |
| 15 | $billing_info = $billing_controller->get_billing_info(); |
| 16 | |
| 17 | $billing_first_name = $billing_info->billing_first_name ?? ''; |
| 18 | $billing_last_name = $billing_info->billing_last_name ?? ''; |
| 19 | $billing_email = $billing_info->billing_email ?? ''; |
| 20 | $billing_phone = $billing_info->billing_phone ?? ''; |
| 21 | $billing_zip_code = $billing_info->billing_zip_code ?? ''; |
| 22 | $billing_address = $billing_info->billing_address ?? ''; |
| 23 | $billing_country = $billing_info->billing_country ?? ''; |
| 24 | $billing_state = $billing_info->billing_state ?? ''; |
| 25 | $billing_city = $billing_info->billing_city ?? ''; |
| 26 | |
| 27 | $country_info = tutor_get_country_info_by_name( $billing_country ); |
| 28 | $states = $country_info && isset( $country_info['states'] ) ? $country_info['states'] : array(); |
| 29 | ?> |
| 30 | |
| 31 | <div class="tutor-row <?php echo isset( $is_checkout_page ) ? 'tutor-g-0' : ''; ?>"> |
| 32 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6"> |
| 33 | <div class="tutor-mb-16"> |
| 34 | <label class="tutor-form-label tutor-color-secondary"> |
| 35 | <?php esc_html_e( 'First Name', 'tutor' ); ?> |
| 36 | </label> |
| 37 | <input class="tutor-form-control" type="text" name="billing_first_name" placeholder="<?php esc_attr_e( 'First Name', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_first_name ); ?>" required> |
| 38 | </div> |
| 39 | </div> |
| 40 | |
| 41 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6"> |
| 42 | <div class="tutor-mb-16"> |
| 43 | <label class="tutor-form-label tutor-color-secondary"> |
| 44 | <?php esc_html_e( 'Last Name', 'tutor' ); ?> |
| 45 | </label> |
| 46 | <input class="tutor-form-control" type="text" name="billing_last_name" placeholder="<?php esc_attr_e( 'Last Name', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_last_name ); ?>" required> |
| 47 | </div> |
| 48 | </div> |
| 49 | |
| 50 | <div class="tutor-col-12"> |
| 51 | <div class="tutor-mb-16"> |
| 52 | <label class="tutor-form-label tutor-color-secondary"> |
| 53 | <?php esc_html_e( 'Email Address', 'tutor' ); ?> |
| 54 | </label> |
| 55 | <input class="tutor-form-control" type="email" name="billing_email" placeholder="<?php esc_attr_e( 'Email Address', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_email ); ?>" required> |
| 56 | </div> |
| 57 | </div> |
| 58 | <div class="tutor-col-12 tutor-position-relative"> |
| 59 | <div class="tutor-mb-16"> |
| 60 | <label class="tutor-form-label tutor-color-secondary"> |
| 61 | <?php esc_html_e( 'Country', 'tutor' ); ?> |
| 62 | </label> |
| 63 | <select name="billing_country" class="tutor-form-control" required> |
| 64 | <option value=""><?php esc_html_e( 'Select Country', 'tutor' ); ?></option> |
| 65 | <?php |
| 66 | $countries = array_column( tutor_get_country_list(), 'name' ); |
| 67 | foreach ( $countries as $name ) : |
| 68 | ?> |
| 69 | <option value="<?php echo esc_attr( $name ); ?>" <?php selected( $billing_country, $name ); ?>> |
| 70 | <?php echo esc_html( $name ); ?> |
| 71 | </option> |
| 72 | <?php endforeach; ?> |
| 73 | </select> |
| 74 | </div> |
| 75 | </div> |
| 76 | |
| 77 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6 tutor-position-relative"> |
| 78 | <div class="tutor-mb-16"> |
| 79 | <label class="tutor-form-label tutor-color-secondary"> |
| 80 | <?php esc_html_e( 'State', 'tutor' ); ?> |
| 81 | </label> |
| 82 | <select name="billing_state" class="tutor-form-control"> |
| 83 | <?php if ( $billing_country && empty( $states ) ) : ?> |
| 84 | <option value=""><?php esc_html_e( 'N/A', 'tutor' ); ?></option> |
| 85 | <?php endif; ?> |
| 86 | <?php if ( $billing_country && ( $states ) ) : ?> |
| 87 | <option value=""><?php esc_html_e( 'Select State', 'tutor' ); ?></option> |
| 88 | <?php endif; ?> |
| 89 | <?php |
| 90 | foreach ( $states as $state ) : |
| 91 | ?> |
| 92 | <option value="<?php echo esc_attr( $state['name'] ); ?>" <?php selected( $billing_state, $state['name'] ); ?>> |
| 93 | <?php echo esc_html( $state['name'] ); ?> |
| 94 | </option> |
| 95 | <?php endforeach; ?> |
| 96 | </select> |
| 97 | </div> |
| 98 | </div> |
| 99 | |
| 100 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6"> |
| 101 | <div class="tutor-mb-16"> |
| 102 | <label class="tutor-form-label tutor-color-secondary"> |
| 103 | <?php esc_html_e( 'City', 'tutor' ); ?> |
| 104 | </label> |
| 105 | <input class="tutor-form-control" type="text" name="billing_city" placeholder="<?php esc_attr_e( 'City', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_city ); ?>" required> |
| 106 | </div> |
| 107 | </div> |
| 108 | |
| 109 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6"> |
| 110 | <div class="tutor-mb-16"> |
| 111 | <label class="tutor-form-label tutor-color-secondary"> |
| 112 | <?php esc_html_e( 'Postcode / ZIP', 'tutor' ); ?> |
| 113 | </label> |
| 114 | <input class="tutor-form-control" type="text" name="billing_zip_code" placeholder="<?php esc_attr_e( 'Postcode / ZIP', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_zip_code ); ?>" required> |
| 115 | </div> |
| 116 | </div> |
| 117 | |
| 118 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-12 tutor-col-lg-6"> |
| 119 | <div class="tutor-mb-16"> |
| 120 | <label class="tutor-form-label tutor-color-secondary"> |
| 121 | <?php esc_html_e( 'Phone', 'tutor' ); ?> |
| 122 | </label> |
| 123 | <input class="tutor-form-control" type="text" name="billing_phone" placeholder="<?php esc_attr_e( 'Phone', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_phone ); ?>" required> |
| 124 | </div> |
| 125 | </div> |
| 126 | |
| 127 | <div class="tutor-col-12"> |
| 128 | <div class="tutor-mb-16"> |
| 129 | <label class="tutor-form-label tutor-color-secondary"> |
| 130 | <?php esc_html_e( 'Address', 'tutor' ); ?> |
| 131 | </label> |
| 132 | <input class="tutor-form-control" type="text" name="billing_address" placeholder="<?php esc_attr_e( 'Address', 'tutor' ); ?>" value="<?php echo esc_attr( $billing_address ); ?>" required> |
| 133 | </div> |
| 134 | </div> |
| 135 | </div> |
| 136 |