PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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 4.2.0 All 139 releases
← All changes | inc/TemplateHooks/Profile/ProfileOrderTemplate.php +93 -8 4.3.74.4.8 View file →
@@ -32,9 +32,9 @@
32 32 do_action( 'learn-press/profile/layout/order-detail' );
33 33 }
34 34
35 35 protected function __construct() {
36 - add_action( 'learn-press/profile/layout/order-detail', [ $this, 'sections' ] );
36 + add_action( 'learn-press/profile/layout/order-detail', array( $this, 'sections' ) );
37 37 add_filter( 'lp/rest/ajax/allow_callback', array( $this, 'allow_callback' ) );
38 38 }
39 39
40 40 public static function init() {
@@ -152,12 +152,12 @@
152 152 }
153 153 }
154 154 $total_pages = $lp_order_db::get_total_pages( $limit, $total_row );
155 155 $html_pagination = Template::instance()->html_pagination(
156 - [
156 + array(
157 157 'total_pages' => $total_pages,
158 158 'paged' => $paged,
159 - ]
159 + )
160 160 );
161 161 if ( ! empty( $html_pagination ) ) {
162 162 $html_pagination = sprintf(
163 163 '<tr class="order-item">
@@ -171,9 +171,9 @@
171 171 'header' => sprintf(
172 172 '<h3>%s</h3>',
173 173 esc_html__( 'Order Details', 'learnpress' )
174 174 ),
175 - 'table' => '<table class="lp-list-table order-table-details">',
175 + 'table' => '<div class="lp-table-wrap"><table class="lp-list-table order-table-details">',
176 176 'table-header' => self::table_header(),
177 177 'table-body' => '<tbody>',
178 178 'items' => $html_items,
179 179 'pagination' => $html_pagination,
@@ -179,9 +179,9 @@
179 179 'pagination' => $html_pagination,
180 180 'do_action_items' => self::action_table_items( $order ),
181 181 'table-body-end' => '</tbody>',
182 182 'table-footer' => self::table_footer( $order ),
183 - 'table-end' => '</table>',
183 + 'table-end' => '</table></div>',
184 184 'footer' => self::order_detail_content_footer( $order ),
185 185 );
186 186 $content->content = Template::combine_components( $section );
187 187
@@ -248,9 +248,9 @@
248 248 /**
249 249 * HTMl for each order item row in order detail page.
250 250 *
251 251 * @param LP_Order $order
252 - * @param object $item
252 + * @param object $item
253 253 *
254 254 * @return string
255 255 * @since 4.3.2
256 256 * @version 1.0.1
@@ -304,14 +304,14 @@
304 304 * @version 1.0.1
305 305 */
306 306 public static function order_detail_content_footer( $order ): string {
307 307 $section = array(
308 - 'order_key' => sprintf(
308 + 'order_key' => sprintf(
309 309 '<p><strong>%s</strong> %s</p>',
310 310 esc_html__( 'Order key:', 'learnpress' ),
311 311 esc_html( $order->get_order_key() )
312 312 ),
313 - 'order_status' => sprintf(
313 + 'order_status' => sprintf(
314 314 '<p>
315 315 <strong>%s</strong>
316 316 <span class="lp-label label-%s">%s</span>
317 317 </p>',
@@ -318,9 +318,94 @@
318 318 esc_html__( 'Order status:', 'learnpress' ),
319 319 esc_attr( $order->get_status() ),
320 320 wp_kses_post( $order->get_order_status_html() )
321 321 ),
322 + 'refund_request_status' => self::refund_request_status_html( $order ),
323 + 'refund_note' => self::refund_note_html( $order ),
322 324 );
323 325
324 326 return Template::combine_components( $section );
327 + }
328 +
329 + /**
330 + * HTML for refund request status in order detail page.
331 + *
332 + * @param LP_Order $order
333 + *
334 + * @return string
335 + * @since 4.3.9
336 + * @version 1.0.0
337 + */
338 + public static function refund_request_status_html( $order ): string {
339 +
340 + $refund_request_status = $order->get_refund_request();
341 + if ( empty( $refund_request_status ) ) {
342 + return '';
343 + }
344 +
345 + $status_labels = array(
346 + 'pending' => __( 'Pending', 'learnpress' ),
347 + 'rejected' => __( 'Rejected', 'learnpress' ),
348 + 'approved' => __( 'Accepted', 'learnpress' ),
349 + 'auto-approved' => __( 'Accepted', 'learnpress' ),
350 + );
351 + $status_label = $status_labels[ $refund_request_status ] ?? ucwords( str_replace( '-', ' ', $refund_request_status ) );
352 +
353 + $html_status = sprintf(
354 + '<p class="lp-order-refund-request-status">
355 + <strong>%s</strong>
356 + <span class="lp-label label-%s">%s</span>
357 + </p>',
358 + esc_html__( 'Refund request:', 'learnpress' ),
359 + esc_attr( $refund_request_status ),
360 + esc_html( $status_label )
361 + );
362 +
363 + $currency_symbol = learn_press_get_currency_symbol( $order->get_currency() );
364 + $refunded_amount = (float) $order->get_meta( LP_Order::META_KEY_REFUNDED_AMOUNT );
365 + $html_amount = '';
366 + if ( $refunded_amount > 0 ) {
367 + $refunded_amount = learn_press_format_price( $refunded_amount, $currency_symbol );
368 + $html_amount = sprintf(
369 + '<p class="lp-order-refunded-amount">
370 + <strong>%s</strong>
371 + <span>%s</span>
372 + </p>',
373 + esc_html__( 'Refund amount:', 'learnpress' ),
374 + esc_html( $refunded_amount )
375 + );
376 + }
377 +
378 + return Template::combine_components(
379 + [
380 + 'status' => $html_status,
381 + 'amount' => $html_amount,
382 + ]
383 + );
384 + }
385 +
386 + /**
387 + * HTML for refund note in order detail page.
388 + *
389 + * @param LP_Order $order
390 + *
391 + * @return string
392 + * @since 4.3.9
393 + * @version 1.0.0
394 + */
395 + public static function refund_note_html( $order ): string {
396 +
397 + $refund_note = trim( (string) get_post_meta( $order->get_id(), '_lp_refund_note', true ) );
398 + if ( empty( $refund_note ) ) {
399 + return '';
400 + }
401 +
402 + return sprintf(
403 + '<p class="lp-order-refund-note">
404 + <strong>%s</strong>
405 + <span>%s</span>
406 + </p>',
407 + esc_html__( 'Refund note:', 'learnpress' ),
408 + nl2br( esc_html( $refund_note ) )
409 + );
325 410 }
326 411 }