Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - empty name on order history #1532

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions templates/dashboard/purchase_history.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
$start_date = Input::get( 'start_date', '' );
$end_date = Input::get( 'end_date', '' );

$paged = Input::get( 'current_page', 1, Input::TYPE_INT );

Check failure on line 26 in templates/dashboard/purchase_history.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $paged
$per_page = tutor_utils()->get_option( 'pagination_per_page', 10 );

Check failure on line 27 in templates/dashboard/purchase_history.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $per_page
$offset = ( $per_page * $paged ) - $per_page;
if ( '' !== $start_date ) {
$start_date = tutor_get_formated_date( 'Y-m-d', $start_date );
Expand Down Expand Up @@ -127,7 +127,7 @@
if ( is_array( $orders ) && count( $orders ) ) :
?>
<?php
foreach ( $orders as $order ) :
foreach ( $orders as $order ) : //phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
?>
<tr>
<td>
Expand All @@ -140,16 +140,16 @@
<?php
$items = ( new OrderModel() )->get_order_items_by_id( $order->id );
foreach ( $items as $item ) {
$course_id = $item->id;
$object_title = '';
$course_id = $item->id; // For single order course, bundle.
$object_title = get_the_title( $course_id );
if ( OrderModel::TYPE_SINGLE_ORDER !== $order->order_type ) {
$course_id = apply_filters( 'tutor_subscription_course_by_plan', $item->id, $order );
$plan_info = apply_filters( 'tutor_checkout_plan_info', new \stdClass(), $course_id );
$object_id = apply_filters( 'tutor_subscription_course_by_plan', $item->id, $order );
$plan_info = apply_filters( 'tutor_checkout_plan_info', new \stdClass(), $object_id );
if ( $plan_info && isset( $plan_info->is_membership_plan ) && $plan_info->is_membership_plan ) {
$object_title = $plan_info->plan_name;
} else {
$object_title = get_the_title( $object_id );
}
} else {
$object_title = get_the_title( $course_id );
}

?>
Expand Down Expand Up @@ -197,13 +197,13 @@
</tbody>
<?php else : ?>
<tbody>
<?php foreach ( $orders as $order ) : ?>

Check failure on line 200 in templates/dashboard/purchase_history.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $order
<?php
if ( 'wc' === $monetize_by ) {
$wc_order = wc_get_order( $order->ID );
$price = tutor_utils()->tutor_price( $wc_order->get_total() );
$raw_price = $wc_order->get_total();
$status = $order->post_status;

Check failure on line 206 in templates/dashboard/purchase_history.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $status
$badge_class = 'primary';
$order_status_text = '';

Expand Down Expand Up @@ -237,7 +237,7 @@
$edd_order = edd_get_payment( $order->ID );
$price = edd_currency_filter( edd_format_amount( $edd_order->total ), edd_get_payment_currency_code( $order->ID ) );
$raw_price = $edd_order->total;
$status = $edd_order->status_nicename;

Check failure on line 240 in templates/dashboard/purchase_history.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $status
$badge_class = 'primary';
$order_status_text = $status;
}
Expand Down
Loading