PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | templates/checkout/review-order.php +76 -27 4.1.6.9.2 → 4.4.9 View file →
@@ -5,18 +5,23 @@
5 5 * This template can be overridden by copying it to yourtheme/learnpress/checkout/review-order.php.
6 6 *
7 7 * @author ThimPress
8 8 * @package Learnpress/Templates
9 - * @version 4.0.1
9 + * @version 4.0.3
10 10 */
11 11
12 +use LearnPress\Models\CourseModel;
13 +use LearnPress\TemplateHooks\Course\SingleCourseTemplate;
14 +
12 15 defined( 'ABSPATH' ) || exit();
13 -
14 -// $cart = learn_press_get_checkout_cart();
15 -
16 -if ( ! isset( $cart ) ) {
16 +/**
17 + * @var LP_Cart $cart
18 + */
19 +if ( ! isset( $cart ) || ! $cart ) {
17 20 return;
18 21 }
22 +
23 +$singleCourseTemplate = SingleCourseTemplate::instance();
19 24 ?>
20 25
21 26 <div id="checkout-order" class="lp-checkout-block right">
22 27
@@ -21,10 +26,10 @@
21 26 <div id="checkout-order" class="lp-checkout-block right">
22 27
23 28 <h4><?php esc_html_e( 'Your order', 'learnpress' ); ?></h4>
24 29
25 - <div class="lp-checkout-order__inner">
26 - <table>
30 + <div class="lp-checkout-order__inner lp-table-wrap">
31 + <table class="lp-list-table">
27 32 <tbody>
28 33
29 34 <?php
30 35 do_action( 'learn_press_review_order_before_cart_contents' );
@@ -35,42 +40,86 @@
35 40 if ( $items ) {
36 41 foreach ( $items as $cart_item_key => $cart_item ) {
37 42 $cart_item = apply_filters( 'learn-press/review-order/cart-item', $cart_item );
38 43 $item_id = $cart_item['item_id'];
39 - $_course = apply_filters( 'learn-press/review-order/cart-item-product', learn_press_get_course( $item_id ), $cart_item );
40 44
41 - if ( $_course && 0 < $cart_item['quantity'] ) {
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 ) {
42 60 ?>
43 - <tr class="<?php echo esc_attr( apply_filters( 'learn-press/review-order/cart-item-class', 'cart-item', $cart_item, $cart_item_key ) ); ?>">
44 - <?php
45 - do_action( 'learn_press_review_order_before_cart_item', $cart_item );
46 - do_action( 'learn-press/review-order/before-cart-item', $cart_item, $cart_item_key );
47 - ?>
48 -
61 + <tr class="cart-item">
49 62 <td class="course-thumbnail">
50 - <?php echo wp_kses_post( $_course->get_image() ); ?>
63 + <?php
64 + echo $singleCourseTemplate->html_image( $itemModel )
65 + ?>
51 66 </td>
52 67 <td class="course-name">
53 - <a href="<?php echo esc_url_raw( apply_filters( 'learn-press/review-order/cart-item-link', get_the_permalink( $item_id ), $cart_item ) ); ?>">
54 - <?php echo wp_kses_post( apply_filters( 'learn-press/review-order/cart-item-name', $_course->get_title(), $cart_item, $cart_item_key ) ); ?>
55 - </a>
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 + ?>
56 88
57 89 <?php
58 90 if ( $cart_item['quantity'] > 1 ) {
59 - echo wp_kses_post( apply_filters( 'learn-press/review-order/cart-item-quantity', ' <strong class="course-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ) );
91 + echo wp_kses_post(
92 + apply_filters(
93 + 'learn-press/review-order/cart-item-quantity',
94 + sprintf(
95 + '<strong class="course-quantity"> &times; %s</strong>',
96 + $cart_item['quantity']
97 + ),
98 + $cart_item,
99 + $cart_item_key
100 + )
101 + );
60 102 }
61 103 ?>
62 104 </td>
63 105 <td class="course-total col-number">
64 - <?php echo esc_html( apply_filters( 'learn-press/review-order/cart-item-subtotal', $cart->get_item_subtotal( $_course, $cart_item['quantity'] ), $cart_item, $cart_item_key ) ); ?>
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 + ?>
65 114 </td>
66 -
67 - <?php
68 - do_action( 'learn-press/review-order/after-cart-item', $cart_item, $cart_item_key );
69 - do_action( 'learn_press_review_order_after_cart_item', $cart_item );
70 - ?>
71 115 </tr>
72 -
116 + <?php
117 + } else {
118 + ?>
119 + <tr class="cart-item">
120 + <?php do_action( 'learn-press/checkout/cart-item', $itemModel, $cart_item ); ?>
121 + </tr>
73 122 <?php
74 123 }
75 124 }
76 125 }