public function av8_manage_cart_columns($column, $post_id = '') { global $post; $cart = new AV8_Cart_Receipt(); $cart->load_receipt($post->ID); $cart->set_guest_details(); $title = ''; switch ($column) { /* If displaying the 'duration' column. */ case 'cartname': $suffix = "'s Cart"; if ($cart->is_guest_order() && $cart->has_guest_details()) { $fullname = ucwords($cart->get_guest_details('billing_first_name')) . ' ' . ucwords($cart->get_guest_details('billing_last_name')); if ($fullname != ' ') { $title .= $fullname; } else { $title .= "Guest"; } $title .= $suffix . " (Guest)"; } elseif ($cart->is_guest_order() && $cart->status() == "Converted" && isset($cart->order)) { $title = ucwords($cart->order->billing_first_name) . ' ' . ucwords($cart->order->billing_last_name) . $suffix . " (Guest)"; } elseif ($cart->is_guest_order()) { $title = "Guest" . $suffix; } elseif ($cart->full_name() != false) { $title = ucwords($cart->full_name()) . $suffix; } $post_url = admin_url('post.php?post=' . $post->ID . '&action=edit'); echo __("<a href='{$post_url}'>" . $title . "</a>"); break; case 'post__in': /* Get the post meta. */ $show_custom_state = $cart->status(); $filter_link = admin_url('edit.php?post_type=carts&status=' . $show_custom_state); echo __('<div class="index_status"><mark class="' . strtolower($show_custom_state) . '_index">' . $show_custom_state . '</mark></div>'); break; /* If displaying the 'genre' column. */ /* If displaying the 'genre' column. */ case 'updated': /* Get the genres for the post. */ the_modified_date('F j, Y'); echo " at "; the_modified_date('g:i a'); break; /* Just break out of the switch statement for everything else. */ /* Just break out of the switch statement for everything else. */ case 'products': //$products = $this->extract_cart_products(); global $woocommerce; $cartitems = get_post_meta($post->ID, 'av8_cartitems', true); $items_arr = str_replace(array('O:17:"WC_Product_Simple"', 'O:10:"WC_Product"'), 'O:8:"stdClass"', $cartitems); if (isset($cartitems) && $cartitems != false) { $order_items = (array) maybe_unserialize($items_arr); } else { break; } $loop = 0; if (sizeof($order_items) > 0 && $order_items != false) { foreach ($order_items as $item) { if (function_exists('get_product')) { if (isset($item['variation_id']) && $item['variation_id'] > 0) { $_product = get_product($item['variation_id']); } else { $_product = get_product($item['product_id']); } } else { if (isset($item['variation_id']) && $item['variation_id'] > 0) { $_product = new WC_Product_Variation($item['variation_id']); } else { $_product = new WC_Product($item['product_id']); } } if (isset($_product) && $_product != false) { echo "<a href='" . get_admin_url('', 'post.php?post=' . $_product->id . '&action=edit') . "'>" . $_product->get_title() . "</a>"; if (isset($_product->variation_data)) { echo ' (' . woocommerce_get_formatted_variation($_product->variation_data, true) . ')'; } if ($item['quantity'] > 1) { echo " x" . $item['quantity']; } } if ($loop < sizeof($order_items) - 1) { echo ", "; } $loop++; } } else { echo "<span style='color:lightgray;'>" . __("No Products", "woocommerce_cart_reports") . "</span>"; } break; case 'actions': $cart->print_cart_actions($cart->status(), $cart->is_guest_order()); break; default: break; } }