function woo_ce_get_product_vendor_fields($format = 'full') { $export_type = 'product_vendor'; $fields = array(); $fields[] = array('name' => 'ID', 'label' => __('Product Vendor ID', 'woo_ce')); $fields[] = array('name' => 'title', 'label' => __('Name', 'woo_ce')); $fields[] = array('name' => 'slug', 'label' => __('Slug', 'woo_ce')); $fields[] = array('name' => 'description', 'label' => __('Description', 'woo_ce')); $fields[] = array('name' => 'url', 'label' => __('Product Vendor URL', 'woo_ce')); $fields[] = array('name' => 'commission', 'label' => __('Commission', 'woo_ce')); $fields[] = array('name' => 'paypal_email', 'label' => __('PayPal E-mail Address', 'woo_ce')); $fields[] = array('name' => 'user_name', 'label' => __('Vendor Username', 'woo_ce')); $fields[] = array('name' => 'user_id', 'label' => __('Vendor User ID', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_category_fields($format = 'full') { $export_type = 'category'; $fields = array(); $fields[] = array('name' => 'term_id', 'label' => __('Term ID', 'woocommerce-exporter')); $fields[] = array('name' => 'name', 'label' => __('Category Name', 'woocommerce-exporter')); $fields[] = array('name' => 'slug', 'label' => __('Category Slug', 'woocommerce-exporter')); $fields[] = array('name' => 'parent_id', 'label' => __('Parent Term ID', 'woocommerce-exporter')); $fields[] = array('name' => 'description', 'label' => __('Category Description', 'woocommerce-exporter')); $fields[] = array('name' => 'display_type', 'label' => __('Display Type', 'woocommerce-exporter')); $fields[] = array('name' => 'image', 'label' => __('Category Image', 'woocommerce-exporter')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woocommerce-exporter' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); if ($remember = woo_ce_get_option($export_type . '_fields', array())) { $remember = maybe_unserialize($remember); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['disabled'] = isset($fields[$i]['disabled']) ? $fields[$i]['disabled'] : 0; $fields[$i]['default'] = 1; if (!array_key_exists($fields[$i]['name'], $remember)) { $fields[$i]['default'] = 0; } } } switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_order_fields($format = 'full') { $export_type = 'order'; $fields = array(); $fields[] = array('name' => 'purchase_id', 'label' => __('Order ID', 'woo_ce')); $fields[] = array('name' => 'post_id', 'label' => __('Post ID', 'woo_ce')); $fields[] = array('name' => 'purchase_total', 'label' => __('Order Total', 'woo_ce')); $fields[] = array('name' => 'purchase_subtotal', 'label' => __('Order Subtotal', 'woo_ce')); $fields[] = array('name' => 'order_currency', 'label' => __('Order Currency', 'woo_ce')); $fields[] = array('name' => 'order_discount', 'label' => __('Order Discount', 'woo_ce')); $fields[] = array('name' => 'coupon_code', 'label' => __('Coupon Code', 'woo_ce')); $fields[] = array('name' => 'purchase_total_tax', 'label' => __('Order Total Tax', 'woo_ce')); /* $fields[] = array( 'name' => 'order_incl_tax', 'label' => __( 'Order Incl. Tax', 'woo_ce' ) ); */ $fields[] = array('name' => 'order_excl_tax', 'label' => __('Order Subtotal Excl. Tax', 'woo_ce')); /* $fields[] = array( 'name' => 'order_tax_rate', 'label' => __( 'Order Tax Rate', 'woo_ce' ) ); */ $fields[] = array('name' => 'order_sales_tax', 'label' => __('Sales Tax Total', 'woo_ce')); $fields[] = array('name' => 'order_shipping_tax', 'label' => __('Shipping Tax Total', 'woo_ce')); $fields[] = array('name' => 'order_tax_percentage', 'label' => __('Order Tax Percentage', 'woo_ce')); $fields[] = array('name' => 'payment_gateway_id', 'label' => __('Payment Gateway ID', 'woo_ce')); $fields[] = array('name' => 'payment_gateway', 'label' => __('Payment Gateway', 'woo_ce')); $fields[] = array('name' => 'shipping_method_id', 'label' => __('Shipping Method ID', 'woo_ce')); $fields[] = array('name' => 'shipping_method', 'label' => __('Shipping Method', 'woo_ce')); $fields[] = array('name' => 'shipping_cost', 'label' => __('Shipping Cost', 'woo_ce')); $fields[] = array('name' => 'shipping_weight', 'label' => __('Shipping Weight', 'woo_ce')); $fields[] = array('name' => 'payment_status', 'label' => __('Order Status', 'woo_ce')); $fields[] = array('name' => 'post_status', 'label' => __('Post Status', 'woo_ce')); $fields[] = array('name' => 'order_key', 'label' => __('Order Key', 'woo_ce')); $fields[] = array('name' => 'purchase_date', 'label' => __('Order Date', 'woo_ce')); $fields[] = array('name' => 'purchase_time', 'label' => __('Order Time', 'woo_ce')); $fields[] = array('name' => 'customer_message', 'label' => __('Customer Message', 'woo_ce')); $fields[] = array('name' => 'customer_note', 'label' => __('Customer Note', 'woo_ce')); $fields[] = array('name' => 'order_notes', 'label' => __('Order Notes', 'woo_ce')); $fields[] = array('name' => 'total_quantity', 'label' => __('Total Quantity', 'woo_ce')); $fields[] = array('name' => 'total_order_items', 'label' => __('Total Order Items', 'woo_ce')); $fields[] = array('name' => 'user_id', 'label' => __('User ID', 'woo_ce')); $fields[] = array('name' => 'user_name', 'label' => __('Username', 'woo_ce')); $fields[] = array('name' => 'user_role', 'label' => __('User Role', 'woo_ce')); $fields[] = array('name' => 'ip_address', 'label' => __('Checkout IP Address', 'woo_ce')); $fields[] = array('name' => 'browser_agent', 'label' => __('Checkout Browser Agent', 'woo_ce')); $fields[] = array('name' => 'billing_full_name', 'label' => __('Billing: Full Name', 'woo_ce')); $fields[] = array('name' => 'billing_first_name', 'label' => __('Billing: First Name', 'woo_ce')); $fields[] = array('name' => 'billing_last_name', 'label' => __('Billing: Last Name', 'woo_ce')); $fields[] = array('name' => 'billing_company', 'label' => __('Billing: Company', 'woo_ce')); $fields[] = array('name' => 'billing_address', 'label' => __('Billing: Street Address (Full)', 'woo_ce')); $fields[] = array('name' => 'billing_address_1', 'label' => __('Billing: Street Address 1', 'woo_ce')); $fields[] = array('name' => 'billing_address_2', 'label' => __('Billing: Street Address 2', 'woo_ce')); $fields[] = array('name' => 'billing_city', 'label' => __('Billing: City', 'woo_ce')); $fields[] = array('name' => 'billing_postcode', 'label' => __('Billing: ZIP Code', 'woo_ce')); $fields[] = array('name' => 'billing_state', 'label' => __('Billing: State (prefix)', 'woo_ce')); $fields[] = array('name' => 'billing_state_full', 'label' => __('Billing: State', 'woo_ce')); $fields[] = array('name' => 'billing_country', 'label' => __('Billing: Country (prefix)', 'woo_ce')); $fields[] = array('name' => 'billing_country_full', 'label' => __('Billing: Country', 'woo_ce')); $fields[] = array('name' => 'billing_phone', 'label' => __('Billing: Phone Number', 'woo_ce')); $fields[] = array('name' => 'billing_email', 'label' => __('Billing: E-mail Address', 'woo_ce')); $fields[] = array('name' => 'shipping_full_name', 'label' => __('Shipping: Full Name', 'woo_ce')); $fields[] = array('name' => 'shipping_first_name', 'label' => __('Shipping: First Name', 'woo_ce')); $fields[] = array('name' => 'shipping_last_name', 'label' => __('Shipping: Last Name', 'woo_ce')); $fields[] = array('name' => 'shipping_company', 'label' => __('Shipping: Company', 'woo_ce')); $fields[] = array('name' => 'shipping_address', 'label' => __('Shipping: Street Address (Full)', 'woo_ce')); $fields[] = array('name' => 'shipping_address_1', 'label' => __('Shipping: Street Address 1', 'woo_ce')); $fields[] = array('name' => 'shipping_address_2', 'label' => __('Shipping: Street Address 2', 'woo_ce')); $fields[] = array('name' => 'shipping_city', 'label' => __('Shipping: City', 'woo_ce')); $fields[] = array('name' => 'shipping_postcode', 'label' => __('Shipping: ZIP Code', 'woo_ce')); $fields[] = array('name' => 'shipping_state', 'label' => __('Shipping: State (prefix)', 'woo_ce')); $fields[] = array('name' => 'shipping_state_full', 'label' => __('Shipping: State', 'woo_ce')); $fields[] = array('name' => 'shipping_country', 'label' => __('Shipping: Country (prefix)', 'woo_ce')); $fields[] = array('name' => 'shipping_country_full', 'label' => __('Shipping: Country', 'woo_ce')); $fields[] = array('name' => 'order_items_product_id', 'label' => __('Order Items: Product ID', 'woo_ce')); $fields[] = array('name' => 'order_items_variation_id', 'label' => __('Order Items: Variation ID', 'woo_ce')); $fields[] = array('name' => 'order_items_sku', 'label' => __('Order Items: SKU', 'woo_ce')); $fields[] = array('name' => 'order_items_name', 'label' => __('Order Items: Product Name', 'woo_ce')); $fields[] = array('name' => 'order_items_variation', 'label' => __('Order Items: Product Variation', 'woo_ce')); $fields[] = array('name' => 'order_items_description', 'label' => __('Order Items: Product Description', 'woo_ce')); $fields[] = array('name' => 'order_items_excerpt', 'label' => __('Order Items: Product Excerpt', 'woo_ce')); $fields[] = array('name' => 'order_items_tax_class', 'label' => __('Order Items: Tax Class', 'woo_ce')); $fields[] = array('name' => 'order_items_quantity', 'label' => __('Order Items: Quantity', 'woo_ce')); $fields[] = array('name' => 'order_items_total', 'label' => __('Order Items: Total', 'woo_ce')); $fields[] = array('name' => 'order_items_subtotal', 'label' => __('Order Items: Subtotal', 'woo_ce')); $fields[] = array('name' => 'order_items_rrp', 'label' => __('Order Items: RRP', 'woo_ce')); $fields[] = array('name' => 'order_items_stock', 'label' => __('Order Items: Stock', 'woo_ce')); $fields[] = array('name' => 'order_items_tax', 'label' => __('Order Items: Tax', 'woo_ce')); $fields[] = array('name' => 'order_items_tax_subtotal', 'label' => __('Order Items: Tax Subtotal', 'woo_ce')); $tax_rates = woo_ce_get_order_tax_rates(); if (!empty($tax_rates)) { foreach ($tax_rates as $tax_rate) { $fields[] = array('name' => sprintf('order_items_tax_rate_%d', $tax_rate['rate_id']), 'label' => sprintf(__('Order Items: Tax Rate - %s', 'woo_ce'), $tax_rate['label'])); } } unset($tax_rates, $tax_rate); $fields[] = array('name' => 'order_items_type', 'label' => __('Order Items: Type', 'woo_ce')); $fields[] = array('name' => 'order_items_category', 'label' => __('Order Items: Category', 'woo_ce')); $fields[] = array('name' => 'order_items_tag', 'label' => __('Order Items: Tag', 'woo_ce')); $fields[] = array('name' => 'order_items_total_sales', 'label' => __('Order Items: Total Sales', 'woo_ce')); $fields[] = array('name' => 'order_items_weight', 'label' => __('Order Items: Weight', 'woo_ce')); $fields[] = array('name' => 'order_items_total_weight', 'label' => __('Order Items: Total Weight', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_commission_fields($format = 'full') { $export_type = 'commission'; $fields = array(); $fields[] = array('name' => 'ID', 'label' => __('Commission ID', 'woo_ce')); $fields[] = array('name' => 'post_date', 'label' => __('Commission Date', 'woo_ce')); $fields[] = array('name' => 'title', 'label' => __('Commission Title', 'woo_ce')); $fields[] = array('name' => 'product_id', 'label' => __('Product ID', 'woo_ce')); $fields[] = array('name' => 'product_name', 'label' => __('Product Name', 'woo_ce')); $fields[] = array('name' => 'product_sku', 'label' => __('Product SKU', 'woo_ce')); $fields[] = array('name' => 'product_vendor_id', 'label' => __('Product Vendor ID', 'woo_ce')); $fields[] = array('name' => 'product_vendor_name', 'label' => __('Product Vendor Name', 'woo_ce')); $fields[] = array('name' => 'commission_amount', 'label' => __('Commission Amount', 'woo_ce')); $fields[] = array('name' => 'paid_status', 'label' => __('Commission Status', 'woo_ce')); $fields[] = array('name' => 'post_status', 'label' => __('Post Status', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_coupon_fields($format = 'full') { $export_type = 'coupon'; $fields = array(); $fields[] = array('name' => 'coupon_code', 'label' => __('Coupon Code', 'woocommerce-exporter')); $fields[] = array('name' => 'coupon_description', 'label' => __('Coupon Description', 'woocommerce-exporter')); $fields[] = array('name' => 'discount_type', 'label' => __('Discount Type', 'woocommerce-exporter')); $fields[] = array('name' => 'coupon_amount', 'label' => __('Coupon Amount', 'woocommerce-exporter')); $fields[] = array('name' => 'individual_use', 'label' => __('Individual Use', 'woocommerce-exporter')); $fields[] = array('name' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce-exporter')); $fields[] = array('name' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce-exporter')); $fields[] = array('name' => 'minimum_amount', 'label' => __('Minimum Amount', 'woocommerce-exporter')); $fields[] = array('name' => 'product_ids', 'label' => __('Products', 'woocommerce-exporter')); $fields[] = array('name' => 'exclude_product_ids', 'label' => __('Exclude Products', 'woocommerce-exporter')); $fields[] = array('name' => 'product_categories', 'label' => __('Product Categories', 'woocommerce-exporter')); $fields[] = array('name' => 'exclude_product_categories', 'label' => __('Exclude Product Categories', 'woocommerce-exporter')); $fields[] = array('name' => 'customer_email', 'label' => __('Customer e-mails', 'woocommerce-exporter')); $fields[] = array('name' => 'usage_limit', 'label' => __('Usage Limit', 'woocommerce-exporter')); $fields[] = array('name' => 'expiry_date', 'label' => __('Expiry Date', 'woocommerce-exporter')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woocommerce-exporter' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_user_fields($format = 'full') { $export_type = 'user'; $fields = array(); $fields[] = array('name' => 'user_id', 'label' => __('User ID', 'woo_ce')); $fields[] = array('name' => 'user_name', 'label' => __('Username', 'woo_ce')); $fields[] = array('name' => 'user_role', 'label' => __('User Role', 'woo_ce')); $fields[] = array('name' => 'first_name', 'label' => __('First Name', 'woo_ce')); $fields[] = array('name' => 'last_name', 'label' => __('Last Name', 'woo_ce')); $fields[] = array('name' => 'full_name', 'label' => __('Full Name', 'woo_ce')); $fields[] = array('name' => 'nick_name', 'label' => __('Nickname', 'woo_ce')); $fields[] = array('name' => 'email', 'label' => __('E-mail', 'woo_ce')); $fields[] = array('name' => 'url', 'label' => __('Website', 'woo_ce')); $fields[] = array('name' => 'date_registered', 'label' => __('Date Registered', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); if ($remember = woo_ce_get_option($export_type . '_fields', array())) { $remember = maybe_unserialize($remember); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['disabled'] = isset($fields[$i]['disabled']) ? $fields[$i]['disabled'] : 0; $fields[$i]['default'] = 1; if (!array_key_exists($fields[$i]['name'], $remember)) { $fields[$i]['default'] = 0; } } } switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_product_fields($format = 'full') { $export_type = 'product'; $fields = array(); $fields[] = array('name' => 'parent_id', 'label' => __('Parent ID', 'woo_ce')); $fields[] = array('name' => 'parent_sku', 'label' => __('Parent SKU', 'woo_ce')); $fields[] = array('name' => 'product_id', 'label' => __('Product ID', 'woo_ce')); $fields[] = array('name' => 'sku', 'label' => __('Product SKU', 'woo_ce')); $fields[] = array('name' => 'name', 'label' => __('Product Name', 'woo_ce')); $fields[] = array('name' => 'slug', 'label' => __('Slug', 'woo_ce')); $fields[] = array('name' => 'permalink', 'label' => __('Permalink', 'woo_ce')); $fields[] = array('name' => 'product_url', 'label' => __('Product URL', 'woo_ce')); $fields[] = array('name' => 'description', 'label' => __('Description', 'woo_ce')); $fields[] = array('name' => 'excerpt', 'label' => __('Excerpt', 'woo_ce')); $fields[] = array('name' => 'post_date', 'label' => __('Product Published', 'woo_ce')); $fields[] = array('name' => 'post_modified', 'label' => __('Product Modified', 'woo_ce')); $fields[] = array('name' => 'type', 'label' => __('Type', 'woo_ce')); $fields[] = array('name' => 'visibility', 'label' => __('Visibility', 'woo_ce')); $fields[] = array('name' => 'featured', 'label' => __('Featured', 'woo_ce')); $fields[] = array('name' => 'virtual', 'label' => __('Virtual', 'woo_ce')); $fields[] = array('name' => 'downloadable', 'label' => __('Downloadable', 'woo_ce')); $fields[] = array('name' => 'price', 'label' => __('Price', 'woo_ce')); $fields[] = array('name' => 'sale_price', 'label' => __('Sale Price', 'woo_ce')); $fields[] = array('name' => 'sale_price_dates_from', 'label' => __('Sale Price Dates From', 'woo_ce')); $fields[] = array('name' => 'sale_price_dates_to', 'label' => __('Sale Price Dates To', 'woo_ce')); $fields[] = array('name' => 'weight', 'label' => __('Weight', 'woo_ce')); $fields[] = array('name' => 'weight_unit', 'label' => __('Weight Unit', 'woo_ce')); $fields[] = array('name' => 'height', 'label' => __('Height', 'woo_ce')); $fields[] = array('name' => 'height_unit', 'label' => __('Height Unit', 'woo_ce')); $fields[] = array('name' => 'width', 'label' => __('Width', 'woo_ce')); $fields[] = array('name' => 'width_unit', 'label' => __('Width Unit', 'woo_ce')); $fields[] = array('name' => 'length', 'label' => __('Length', 'woo_ce')); $fields[] = array('name' => 'length_unit', 'label' => __('Length Unit', 'woo_ce')); $fields[] = array('name' => 'category', 'label' => __('Category', 'woo_ce')); $fields[] = array('name' => 'tag', 'label' => __('Tag', 'woo_ce')); $fields[] = array('name' => 'image', 'label' => __('Featured Image', 'woo_ce')); $fields[] = array('name' => 'image_thumbnail', 'label' => __('Featured Image Thumbnail', 'woo_ce'), 'disabled' => 1); $fields[] = array('name' => 'product_gallery', 'label' => __('Product Gallery', 'woo_ce')); $fields[] = array('name' => 'product_gallery_thumbnail', 'label' => __('Product Gallery Thumbnail', 'woo_ce'), 'disabled' => 1); $fields[] = array('name' => 'tax_status', 'label' => __('Tax Status', 'woo_ce')); $fields[] = array('name' => 'tax_class', 'label' => __('Tax Class', 'woo_ce')); $fields[] = array('name' => 'shipping_class', 'label' => __('Shipping Class', 'woo_ce')); $fields[] = array('name' => 'download_file_name', 'label' => __('Download File Name', 'woo_ce')); $fields[] = array('name' => 'download_file_path', 'label' => __('Download File URL Path', 'woo_ce')); $fields[] = array('name' => 'download_limit', 'label' => __('Download Limit', 'woo_ce')); $fields[] = array('name' => 'download_expiry', 'label' => __('Download Expiry', 'woo_ce')); $fields[] = array('name' => 'download_type', 'label' => __('Download Type', 'woo_ce')); $fields[] = array('name' => 'manage_stock', 'label' => __('Manage Stock', 'woo_ce')); $fields[] = array('name' => 'quantity', 'label' => __('Quantity', 'woo_ce')); $fields[] = array('name' => 'stock_status', 'label' => __('Stock Status', 'woo_ce')); $fields[] = array('name' => 'allow_backorders', 'label' => __('Allow Backorders', 'woo_ce')); $fields[] = array('name' => 'sold_individually', 'label' => __('Sold Individually', 'woo_ce')); $fields[] = array('name' => 'total_sales', 'label' => __('Total Sales', 'woo_ce'), 'disabled' => 1); $fields[] = array('name' => 'upsell_ids', 'label' => __('Up-Sells', 'woo_ce')); $fields[] = array('name' => 'crosssell_ids', 'label' => __('Cross-Sells', 'woo_ce')); $fields[] = array('name' => 'external_url', 'label' => __('External URL', 'woo_ce')); $fields[] = array('name' => 'button_text', 'label' => __('Button Text', 'woo_ce')); $fields[] = array('name' => 'purchase_note', 'label' => __('Purchase Note', 'woo_ce')); $fields[] = array('name' => 'product_status', 'label' => __('Product Status', 'woo_ce')); $fields[] = array('name' => 'enable_reviews', 'label' => __('Enable Reviews', 'woo_ce')); $fields[] = array('name' => 'menu_order', 'label' => __('Sort Order', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); if ($remember = woo_ce_get_option($export_type . '_fields', array())) { $remember = maybe_unserialize($remember); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['disabled'] = isset($fields[$i]['disabled']) ? $fields[$i]['disabled'] : 0; $fields[$i]['default'] = 1; if (!array_key_exists($fields[$i]['name'], $remember)) { $fields[$i]['default'] = 0; } } } switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_customer_fields($format = 'full') { $export_type = 'customer'; $fields = array(); $fields[] = array('name' => 'user_id', 'label' => __('User ID', 'woocommerce-exporter')); $fields[] = array('name' => 'user_name', 'label' => __('Username', 'woocommerce-exporter')); $fields[] = array('name' => 'user_role', 'label' => __('User Role', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_full_name', 'label' => __('Billing: Full Name', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_first_name', 'label' => __('Billing: First Name', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_last_name', 'label' => __('Billing: Last Name', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_company', 'label' => __('Billing: Company', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_address', 'label' => __('Billing: Street Address', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_city', 'label' => __('Billing: City', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_postcode', 'label' => __('Billing: ZIP Code', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_state', 'label' => __('Billing: State (prefix)', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_state_full', 'label' => __('Billing: State', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_country', 'label' => __('Billing: Country', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_phone', 'label' => __('Billing: Phone Number', 'woocommerce-exporter')); $fields[] = array('name' => 'billing_email', 'label' => __('Billing: E-mail Address', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_full_name', 'label' => __('Shipping: Full Name', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_first_name', 'label' => __('Shipping: First Name', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_last_name', 'label' => __('Shipping: Last Name', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_company', 'label' => __('Shipping: Company', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_address', 'label' => __('Shipping: Street Address', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_city', 'label' => __('Shipping: City', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_postcode', 'label' => __('Shipping: ZIP Code', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_state', 'label' => __('Shipping: State (prefix)', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_state_full', 'label' => __('Shipping: State', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_country', 'label' => __('Shipping: Country (prefix)', 'woocommerce-exporter')); $fields[] = array('name' => 'shipping_country_full', 'label' => __('Shipping: Country', 'woocommerce-exporter')); $fields[] = array('name' => 'total_spent', 'label' => __('Total Spent', 'woocommerce-exporter')); $fields[] = array('name' => 'completed_orders', 'label' => __('Completed Orders', 'woocommerce-exporter')); $fields[] = array('name' => 'total_orders', 'label' => __('Total Orders', 'woocommerce-exporter')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woocommerce-exporter' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_brand_fields($format = 'full') { $export_type = 'brand'; $fields = array(); $fields[] = array('name' => 'term_id', 'label' => __('Term ID', 'woo_ce')); $fields[] = array('name' => 'name', 'label' => __('Brand Name', 'woo_ce')); $fields[] = array('name' => 'slug', 'label' => __('Brand Slug', 'woo_ce')); $fields[] = array('name' => 'parent_id', 'label' => __('Parent Term ID', 'woo_ce')); $fields[] = array('name' => 'description', 'label' => __('Brand Description', 'woo_ce')); $fields[] = array('name' => 'image', 'label' => __('Brand Image', 'woo_ce')); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters('woo_ce_' . $export_type . '_fields', $fields, $export_type); switch ($format) { case 'summary': $output = array(); $size = count($fields); for ($i = 0; $i < $size; $i++) { if (isset($fields[$i])) { $output[$fields[$i]['name']] = 'on'; } } return $output; break; case 'full': default: $sorting = woo_ce_get_option($export_type . '_sorting', array()); $size = count($fields); for ($i = 0; $i < $size; $i++) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = isset($sorting[$fields[$i]['name']]) ? $sorting[$fields[$i]['name']] : $i; } // Check if we are using PHP 5.3 and above if (version_compare(phpversion(), '5.3') >= 0) { usort($fields, woo_ce_sort_fields('order')); } return $fields; break; } }
function woo_ce_get_shipping_class_fields( $format = 'full' ) { $export_type = 'shipping_class'; $fields = array(); $fields[] = array( 'name' => 'term_id', 'label' => __( 'Term ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'name', 'label' => __( 'Shipping Class Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'slug', 'label' => __( 'Shipping Class Slug', 'woo_ce' ) ); $fields[] = array( 'name' => 'description', 'label' => __( 'Shipping Class Description', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }
function woo_ce_get_customer_fields( $format = 'full' ) { $export_type = 'customer'; $fields = array(); $fields[] = array( 'name' => 'user_id', 'label' => __( 'User ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'user_name', 'label' => __( 'Username', 'woo_ce' ) ); $fields[] = array( 'name' => 'user_role', 'label' => __( 'User Role', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_full_name', 'label' => __( 'Billing: Full Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_first_name', 'label' => __( 'Billing: First Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_last_name', 'label' => __( 'Billing: Last Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_company', 'label' => __( 'Billing: Company', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_address', 'label' => __( 'Billing: Street Address', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_city', 'label' => __( 'Billing: City', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_postcode', 'label' => __( 'Billing: ZIP Code', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_state', 'label' => __( 'Billing: State (prefix)', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_state_full', 'label' => __( 'Billing: State', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_country', 'label' => __( 'Billing: Country', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_phone', 'label' => __( 'Billing: Phone Number', 'woo_ce' ) ); $fields[] = array( 'name' => 'billing_email', 'label' => __( 'Billing: E-mail Address', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_full_name', 'label' => __( 'Shipping: Full Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_first_name', 'label' => __( 'Shipping: First Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_last_name', 'label' => __( 'Shipping: Last Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_company', 'label' => __( 'Shipping: Company', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_address', 'label' => __( 'Shipping: Street Address', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_city', 'label' => __( 'Shipping: City', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_postcode', 'label' => __( 'Shipping: ZIP Code', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_state', 'label' => __( 'Shipping: State (prefix)', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_state_full', 'label' => __( 'Shipping: State', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_country', 'label' => __( 'Shipping: Country (prefix)', 'woo_ce' ) ); $fields[] = array( 'name' => 'shipping_country_full', 'label' => __( 'Shipping: Country', 'woo_ce' ) ); $fields[] = array( 'name' => 'total_spent', 'label' => __( 'Total Spent', 'woo_ce' ) ); $fields[] = array( 'name' => 'completed_orders', 'label' => __( 'Completed Orders', 'woo_ce' ) ); $fields[] = array( 'name' => 'total_orders', 'label' => __( 'Total Orders', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }
function woo_ce_get_subscription_fields( $format = 'full' ) { $export_type = 'subscription'; $fields = array(); $fields[] = array( 'name' => 'key', 'label' => __( 'Subscription Key', 'woo_ce' ) ); $fields[] = array( 'name' => 'status', 'label' => __( 'Subscription Status', 'woo_ce' ) ); $fields[] = array( 'name' => 'name', 'label' => __( 'Subscription Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'user', 'label' => __( 'User', 'woo_ce' ) ); $fields[] = array( 'name' => 'user_id', 'label' => __( 'User ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'email', 'label' => __( 'E-mail Address', 'woo_ce' ) ); $fields[] = array( 'name' => 'order_id', 'label' => __( 'Order ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'order_status', 'label' => __( 'Order Status', 'woo_ce' ) ); // Check if this is a pre-WooCommerce 2.2 instance $woocommerce_version = woo_get_woo_version(); if( version_compare( $woocommerce_version, '2.2', '<' ) ) { $fields[] = array( 'name' => 'post_status', 'label' => __( 'Post Status', 'woo_ce' ) ); } $fields[] = array( 'name' => 'start_date', 'label' => __( 'Start Date', 'woo_ce' ) ); $fields[] = array( 'name' => 'expiration', 'label' => __( 'Expiration', 'woo_ce' ) ); $fields[] = array( 'name' => 'end_date', 'label' => __( 'End Date', 'woo_ce' ) ); $fields[] = array( 'name' => 'trial_end_date', 'label' => __( 'Trial End Date', 'woo_ce' ) ); $fields[] = array( 'name' => 'last_payment', 'label' => __( 'Last Payment', 'woo_ce' ) ); $fields[] = array( 'name' => 'next_payment', 'label' => __( 'Next Payment', 'woo_ce' ) ); $fields[] = array( 'name' => 'renewals', 'label' => __( 'Renewals', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_id', 'label' => __( 'Product ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_sku', 'label' => __( 'Product SKU', 'woo_ce' ) ); $fields[] = array( 'name' => 'variation_id', 'label' => __( 'Variation ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'coupon', 'label' => __( 'Coupon Code', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }
function woo_ce_get_user_fields( $format = 'full' ) { $export_type = 'user'; $fields = array(); $fields[] = array( 'name' => 'user_id', 'label' => __( 'User ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'user_name', 'label' => __( 'Username', 'woo_ce' ) ); $fields[] = array( 'name' => 'user_role', 'label' => __( 'User Role', 'woo_ce' ) ); $fields[] = array( 'name' => 'first_name', 'label' => __( 'First Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'last_name', 'label' => __( 'Last Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'full_name', 'label' => __( 'Full Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'nick_name', 'label' => __( 'Nickname', 'woo_ce' ) ); $fields[] = array( 'name' => 'email', 'label' => __( 'E-mail', 'woo_ce' ) ); $fields[] = array( 'name' => 'url', 'label' => __( 'Website', 'woo_ce' ) ); $fields[] = array( 'name' => 'date_registered', 'label' => __( 'Date Registered', 'woo_ce' ) ); $fields[] = array( 'name' => 'description', 'label' => __( 'Biographical Info', 'woo_ce' ) ); $fields[] = array( 'name' => 'aim', 'label' => __( 'AIM', 'woo_ce' ) ); $fields[] = array( 'name' => 'yim', 'label' => __( 'Yahoo IM', 'woo_ce' ) ); $fields[] = array( 'name' => 'jabber', 'label' => __( 'Jabber / Google Talk', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }
function woo_ce_get_coupon_fields( $format = 'full' ) { $export_type = 'coupon'; $fields = array(); $fields[] = array( 'name' => 'coupon_code', 'label' => __( 'Coupon Code', 'woo_ce' ) ); $fields[] = array( 'name' => 'coupon_description', 'label' => __( 'Coupon Description', 'woo_ce' ) ); $fields[] = array( 'name' => 'discount_type', 'label' => __( 'Discount Type', 'woo_ce' ) ); $fields[] = array( 'name' => 'coupon_amount', 'label' => __( 'Coupon Amount', 'woo_ce' ) ); $fields[] = array( 'name' => 'individual_use', 'label' => __( 'Individual Use', 'woo_ce' ) ); $fields[] = array( 'name' => 'apply_before_tax', 'label' => __( 'Apply before tax', 'woo_ce' ) ); $fields[] = array( 'name' => 'exclude_sale_items', 'label' => __( 'Exclude sale items', 'woo_ce' ) ); $fields[] = array( 'name' => 'minimum_amount', 'label' => __( 'Minimum Amount', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_ids', 'label' => __( 'Products', 'woo_ce' ) ); $fields[] = array( 'name' => 'exclude_product_ids', 'label' => __( 'Exclude Products', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_categories', 'label' => __( 'Product Categories', 'woo_ce' ) ); $fields[] = array( 'name' => 'exclude_product_categories', 'label' => __( 'Exclude Product Categories', 'woo_ce' ) ); $fields[] = array( 'name' => 'customer_email', 'label' => __( 'Customer e-mails', 'woo_ce' ) ); $fields[] = array( 'name' => 'usage_limit', 'label' => __( 'Usage Limit', 'woo_ce' ) ); $fields[] = array( 'name' => 'expiry_date', 'label' => __( 'Expiry Date', 'woo_ce' ) ); $fields[] = array( 'name' => 'usage_count', 'label' => __( 'Usage Count', 'woo_ce' ) ); $fields[] = array( 'name' => 'usage_cost', 'label' => __( 'Usage Cost', 'woo_ce' ) ); $fields[] = array( 'name' => 'used_by', 'label' => __( 'Used By', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }
function woo_ce_get_commission_fields( $format = 'full' ) { $export_type = 'commission'; $fields = array(); $fields[] = array( 'name' => 'ID', 'label' => __( 'Commission ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'post_date', 'label' => __( 'Commission Date', 'woo_ce' ) ); $fields[] = array( 'name' => 'title', 'label' => __( 'Commission Title', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_id', 'label' => __( 'Product ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_name', 'label' => __( 'Product Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_sku', 'label' => __( 'Product SKU', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_vendor_id', 'label' => __( 'Product Vendor ID', 'woo_ce' ) ); $fields[] = array( 'name' => 'product_vendor_name', 'label' => __( 'Product Vendor Name', 'woo_ce' ) ); $fields[] = array( 'name' => 'commission_amount', 'label' => __( 'Commission Amount', 'woo_ce' ) ); $fields[] = array( 'name' => 'paid_status', 'label' => __( 'Commission Status', 'woo_ce' ) ); $fields[] = array( 'name' => 'post_status', 'label' => __( 'Post Status', 'woo_ce' ) ); /* $fields[] = array( 'name' => '', 'label' => __( '', 'woo_ce' ) ); */ // Drop in our content filters here add_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); // Allow Plugin/Theme authors to add support for additional columns $fields = apply_filters( 'woo_ce_' . $export_type . '_fields', $fields, $export_type ); // Remove our content filters here to play nice with other Plugins remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' ); if( $remember = woo_ce_get_option( $export_type . '_fields', array() ) ) { $remember = maybe_unserialize( $remember ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['disabled'] = ( isset( $fields[$i]['disabled'] ) ? $fields[$i]['disabled'] : 0 ); $fields[$i]['default'] = 1; if( !array_key_exists( $fields[$i]['name'], $remember ) ) $fields[$i]['default'] = 0; } } switch( $format ) { case 'summary': $output = array(); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { if( isset( $fields[$i] ) ) $output[$fields[$i]['name']] = 'on'; } return $output; break; case 'full': default: $sorting = woo_ce_get_option( $export_type . '_sorting', array() ); $size = count( $fields ); for( $i = 0; $i < $size; $i++ ) { $fields[$i]['reset'] = $i; $fields[$i]['order'] = ( isset( $sorting[$fields[$i]['name']] ) ? $sorting[$fields[$i]['name']] : $i ); } // Check if we are using PHP 5.3 and above if( version_compare( phpversion(), '5.3' ) >= 0 ) usort( $fields, woo_ce_sort_fields( 'order' ) ); return $fields; break; } }