add_action( 'wp_head', function () { // Hide default vendor dashboard echo ''; // Bootstrap 5 CSS CDN echo ''; echo ''; } ); add_action( 'woocommerce_account_vendor-dashboard_endpoint', 'dm_custom_vendor_dashboard', 5 ); function convert_utc_to_sydney( $utc_datetime_str ) { if ( empty( $utc_datetime_str ) || $utc_datetime_str === '0' ) { return '-'; } try { // Check if the date string is parseable by strtotime if ( false === strtotime( $utc_datetime_str ) ) { return '-'; } $dt = new DateTime( $utc_datetime_str, new DateTimeZone('UTC') ); $dt->setTimezone( new DateTimeZone('Australia/Sydney') ); return $dt->format('d/m/Y, h:i:s A'); } catch (Exception $e) { return '-'; } } function dm_custom_vendor_dashboard() { if ( ! is_user_logged_in() || ! function_exists( 'yith_get_vendor' ) ) { return; } $vendor = yith_get_vendor( get_current_user_id(), 'user' ); if ( ! $vendor || ! $vendor->is_valid() ) { echo '
You are not recognised as a vendor.
'; return; } $all_product_ids = $vendor->get_products( false ); if ( empty( $all_product_ids ) ) { echo '
No products found.
'; return; } $products_per_page = 5; $total_products = count( $all_product_ids ); $total_pages = ceil( $total_products / $products_per_page ); $current_page = isset( $_GET['vd_page'] ) ? max( 1, intval( $_GET['vd_page'] ) ) : 1; if ( $current_page > $total_pages ) { $current_page = $total_pages; } $offset = ( $current_page - 1 ) * $products_per_page; $paged_product_ids = array_slice( $all_product_ids, $offset, $products_per_page ); echo '
'; echo '

Your Auction Products

'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $now = current_time( 'timestamp' ); foreach ( $paged_product_ids as $pid ) { $product = wc_get_product( $pid ); if ( ! $product ) { continue; } $image = get_the_post_thumbnail_url( $pid, 'thumbnail' ) ?: wc_placeholder_img_src(); $title = esc_html( $product->get_name() ); $start_bid = get_post_meta( $pid, '_yith_auction_start_price', true ); $start_raw = get_post_meta( $pid, '_yith_auction_for', true ); $end_raw = get_post_meta( $pid, '_yith_auction_to', true ); // Debug logging - remove after testing error_log( "Vendor Dashboard | Product ID: $pid | Start Raw: '$start_raw' | End Raw: '$end_raw'" ); // Convert to timestamps for status calculation (assuming UTC) $start_ts = strtotime( $start_raw ) ?: 0; $end_ts = strtotime( $end_raw ) ?: 0; $lot_number = esc_html( get_post_meta( $pid, 'lot_number', true ) ); // Determine auction status based on current UTC timestamp if ( $start_ts && $now < $start_ts ) { $status = 'Upcoming'; } elseif ( $start_ts && $end_ts && $now >= $start_ts && $now <= $end_ts ) { $status = 'Ongoing'; } elseif ( $end_ts && $now > $end_ts ) { $status = 'Finished'; } else { $status = 'Unknown'; } $start_date_formatted = convert_utc_to_sydney( $start_raw ); $end_date_formatted = convert_utc_to_sydney( $end_raw ); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
ImageTitleStart BidLot NumberStatusStart Date (AUS Sydney)End Date (AUS Sydney)
product image ' . $title . '' . wc_price( $start_bid ?: 0 ) . '' . ( $lot_number ?: '-' ) . '' . $status . '' . esc_html( $start_date_formatted ) . '' . esc_html( $end_date_formatted ) . '
'; // Pagination if ( $total_pages > 1 ) { echo ''; } echo '
'; } Shop - Whisky Estate

Showing all 14 results

Sort by
0
    0
    Your Cart
    Your cart is emptyReturn to Shop