| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Class LP_Template_Checkout |
| 5 |
* |
| 6 |
* Groups templates related checkout page |
| 7 |
* |
| 8 |
* @since 3.x.x |
| 9 |
*/ |
| 10 |
class LP_Template_Checkout extends LP_Abstract_Template { |
| 11 |
|
| 12 |
/** |
| 13 |
* LP_Template_Checkout constructor. |
| 14 |
*/ |
| 15 |
public function __construct() { |
| 16 |
parent::__construct(); |
| 17 |
} |
| 18 |
|
| 19 |
public function review_order() { |
| 20 |
$cart = LearnPress::instance()->cart; |
| 21 |
learn_press_get_template( 'checkout/review-order', compact( 'cart' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
public function payment() { |
| 25 |
$available_gateways = LP_Gateways::instance()->get_available_payment_gateways(); |
| 26 |
|
| 27 |
learn_press_get_template( 'checkout/payment.php', array( 'available_gateways' => $available_gateways ) ); |
| 28 |
} |
| 29 |
|
| 30 |
public function order_comment() { |
| 31 |
learn_press_get_template( 'checkout/order-comment.php' ); |
| 32 |
} |
| 33 |
|
| 34 |
public function account_logged_in() { |
| 35 |
if ( ! is_user_logged_in() ) { |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
learn_press_get_template( 'checkout/account-logged-in' ); |
| 40 |
} |
| 41 |
|
| 42 |
public function account_login() { |
| 43 |
if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_login() ) { |
| 44 |
return; |
| 45 |
} |
| 46 |
|
| 47 |
learn_press_get_template( 'checkout/account-login' ); |
| 48 |
} |
| 49 |
|
| 50 |
public function account_register() { |
| 51 |
if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_register() ) { |
| 52 |
return; |
| 53 |
} |
| 54 |
|
| 55 |
learn_press_get_template( 'checkout/account-register' ); |
| 56 |
} |
| 57 |
|
| 58 |
public function guest_checkout() { |
| 59 |
if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_guest_checkout() ) { |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
learn_press_get_template( 'checkout/guest-checkout' ); |
| 64 |
} |
| 65 |
|
| 66 |
public function terms() { |
| 67 |
learn_press_get_template( 'checkout/term-conditions' ); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
return new LP_Template_Checkout(); |
| 72 |
|