| @@ -64,123 +64,125 @@ | ||
| 64 | 64 | ); |
| 65 | 65 | do_action( 'learn-press/order/after-received-order-message', $order_received->get_id() ); |
| 66 | 66 | |
| 67 | 67 | ?> |
| 68 | - <table class="order_details"> | |
| 69 | - <?php if ( isset( $_GET['key'] ) && ! is_user_logged_in() ) : ?> | |
| 70 | - <tr class="order-key"> | |
| 71 | - <th><?php esc_html_e( 'Order Key', 'learnpress' ); ?></th> | |
| 68 | + <div class="lp-table-wrap"> | |
| 69 | + <table class="order_details lp-list-table"> | |
| 70 | + <?php if ( isset( $_GET['key'] ) && ! is_user_logged_in() ) : ?> | |
| 71 | + <tr class="order-key"> | |
| 72 | + <th><?php esc_html_e( 'Order Key', 'learnpress' ); ?></th> | |
| 73 | + <td> | |
| 74 | + <?php echo esc_html( $_GET['key'] ); ?> | |
| 75 | + </td> | |
| 76 | + </tr> | |
| 77 | + <?php endif; ?> | |
| 78 | + <tr class="order"> | |
| 79 | + <th><?php esc_html_e( 'Order Number', 'learnpress' ); ?></th> | |
| 72 | 80 | <td> |
| 73 | - <?php echo esc_html( $_GET['key'] ); ?> | |
| 81 | + <?php echo esc_html( $order_received->get_order_number() ); ?> | |
| 74 | 82 | </td> |
| 75 | 83 | </tr> |
| 76 | - <?php endif; ?> | |
| 77 | - <tr class="order"> | |
| 78 | - <th><?php esc_html_e( 'Order Number', 'learnpress' ); ?></th> | |
| 79 | - <td> | |
| 80 | - <?php echo esc_html( $order_received->get_order_number() ); ?> | |
| 81 | - </td> | |
| 82 | - </tr> | |
| 83 | - <tr class="status"> | |
| 84 | - <th><?php esc_html_e( 'Status', 'learnpress' ); ?></th> | |
| 85 | - <td> | |
| 86 | - <?php | |
| 87 | - $status = $order_received->get_status(); | |
| 88 | - echo ucfirst( $order_received::get_status_label( $status ) ); | |
| 89 | - ?> | |
| 90 | - </td> | |
| 91 | - </tr> | |
| 92 | - <tr class="item"> | |
| 93 | - <th><?php esc_html_e( 'Item', 'learnpress' ); ?></th> | |
| 94 | - <td> | |
| 95 | - <?php | |
| 96 | - $links = array(); | |
| 97 | - $items = $order_received->get_items(); | |
| 98 | - $count = count( $items ); | |
| 84 | + <tr class="status"> | |
| 85 | + <th><?php esc_html_e( 'Status', 'learnpress' ); ?></th> | |
| 86 | + <td> | |
| 87 | + <?php | |
| 88 | + $status = $order_received->get_status(); | |
| 89 | + echo ucfirst( $order_received::get_status_label( $status ) ); | |
| 90 | + ?> | |
| 91 | + </td> | |
| 92 | + </tr> | |
| 93 | + <tr class="item"> | |
| 94 | + <th><?php esc_html_e( 'Item', 'learnpress' ); ?></th> | |
| 95 | + <td> | |
| 96 | + <?php | |
| 97 | + $links = array(); | |
| 98 | + $items = $order_received->get_items(); | |
| 99 | + $count = count( $items ); | |
| 99 | 100 | |
| 100 | - foreach ( $items as $item ) { | |
| 101 | - if ( empty( $item['course_id'] ) || get_post_type( $item['course_id'] ) !== LP_COURSE_CPT ) { | |
| 102 | - $links[] = apply_filters( | |
| 103 | - 'learn-press/order-item-not-course-id', | |
| 104 | - __( 'The course does not exist', 'learnpress' ), | |
| 105 | - $item | |
| 106 | - ); | |
| 107 | - } else { | |
| 108 | - $course_id = $item['course_id']; | |
| 109 | - $courseModel = CourseModel::find( $course_id, true ); | |
| 110 | - $button_course = ''; | |
| 111 | - $userCourseModel = UserCourseModel::find( $user_id, $course_id, true ); | |
| 112 | - if ( $userCourseModel && $userModel ) { | |
| 113 | - // For enrolled or purchased course. | |
| 114 | - $userCourseTemplate = UserCourseTemplate::instance(); | |
| 115 | - $singleCourseTemplate = SingleCourseTemplate::instance(); | |
| 101 | + foreach ( $items as $item ) { | |
| 102 | + if ( empty( $item['course_id'] ) || get_post_type( $item['course_id'] ) !== LP_COURSE_CPT ) { | |
| 103 | + $links[] = apply_filters( | |
| 104 | + 'learn-press/order-item-not-course-id', | |
| 105 | + __( 'The course does not exist', 'learnpress' ), | |
| 106 | + $item | |
| 107 | + ); | |
| 108 | + } else { | |
| 109 | + $course_id = $item['course_id']; | |
| 110 | + $courseModel = CourseModel::find( $course_id, true ); | |
| 111 | + $button_course = ''; | |
| 112 | + $userCourseModel = UserCourseModel::find( $user_id, $course_id, true ); | |
| 113 | + if ( $userCourseModel && $userModel ) { | |
| 114 | + // For enrolled or purchased course. | |
| 115 | + $userCourseTemplate = UserCourseTemplate::instance(); | |
| 116 | + $singleCourseTemplate = SingleCourseTemplate::instance(); | |
| 116 | 117 | |
| 117 | - // Load js button course. | |
| 118 | - wp_enqueue_script( 'lp-single-course' ); | |
| 118 | + // Load js button course. | |
| 119 | + wp_enqueue_script( 'lp-single-course' ); | |
| 119 | 120 | |
| 120 | - if ( $userCourseModel->has_enrolled() ) { | |
| 121 | - $button_course = $userCourseTemplate->html_btn_continue( $userCourseModel ); | |
| 122 | - } elseif ( $userCourseModel->has_purchased() ) { | |
| 123 | - $button_course = $singleCourseTemplate->html_btn_enroll_course( $courseModel, $userModel ); | |
| 121 | + if ( $userCourseModel->has_enrolled() ) { | |
| 122 | + $button_course = $userCourseTemplate->html_btn_continue( $userCourseModel ); | |
| 123 | + } elseif ( $userCourseModel->has_purchased() ) { | |
| 124 | + $button_course = $singleCourseTemplate->html_btn_enroll_course( $courseModel, $userModel ); | |
| 125 | + } | |
| 124 | 126 | } |
| 125 | - } | |
| 126 | 127 | |
| 127 | - $link = sprintf( | |
| 128 | - '<a href="%s">%s (#%s)</a> %s', | |
| 129 | - get_the_permalink( $item['course_id'] ), | |
| 130 | - get_the_title( $item['course_id'] ), | |
| 131 | - $item['course_id'], | |
| 132 | - $button_course | |
| 133 | - ); | |
| 128 | + $link = sprintf( | |
| 129 | + '<a href="%s">%s (#%s)</a> %s', | |
| 130 | + get_the_permalink( $item['course_id'] ), | |
| 131 | + get_the_title( $item['course_id'] ), | |
| 132 | + $item['course_id'], | |
| 133 | + $button_course | |
| 134 | + ); | |
| 134 | 135 | |
| 135 | - if ( $count > 1 ) { | |
| 136 | - $link = sprintf( '<li>%s</li>', $link ); | |
| 136 | + if ( $count > 1 ) { | |
| 137 | + $link = sprintf( '<li>%s</li>', $link ); | |
| 138 | + } | |
| 139 | + $links[] = apply_filters( 'learn-press/order-received-item-link', $link, $item ); | |
| 137 | 140 | } |
| 138 | - $links[] = apply_filters( 'learn-press/order-received-item-link', $link, $item ); | |
| 139 | 141 | } |
| 140 | - } | |
| 141 | 142 | |
| 142 | - if ( $count > 1 ) { | |
| 143 | - echo sprintf( '<ol>%s</ol>', join( '', $links ) ); | |
| 144 | - } elseif ( 1 == $count ) { | |
| 145 | - echo implode( '', $links ); | |
| 146 | - } else { | |
| 147 | - echo esc_html__( '(No item)', 'learnpress' ); | |
| 148 | - } | |
| 149 | - ?> | |
| 150 | - </td> | |
| 151 | - </tr> | |
| 152 | - <tr class="date"> | |
| 153 | - <th><?php esc_html_e( 'Date', 'learnpress' ); ?></th> | |
| 154 | - <td> | |
| 155 | - <?php | |
| 156 | - echo wp_kses_post( | |
| 157 | - date_i18n( | |
| 158 | - get_option( 'date_format' ), | |
| 159 | - strtotime( $order_received->get_order_date() ) | |
| 160 | - ) | |
| 161 | - ); | |
| 162 | - ?> | |
| 163 | - </td> | |
| 164 | - </tr> | |
| 165 | - <tr class="total"> | |
| 166 | - <th><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 167 | - <td> | |
| 168 | - <?php echo wp_kses_post( $order_received->get_formatted_order_total() ); ?> | |
| 169 | - </td> | |
| 170 | - </tr> | |
| 171 | - <?php | |
| 172 | - $method_title = $order_received->get_payment_method_title(); | |
| 173 | - if ( $method_title ) : | |
| 174 | - ?> | |
| 175 | - <tr class="method"> | |
| 176 | - <th><?php esc_html_e( 'Payment Method', 'learnpress' ); ?></th> | |
| 143 | + if ( $count > 1 ) { | |
| 144 | + echo sprintf( '<ol>%s</ol>', join( '', $links ) ); | |
| 145 | + } elseif ( 1 == $count ) { | |
| 146 | + echo implode( '', $links ); | |
| 147 | + } else { | |
| 148 | + echo esc_html__( '(No item)', 'learnpress' ); | |
| 149 | + } | |
| 150 | + ?> | |
| 151 | + </td> | |
| 152 | + </tr> | |
| 153 | + <tr class="date"> | |
| 154 | + <th><?php esc_html_e( 'Date', 'learnpress' ); ?></th> | |
| 177 | 155 | <td> |
| 178 | - <?php echo esc_html( $method_title ); ?> | |
| 156 | + <?php | |
| 157 | + echo wp_kses_post( | |
| 158 | + date_i18n( | |
| 159 | + get_option( 'date_format' ), | |
| 160 | + strtotime( $order_received->get_order_date() ) | |
| 161 | + ) | |
| 162 | + ); | |
| 163 | + ?> | |
| 179 | 164 | </td> |
| 180 | 165 | </tr> |
| 181 | - <?php endif; ?> | |
| 182 | - <?php do_action( 'learn-press/order/received/items-table', $order_received ); ?> | |
| 183 | - </table> | |
| 166 | + <tr class="total"> | |
| 167 | + <th><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 168 | + <td> | |
| 169 | + <?php echo wp_kses_post( $order_received->get_formatted_order_total() ); ?> | |
| 170 | + </td> | |
| 171 | + </tr> | |
| 172 | + <?php | |
| 173 | + $method_title = $order_received->get_payment_method_title(); | |
| 174 | + if ( $method_title ) : | |
| 175 | + ?> | |
| 176 | + <tr class="method"> | |
| 177 | + <th><?php esc_html_e( 'Payment Method', 'learnpress' ); ?></th> | |
| 178 | + <td> | |
| 179 | + <?php echo esc_html( $method_title ); ?> | |
| 180 | + </td> | |
| 181 | + </tr> | |
| 182 | + <?php endif; ?> | |
| 183 | + <?php do_action( 'learn-press/order/received/items-table', $order_received ); ?> | |
| 184 | + </table> | |
| 185 | + </div> | |
| 184 | 186 | |
| 185 | 187 | <?php do_action( 'learn-press/order/received', $order_received ); ?> |
| 186 | 188 | </div> |