| @@ -1,137 +1,137 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template for displaying order details. | |
| 4 | - * | |
| 5 | - * This template can be overridden by copying it to yourtheme/learnpress/order/order-details.php. | |
| 6 | - * | |
| 7 | - * @author ThimPress | |
| 8 | - * @package Learnpress/Templates | |
| 9 | - * @version 4.0.1 | |
| 10 | - * @deprecated 4.3.2.6 | |
| 11 | - */ | |
| 12 | - | |
| 13 | -_deprecated_file( __FILE__, '4.3.2.6' ); | |
| 14 | -return; | |
| 15 | - | |
| 16 | -defined( 'ABSPATH' ) || exit(); | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * @var LP_Order $order | |
| 20 | - */ | |
| 21 | -if ( ! isset( $order ) ) { | |
| 22 | - echo esc_html__( 'Invalid order', 'learnpress' ); | |
| 23 | - return; | |
| 24 | -} | |
| 25 | -?> | |
| 26 | - | |
| 27 | -<h3><?php esc_html_e( 'Order Details', 'learnpress' ); ?></h3> | |
| 28 | - | |
| 29 | -<table class="lp-list-table order-table-details"> | |
| 30 | - <thead> | |
| 31 | - <tr> | |
| 32 | - <th class="course-name"><?php esc_html_e( 'Item', 'learnpress' ); ?></th> | |
| 33 | - <th class="course-total"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 34 | - </tr> | |
| 35 | - </thead> | |
| 36 | - | |
| 37 | - <tbody> | |
| 38 | - <?php | |
| 39 | - $items = $order->get_items(); | |
| 40 | - if ( $items ) { | |
| 41 | - $currency_symbol = learn_press_get_currency_symbol( $order->get_currency() ); | |
| 42 | - | |
| 43 | - foreach ( $items as $item_id => $item ) { | |
| 44 | - if ( ! isset( $item['course_id'] ) ) { | |
| 45 | - continue; | |
| 46 | - } | |
| 47 | - | |
| 48 | - $price = (float) $item['subtotal']; | |
| 49 | - if ( $price <= 0 ) { | |
| 50 | - $price = __( 'Free', 'learnpress' ); | |
| 51 | - } else { | |
| 52 | - $price = learn_press_format_price( $price, $currency_symbol ); | |
| 53 | - } | |
| 54 | - | |
| 55 | - if ( apply_filters( 'learn-press/order/item-visible', true, $item ) ) { | |
| 56 | - $course = learn_press_get_course( $item['course_id'] ); | |
| 57 | - | |
| 58 | - if ( ! $course || ! $course->exists() ) { | |
| 59 | - ?> | |
| 60 | - <tr class="<?php echo esc_attr( apply_filters( 'learn-press/order/item-class', 'order-item', $item, $order ) ); ?>"> | |
| 61 | - <td class="course-name"> | |
| 62 | - <?php echo apply_filters( 'learn-press/order/item-name', sprintf( '%s', $item['name'] ), $item, $order ); ?> | |
| 63 | - </td> | |
| 64 | - <td class="course-total"> | |
| 65 | - <?php | |
| 66 | - echo '<span class="course-price">' . esc_html( $price ) . '</span>'; | |
| 67 | - ?> | |
| 68 | - </td> | |
| 69 | - </tr> | |
| 70 | - <?php | |
| 71 | - continue; | |
| 72 | - } | |
| 73 | - ?> | |
| 74 | - <tr class="<?php echo esc_attr( apply_filters( 'learn-press/order/item-class', 'order-item', $item, $order ) ); ?>"> | |
| 75 | - <td class="course-name"> | |
| 76 | - <?php | |
| 77 | - echo apply_filters( | |
| 78 | - 'learn-press/order/item-name', | |
| 79 | - sprintf( | |
| 80 | - '<a href="%s">%s</a>', | |
| 81 | - esc_url_raw( get_permalink( $item['course_id'] ) ), | |
| 82 | - esc_html( $item['name'] ) | |
| 83 | - ), | |
| 84 | - $item, | |
| 85 | - $order | |
| 86 | - ); | |
| 87 | - ?> | |
| 88 | - </td> | |
| 89 | - | |
| 90 | - <td class="course-total"> | |
| 91 | - <?php | |
| 92 | - $origin_price = $course->get_regular_price_html(); | |
| 93 | - | |
| 94 | - if ( $course->has_sale_price() ) { | |
| 95 | - echo '<span class="course-origin-price">' . wp_kses_post( $origin_price ) . '</span>'; | |
| 96 | - } | |
| 97 | - echo '<span class="course-price">' . wp_kses_post( $price ) . '</span>'; | |
| 98 | - ?> | |
| 99 | - </td> | |
| 100 | - </tr> | |
| 101 | - <?php | |
| 102 | - } | |
| 103 | - } | |
| 104 | - } | |
| 105 | - ?> | |
| 106 | - | |
| 107 | - <?php do_action( 'learn-press/order/items-table', $order ); ?> | |
| 108 | - </tbody> | |
| 109 | - | |
| 110 | - <tfoot> | |
| 111 | - <tr> | |
| 112 | - <th scope="row"><?php esc_html_e( 'Subtotal', 'learnpress' ); ?></th> | |
| 113 | - <td><?php echo esc_html( $order->get_formatted_order_subtotal() ); ?></td> | |
| 114 | - </tr> | |
| 115 | - | |
| 116 | - <?php do_action( 'learn-press/order/items-table-foot', $order ); ?> | |
| 117 | - | |
| 118 | - <tr> | |
| 119 | - <th scope="row"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 120 | - <td><?php echo esc_html( $order->get_formatted_order_total() ); ?></td> | |
| 121 | - </tr> | |
| 122 | - </tfoot> | |
| 123 | -</table> | |
| 124 | - | |
| 125 | -<p> | |
| 126 | - <strong><?php echo esc_html__( 'Order key:', 'learnpress' ); ?></strong> | |
| 127 | - <?php echo esc_html( $order->get_order_key() ); ?> | |
| 128 | -</p> | |
| 129 | - | |
| 130 | -<p> | |
| 131 | - <strong><?php esc_html_e( 'Order status:', 'learnpress' ); ?></strong> | |
| 132 | - <span class="lp-label label-<?php echo esc_attr( $order->get_status() ); ?>"> | |
| 133 | - <?php echo wp_kses_post( $order->get_order_status_html() ); ?> | |
| 134 | - </span> | |
| 135 | -</p> | |
| 136 | - | |
| 137 | -<?php do_action( 'learn-press/order/after-table-details', $order ); ?> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template for displaying order details. | |
| 4 | + * | |
| 5 | + * This template can be overridden by copying it to yourtheme/learnpress/order/order-details.php. | |
| 6 | + * | |
| 7 | + * @author ThimPress | |
| 8 | + * @package Learnpress/Templates | |
| 9 | + * @version 4.0.1 | |
| 10 | + * @deprecated 4.3.2.6 | |
| 11 | + */ | |
| 12 | + | |
| 13 | +_deprecated_file( __FILE__, '4.3.2.6' ); | |
| 14 | +return; | |
| 15 | + | |
| 16 | +defined( 'ABSPATH' ) || exit(); | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * @var LP_Order $order | |
| 20 | + */ | |
| 21 | +if ( ! isset( $order ) ) { | |
| 22 | + echo esc_html__( 'Invalid order', 'learnpress' ); | |
| 23 | + return; | |
| 24 | +} | |
| 25 | +?> | |
| 26 | + | |
| 27 | +<h3><?php esc_html_e( 'Order Details', 'learnpress' ); ?></h3> | |
| 28 | +<div class="lp-table-wrap"> | |
| 29 | + <table class="lp-list-table order-table-details"> | |
| 30 | + <thead> | |
| 31 | + <tr> | |
| 32 | + <th class="course-name"><?php esc_html_e( 'Item', 'learnpress' ); ?></th> | |
| 33 | + <th class="course-total"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 34 | + </tr> | |
| 35 | + </thead> | |
| 36 | + | |
| 37 | + <tbody> | |
| 38 | + <?php | |
| 39 | + $items = $order->get_items(); | |
| 40 | + if ( $items ) { | |
| 41 | + $currency_symbol = learn_press_get_currency_symbol( $order->get_currency() ); | |
| 42 | + | |
| 43 | + foreach ( $items as $item_id => $item ) { | |
| 44 | + if ( ! isset( $item['course_id'] ) ) { | |
| 45 | + continue; | |
| 46 | + } | |
| 47 | + | |
| 48 | + $price = (float) $item['subtotal']; | |
| 49 | + if ( $price <= 0 ) { | |
| 50 | + $price = __( 'Free', 'learnpress' ); | |
| 51 | + } else { | |
| 52 | + $price = learn_press_format_price( $price, $currency_symbol ); | |
| 53 | + } | |
| 54 | + | |
| 55 | + if ( apply_filters( 'learn-press/order/item-visible', true, $item ) ) { | |
| 56 | + $course = learn_press_get_course( $item['course_id'] ); | |
| 57 | + | |
| 58 | + if ( ! $course || ! $course->exists() ) { | |
| 59 | + ?> | |
| 60 | + <tr class="<?php echo esc_attr( apply_filters( 'learn-press/order/item-class', 'order-item', $item, $order ) ); ?>"> | |
| 61 | + <td class="course-name"> | |
| 62 | + <?php echo apply_filters( 'learn-press/order/item-name', sprintf( '%s', $item['name'] ), $item, $order ); ?> | |
| 63 | + </td> | |
| 64 | + <td class="course-total"> | |
| 65 | + <?php | |
| 66 | + echo '<span class="course-price">' . esc_html( $price ) . '</span>'; | |
| 67 | + ?> | |
| 68 | + </td> | |
| 69 | + </tr> | |
| 70 | + <?php | |
| 71 | + continue; | |
| 72 | + } | |
| 73 | + ?> | |
| 74 | + <tr class="<?php echo esc_attr( apply_filters( 'learn-press/order/item-class', 'order-item', $item, $order ) ); ?>"> | |
| 75 | + <td class="course-name"> | |
| 76 | + <?php | |
| 77 | + echo apply_filters( | |
| 78 | + 'learn-press/order/item-name', | |
| 79 | + sprintf( | |
| 80 | + '<a href="%s">%s</a>', | |
| 81 | + esc_url_raw( get_permalink( $item['course_id'] ) ), | |
| 82 | + esc_html( $item['name'] ) | |
| 83 | + ), | |
| 84 | + $item, | |
| 85 | + $order | |
| 86 | + ); | |
| 87 | + ?> | |
| 88 | + </td> | |
| 89 | + | |
| 90 | + <td class="course-total"> | |
| 91 | + <?php | |
| 92 | + $origin_price = $course->get_regular_price_html(); | |
| 93 | + | |
| 94 | + if ( $course->has_sale_price() ) { | |
| 95 | + echo '<span class="course-origin-price">' . wp_kses_post( $origin_price ) . '</span>'; | |
| 96 | + } | |
| 97 | + echo '<span class="course-price">' . wp_kses_post( $price ) . '</span>'; | |
| 98 | + ?> | |
| 99 | + </td> | |
| 100 | + </tr> | |
| 101 | + <?php | |
| 102 | + } | |
| 103 | + } | |
| 104 | + } | |
| 105 | + ?> | |
| 106 | + | |
| 107 | + <?php do_action( 'learn-press/order/items-table', $order ); ?> | |
| 108 | + </tbody> | |
| 109 | + | |
| 110 | + <tfoot> | |
| 111 | + <tr> | |
| 112 | + <th scope="row"><?php esc_html_e( 'Subtotal', 'learnpress' ); ?></th> | |
| 113 | + <td><?php echo esc_html( $order->get_formatted_order_subtotal() ); ?></td> | |
| 114 | + </tr> | |
| 115 | + | |
| 116 | + <?php do_action( 'learn-press/order/items-table-foot', $order ); ?> | |
| 117 | + | |
| 118 | + <tr> | |
| 119 | + <th scope="row"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 120 | + <td><?php echo esc_html( $order->get_formatted_order_total() ); ?></td> | |
| 121 | + </tr> | |
| 122 | + </tfoot> | |
| 123 | + </table> | |
| 124 | +</div> | |
| 125 | +<p> | |
| 126 | + <strong><?php echo esc_html__( 'Order key:', 'learnpress' ); ?></strong> | |
| 127 | + <?php echo esc_html( $order->get_order_key() ); ?> | |
| 128 | +</p> | |
| 129 | + | |
| 130 | +<p> | |
| 131 | + <strong><?php esc_html_e( 'Order status:', 'learnpress' ); ?></strong> | |
| 132 | + <span class="lp-label label-<?php echo esc_attr( $order->get_status() ); ?>"> | |
| 133 | + <?php echo wp_kses_post( $order->get_order_status_html() ); ?> | |
| 134 | + </span> | |
| 135 | +</p> | |
| 136 | + | |
| 137 | +<?php do_action( 'learn-press/order/after-table-details', $order ); ?> | |