1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| <?php
global $WCMp, $wpdb;
if (is_user_logged_in() && is_user_wcmp_vendor(get_current_user_id())) {
$vendor = get_wcmp_vendor(get_current_vendor_id());
$enable_ordering = apply_filters('wcmp_vendor_dashboard_product_list_table_orderable_columns', array('name', 'date'));
$df_post_status = apply_filters('wcmp_vendor_dashboard_default_product_list_statues', array('publish', 'pending', 'draft'), $vendor);
$args = apply_filters( 'wcmp_get_vendor_product_list_query_args', array(
'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'product',
'post_mime_type' => '',
'post_parent' => '',
'author' => get_current_vendor_id(),
'post_status' => $df_post_status,
'suppress_filters' => true
), $vendor );
$tax_query = array();
$requestData = ( $_REQUEST ) ? wp_unslash( $_REQUEST ) : array();
$date_start = isset( $_POST['start_date'] ) ? wc_clean( $_POST['start_date'] ) : '';
$date_end = isset( $_POST['end_date'] ) ? wc_clean( $_POST['end_date'] ) : '';
$start_date = date('Y-m-d G:i:s', $date_start); //erreur Warning : date() expects parameter 2 to be int, string given in
$end_date = date('Y-m-d G:i:s', $date_end); // erreur Warning : date() expects parameter 2 to be int, string given in
$args = array(
'author' => $vendor->id,
'post_status' => 'any',
'date_query' => array(
array(
'after' => $start_date,
'before' => $end_date,
'inclusive' => true,
),
)
);
$vendor_all_orders = apply_filters('wcmp_datatable_get_vendor_all_orders', wcmp_get_orders($args), $requestData, $_POST);
$vendor_orders = array_slice($vendor_all_orders, $requestData['start'], $requestData['length']); //xxxxxxxxxxx 2 erreur (Notice: Undefined index: in )
$args = array();
$vendor_subscriptions = WCMp_AFM_Subscription_Integration::get_vendor_subscription_array( $args );
?>
<div class="col-md-12 all-products-wrapper">
<?php
$products_array = $vendor->get_products($args);
if (!empty($products_array)) {
foreach ($products_array as $product_single) {
$product = wc_get_product($product_single->ID);
$edit_product_link = esc_url(wcmp_get_vendor_dashboard_endpoint_url(get_wcmp_vendor_settings('wcmp_edit_product_endpoint', 'vendor', 'general', 'edit-product'), $product->get_id()));
if ( function_exists('icl_object_id') ) { // WPML activated
$correct_product_id = apply_filters( 'wpml_object_id',$product_single->ID , 'product', false, ICL_LANGUAGE_CODE );
if( $correct_product_id != $product_single->ID ){
continue; // skip the current loop and go to the next product
}
}
if ((current_vendor_can('edit_published_products') && get_wcmp_vendor_settings('is_edit_delete_published_product', 'capabilities', 'product') == 'Enable') || in_array($product->get_status(), apply_filters('wcmp_enable_edit_product_options_for_statuses', array('draft', 'pending')))) {
$edit_product_link = esc_url(wcmp_get_vendor_dashboard_endpoint_url(get_wcmp_vendor_settings('wcmp_edit_product_endpoint', 'vendor', 'general', 'edit-product'), $product->get_id()));
}
if(!current_vendor_can('edit_product') && in_array($product->get_status(), apply_filters('wcmp_enable_edit_product_options_for_statuses', array('draft', 'pending')))) $edit_product_link = '';
$edit_product_link = apply_filters('wcmp_vendor_product_list_product_edit_link', $edit_product_link, $product);
// Get actions
$onclick = "return confirm('" . __('Are you sure want to delete this product?', 'dc-woocommerce-multi-vendor') . "')";
$view_title = __('View', 'dc-woocommerce-multi-vendor');
if (in_array($product->get_status(), array('draft', 'pending'))) {
$view_title = __('Preview', 'dc-woocommerce-multi-vendor');
}
$date = '–';
if ($product->get_status() == 'publish') {
$status = __('Published', 'dc-woocommerce-multi-vendor');
$date = wcmp_date($product->get_date_created('edit'));
} elseif ($product->get_status() == 'pending') {
$status = __('Pending', 'dc-woocommerce-multi-vendor');
} elseif ($product->get_status() == 'draft') {
$status = __('Draft', 'dc-woocommerce-multi-vendor');
} elseif ($product->get_status() == 'private') {
$status = __('Private', 'dc-woocommerce-multi-vendor');
} elseif ($product->get_status() == 'trash') {
$status = __('Trash', 'dc-woocommerce-multi-vendor');
} else {
$status = ucfirst($product->get_status());
}
?> |
Partager