| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying reviewing before placing order. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/learnpress/checkout/review-order.php. |
| 6 |
* |
| 7 |
* @author ThimPress |
| 8 |
* @package Learnpress/Templates |
| 9 |
* @version 4.0.3 |
| 10 |
*/ |
| 11 |
|
| 12 |
use LearnPress\Models\CourseModel; |
| 13 |
use LearnPress\TemplateHooks\Course\SingleCourseTemplate; |
| 14 |
|
| 15 |
defined( 'ABSPATH' ) || exit(); |
| 16 |
/** |
| 17 |
* @var LP_Cart $cart |
| 18 |
*/ |
| 19 |
if ( ! isset( $cart ) || ! $cart ) { |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
$singleCourseTemplate = SingleCourseTemplate::instance(); |
| 24 |
?> |
| 25 |
|
| 26 |
<div id="checkout-order" class="lp-checkout-block right"> |
| 27 |
|
| 28 |
<h4><?php esc_html_e( 'Your order', 'learnpress' ); ?></h4> |
| 29 |
|
| 30 |
<div class="lp-checkout-order__inner"> |
| 31 |
<table> |
| 32 |
<tbody> |
| 33 |
|
| 34 |
<?php |
| 35 |
do_action( 'learn_press_review_order_before_cart_contents' ); |
| 36 |
do_action( 'learn-press/review-order/before-cart-contents' ); |
| 37 |
|
| 38 |
$items = $cart->get_items(); |
| 39 |
|
| 40 |
if ( $items ) { |
| 41 |
foreach ( $items as $cart_item_key => $cart_item ) { |
| 42 |
$cart_item = apply_filters( 'learn-press/review-order/cart-item', $cart_item ); |
| 43 |
$item_id = $cart_item['item_id']; |
| 44 |
|
| 45 |
$itemModel = apply_filters( |
| 46 |
'learn-press/review-order/item', |
| 47 |
CourseModel::find( $item_id, true ), |
| 48 |
$cart_item |
| 49 |
); |
| 50 |
|
| 51 |
if ( has_filter( 'learn-press/review-order/cart-item-product' ) ) { |
| 52 |
$itemModel = apply_filters( 'learn-press/review-order/cart-item-product', learn_press_get_course( $item_id ), $cart_item ); |
| 53 |
} |
| 54 |
|
| 55 |
if ( $itemModel instanceof LP_Course ) { |
| 56 |
$itemModel = CourseModel::find( $itemModel->get_id(), true ); |
| 57 |
} |
| 58 |
|
| 59 |
if ( $itemModel instanceof CourseModel ) { |
| 60 |
?> |
| 61 |
<tr class="cart-item"> |
| 62 |
<td class="course-thumbnail"> |
| 63 |
<?php |
| 64 |
echo $singleCourseTemplate->html_image( $itemModel ) |
| 65 |
?> |
| 66 |
</td> |
| 67 |
<td class="course-name"> |
| 68 |
<?php |
| 69 |
echo sprintf( |
| 70 |
'<a href="%s" class="course-name">%s</a>', |
| 71 |
esc_url_raw( |
| 72 |
apply_filters( |
| 73 |
'learn-press/review-order/cart-item-link', |
| 74 |
$itemModel->get_permalink(), |
| 75 |
$cart_item |
| 76 |
) |
| 77 |
), |
| 78 |
wp_kses_post( |
| 79 |
apply_filters( |
| 80 |
'learn-press/review-order/cart-item-name', |
| 81 |
$singleCourseTemplate->html_title( $itemModel ), |
| 82 |
$cart_item, |
| 83 |
$cart_item_key |
| 84 |
) |
| 85 |
) |
| 86 |
) |
| 87 |
?> |
| 88 |
|
| 89 |
<?php |
| 90 |
if ( $cart_item['quantity'] > 1 ) { |
| 91 |
echo wp_kses_post( |
| 92 |
apply_filters( |
| 93 |
'learn-press/review-order/cart-item-quantity', |
| 94 |
sprintf( |
| 95 |
'<strong class="course-quantity"> × %s</strong>', |
| 96 |
$cart_item['quantity'] |
| 97 |
), |
| 98 |
$cart_item, |
| 99 |
$cart_item_key |
| 100 |
) |
| 101 |
); |
| 102 |
} |
| 103 |
?> |
| 104 |
</td> |
| 105 |
<td class="course-total col-number"> |
| 106 |
<?php |
| 107 |
echo apply_filters( |
| 108 |
'learn-press/review-order/cart-item-subtotal', |
| 109 |
$cart->get_item_subtotal( $itemModel, $cart_item['quantity'] ), |
| 110 |
$cart_item, |
| 111 |
$cart_item_key |
| 112 |
); |
| 113 |
?> |
| 114 |
</td> |
| 115 |
</tr> |
| 116 |
<?php |
| 117 |
} else { |
| 118 |
?> |
| 119 |
<tr class="cart-item"> |
| 120 |
<?php do_action( 'learn-press/checkout/cart-item', $itemModel, $cart_item ); ?> |
| 121 |
</tr> |
| 122 |
<?php |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
do_action( 'learn-press/review-order/after-cart-contents' ); |
| 128 |
do_action( 'learn_press_review_order_after_cart_contents' ); |
| 129 |
?> |
| 130 |
|
| 131 |
</tbody> |
| 132 |
|
| 133 |
<tfoot> |
| 134 |
<tr class="cart-subtotal"> |
| 135 |
|
| 136 |
<?php do_action( 'learn-press/review-order/before-subtotal-row' ); ?> |
| 137 |
|
| 138 |
<th colspan="2"><?php _e( 'Subtotal', 'learnpress' ); ?></th> |
| 139 |
<td class="col-number"><?php echo esc_html( $cart->get_subtotal() ); ?></td> |
| 140 |
|
| 141 |
<?php do_action( 'learn-press/review-order/after-subtotal-row' ); ?> |
| 142 |
</tr> |
| 143 |
|
| 144 |
<?php |
| 145 |
do_action( 'learn_press_review_order_before_order_total' ); |
| 146 |
do_action( 'learn-press/review-order/before-order-total' ); |
| 147 |
?> |
| 148 |
|
| 149 |
<tr class="order-total"> |
| 150 |
<?php do_action( 'learn-press/review-order/before-total-row' ); ?> |
| 151 |
|
| 152 |
<th colspan="2"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> |
| 153 |
<td class="col-number"><?php echo esc_html( $cart->get_total() ); ?></td> |
| 154 |
|
| 155 |
<?php do_action( 'learn-press/review-order/after-total-row' ); ?> |
| 156 |
</tr> |
| 157 |
|
| 158 |
<?php |
| 159 |
do_action( 'learn-press/review-order/after-order-total' ); |
| 160 |
do_action( 'learn_press_review_order_after_order_total' ); |
| 161 |
?> |
| 162 |
|
| 163 |
</tfoot> |
| 164 |
</table> |
| 165 |
</div> |
| 166 |
</div> |
| 167 |
|