Пример #1
0
function woo_ce_extend_order_fields($fields = array())
{
    // Product Add-ons - http://www.woothemes.com/
    if (class_exists('Product_Addon_Admin') || class_exists('Product_Addon_Display')) {
        $product_addons = woo_ce_get_product_addons();
        if (!empty($product_addons)) {
            foreach ($product_addons as $product_addon) {
                if (!empty($product_addon)) {
                    $fields[] = array('name' => sprintf('order_items_product_addon_%s', $product_addon->post_name), 'label' => sprintf(__('Order Items: %s', 'woo_ce'), ucfirst($product_addon->post_title)), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_product_addons', '%s: %s'), __('Product Add-ons', 'woo_ce'), $product_addon->form_title));
                }
            }
        }
        unset($product_addons, $product_addon);
    }
    // WooCommerce Sequential Order Numbers - http://www.skyverge.com/blog/woocommerce-sequential-order-numbers/
    // Sequential Order Numbers Pro - http://www.woothemes.com/products/sequential-order-numbers-pro/
    if (class_exists('WC_Seq_Order_Number') || class_exists('WC_Seq_Order_Number_Pro')) {
        $fields[] = array('name' => 'order_number', 'label' => __('Order Number', 'woo_ce'));
    }
    // WooCommerce Print Invoice & Delivery Note - https://wordpress.org/plugins/woocommerce-delivery-notes/
    if (class_exists('WooCommerce_Delivery_Notes')) {
        $fields[] = array('name' => 'invoice_number', 'label' => __('Invoice Number', 'woo_ce'));
        $fields[] = array('name' => 'invoice_date', 'label' => __('Invoice Date', 'woo_ce'));
    }
    // WooCommerce PDF Invoices & Packing Slips - http://www.wpovernight.com
    if (class_exists('WooCommerce_PDF_Invoices')) {
        $fields[] = array('name' => 'pdf_invoice_number', 'label' => __('PDF Invoice Number', 'woo_ce'));
        $fields[] = array('name' => 'pdf_invoice_date', 'label' => __('PDF Invoice Date', 'woo_ce'));
    }
    // WooCommerce Checkout Manager - http://wordpress.org/plugins/woocommerce-checkout-manager/
    // WooCommerce Checkout Manager Pro - http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
    if (function_exists('wccs_install') || function_exists('wccs_install_pro')) {
        $options = get_option('wccs_settings');
        if (isset($options['buttons'])) {
            $buttons = $options['buttons'];
            if (!empty($buttons)) {
                $header = $buttons[0]['type'] == 'heading' ? $buttons[0]['label'] : false;
                foreach ($buttons as $button) {
                    if ($button['type'] == 'heading') {
                        continue;
                    }
                    $fields[] = array('name' => $button['label'], 'label' => !empty($header) ? sprintf(apply_filters('woo_ce_extend_order_fields_wccs', '%s: %s'), ucfirst($header), ucfirst($button['label'])) : ucfirst($button['label']));
                }
                unset($buttons, $button, $header);
            }
        }
        unset($options);
    }
    // Poor Guys Swiss Knife - http://wordpress.org/plugins/woocommerce-poor-guys-swiss-knife/
    if (function_exists('wcpgsk_init')) {
        $options = get_option('wcpgsk_settings');
        $billing_fields = isset($options['woofields']['billing']) ? $options['woofields']['billing'] : array();
        $shipping_fields = isset($options['woofields']['shipping']) ? $options['woofields']['shipping'] : array();
        // Custom billing fields
        if (!empty($billing_fields)) {
            foreach ($billing_fields as $key => $billing_field) {
                $fields[] = array('name' => $key, 'label' => $options['woofields']['label_' . $key]);
            }
            unset($billing_fields, $billing_field);
        }
        // Custom shipping fields
        if (!empty($shipping_fields)) {
            foreach ($shipping_fields as $key => $shipping_field) {
                $fields[] = array('name' => $key, 'label' => $options['woofields']['label_' . $key]);
            }
            unset($shipping_fields, $shipping_field);
        }
        unset($options);
    }
    // Checkout Field Editor - http://woothemes.com/woocommerce/
    if (function_exists('woocommerce_init_checkout_field_editor')) {
        $billing_fields = get_option('wc_fields_billing', array());
        $shipping_fields = get_option('wc_fields_shipping', array());
        $custom_fields = get_option('wc_fields_additional', array());
        // Custom billing fields
        if (!empty($billing_fields)) {
            foreach ($billing_fields as $key => $billing_field) {
                // Only add non-default Checkout fields to export columns list
                if (isset($billing_field['custom']) && $billing_field['custom'] == 1) {
                    $fields[] = array('name' => sprintf('wc_billing_%s', $key), 'label' => sprintf(__('Billing: %s', 'woo_ce'), ucfirst($billing_field['label'])));
                }
            }
        }
        unset($billing_fields, $billing_field);
        // Custom shipping fields
        if (!empty($shipping_fields)) {
            foreach ($shipping_fields as $key => $shipping_field) {
                // Only add non-default Checkout fields to export columns list
                if (isset($shipping_field['custom']) && $shipping_field['custom'] == 1) {
                    $fields[] = array('name' => sprintf('wc_shipping_%s', $key), 'label' => sprintf(__('Shipping: %s', 'woo_ce'), ucfirst($shipping_field['label'])));
                }
            }
        }
        unset($shipping_fields, $shipping_field);
        // Custom fields
        if (!empty($custom_fields)) {
            foreach ($custom_fields as $key => $custom_field) {
                // Only add non-default Checkout fields to export columns list
                if (isset($custom_field['custom']) && $custom_field['custom'] == 1) {
                    $fields[] = array('name' => sprintf('wc_additional_%s', $key), 'label' => sprintf(__('Additional: %s', 'woo_ce'), ucfirst($custom_field['label'])));
                }
            }
        }
        unset($custom_fields, $custom_field);
    }
    // Checkout Field Manager - http://61extensions.com
    if (function_exists('sod_woocommerce_checkout_manager_settings')) {
        $billing_fields = get_option('woocommerce_checkout_billing_fields', array());
        $shipping_fields = get_option('woocommerce_checkout_shipping_fields', array());
        $custom_fields = get_option('woocommerce_checkout_additional_fields', array());
        // Custom billing fields
        if (!empty($billing_fields)) {
            foreach ($billing_fields as $key => $billing_field) {
                // Only add non-default Checkout fields to export columns list
                if (strtolower($billing_field['default_field']) != 'on') {
                    $fields[] = array('name' => sprintf('sod_billing_%s', $billing_field['name']), 'label' => sprintf(__('Billing: %s', 'woo_ce'), ucfirst($billing_field['label'])));
                }
            }
        }
        unset($billing_fields, $billing_field);
        // Custom shipping fields
        if (!empty($shipping_fields)) {
            foreach ($shipping_fields as $key => $shipping_field) {
                // Only add non-default Checkout fields to export columns list
                if (strtolower($shipping_field['default_field']) != 'on') {
                    $fields[] = array('name' => sprintf('sod_shipping_%s', $shipping_field['name']), 'label' => sprintf(__('Shipping: %s', 'woo_ce'), ucfirst($shipping_field['label'])));
                }
            }
        }
        unset($shipping_fields, $shipping_field);
        // Custom fields
        if (!empty($custom_fields)) {
            foreach ($custom_fields as $key => $custom_field) {
                // Only add non-default Checkout fields to export columns list
                if (strtolower($custom_field['default_field']) != 'on') {
                    $fields[] = array('name' => sprintf('sod_additional_%s', $custom_field['name']), 'label' => sprintf(__('Additional: %s', 'woo_ce'), ucfirst($custom_field['label'])));
                }
            }
        }
        unset($custom_fields, $custom_field);
    }
    // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
    if (function_exists('init_woocommerce_checkout_add_ons')) {
        $fields[] = array('name' => 'order_items_checkout_addon_id', 'label' => __('Order Items: Checkout Add-ons ID', 'woo_ce'));
        $fields[] = array('name' => 'order_items_checkout_addon_label', 'label' => __('Order Items: Checkout Add-ons Label', 'woo_ce'));
        $fields[] = array('name' => 'order_items_checkout_addon_value', 'label' => __('Order Items: Checkout Add-ons Value', 'woo_ce'));
    }
    // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
    // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
    if (class_exists('WC_Brands') || class_exists('woo_brands') || taxonomy_exists(apply_filters('woo_ce_brand_term_taxonomy', 'product_brand'))) {
        $fields[] = array('name' => 'order_items_brand', 'label' => __('Order Items: Brand', 'woo_ce'));
    }
    // Product Vendors - http://www.woothemes.com/products/product-vendors/
    if (class_exists('WooCommerce_Product_Vendors')) {
        $fields[] = array('name' => 'order_items_vendor', 'label' => __('Order Items: Product Vendor', 'woo_ce'));
    }
    // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
    if (class_exists('WC_COG')) {
        $fields[] = array('name' => 'cost_of_goods', 'label' => __('Order Total Cost of Goods', 'woo_ce'));
        $fields[] = array('name' => 'order_items_cost_of_goods', 'label' => __('Order Items: Cost of Goods', 'woo_ce'));
        $fields[] = array('name' => 'order_items_total_cost_of_goods', 'label' => __('Order Items: Total Cost of Goods', 'woo_ce'));
    }
    // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
    if (function_exists('woocommerce_msrp_activate')) {
        $fields[] = array('name' => 'order_items_msrp', 'label' => __('Order Items: MSRP', 'woo_ce'));
    }
    // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/
    if (class_exists('WC_Local_Pickup_Plus')) {
        $fields[] = array('name' => 'order_items_pickup_location', 'label' => __('Order Items: Pickup Location', 'woo_ce'));
    }
    // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
    if (class_exists('WC_Bookings')) {
        $fields[] = array('name' => 'order_items_booking_id', 'label' => __('Order Items: Booking ID', 'woo_ce'), 'hover' => __('WooCommerce Bookings', 'woo_ce'));
        $fields[] = array('name' => 'order_items_booking_date', 'label' => __('Order Items: Booking Date', 'woo_ce'), 'hover' => __('WooCommerce Bookings', 'woo_ce'));
        $fields[] = array('name' => 'order_items_booking_start_date', 'label' => __('Order Items: Start Date', 'woo_ce'), 'hover' => __('WooCommerce Bookings', 'woo_ce'));
        $fields[] = array('name' => 'order_items_booking_end_date', 'label' => __('Order Items: End Date', 'woo_ce'), 'hover' => __('WooCommerce Bookings', 'woo_ce'));
    }
    // Gravity Forms - http://woothemes.com/woocommerce
    if (class_exists('RGForms') && class_exists('woocommerce_gravityforms')) {
        // Check if there are any Products linked to Gravity Forms
        if ($gf_fields = woo_ce_get_gravity_form_fields()) {
            $fields[] = array('name' => 'order_items_gf_form_id', 'label' => __('Order Items: Gravity Form ID', 'woo_ce'));
            $fields[] = array('name' => 'order_items_gf_form_label', 'label' => __('Order Items: Gravity Form Label', 'woo_ce'));
            foreach ($gf_fields as $gf_field) {
                $gf_field_duplicate = false;
                // Check if this isn't a duplicate Gravity Forms field
                foreach ($fields as $field) {
                    if (isset($field['name']) && $field['name'] == sprintf('order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'])) {
                        // Duplicate exists
                        $gf_field_duplicate = true;
                        break;
                    }
                }
                // If it's not a duplicate go ahead and add it to the list
                if ($gf_field_duplicate !== true) {
                    $fields[] = array('name' => sprintf('order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id']), 'label' => sprintf(apply_filters('woo_ce_extend_order_fields_gf_label', __('Order Items: %s - %s', 'woo_ce')), ucwords(strtolower($gf_field['formTitle'])), ucfirst(strtolower($gf_field['label']))), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_gf_hover', '%s: %s (ID: %d)'), __('Gravity Forms', 'woo_ce'), ucwords(strtolower($gf_field['formTitle'])), $gf_field['formId']));
                }
            }
            unset($gf_fields, $gf_field);
        }
    }
    // WooCommerce Currency Switcher - http://dev.pathtoenlightenment.net/shop
    if (class_exists('WC_Aelia_CurrencySwitcher')) {
        $fields[] = array('name' => 'order_currency', 'label' => __('Order Currency', 'woo_ce'));
    }
    // WooCommerce TM Extra Product Options - http://codecanyon.net/item/woocommerce-extra-product-options/7908619
    if (class_exists('TM_Extra_Product_Options')) {
        if ($tm_fields = woo_ce_get_extra_product_option_fields()) {
            foreach ($tm_fields as $tm_field) {
                $fields[] = array('name' => sprintf('order_items_tm_%s', sanitize_key($tm_field['name'])), 'label' => sprintf(__('Order Items: %s', 'woo_ce'), $tm_field['name']));
            }
            unset($tm_fields, $tm_field);
        }
    }
    // WooCommerce Ship to Multiple Addresses - http://woothemes.com/woocommerce
    if (class_exists('WC_Ship_Multiple')) {
        $fields[] = array('name' => 'wcms_number_packages', 'label' => __('Number of Packages', 'woo_ce'), 'hover' => __('Ship to Multiple Addresses', 'woo_ce'));
    }
    // Attributes
    if ($attributes = woo_ce_get_product_attributes()) {
        foreach ($attributes as $attribute) {
            $attribute->attribute_label = trim($attribute->attribute_label);
            if (empty($attribute->attribute_label)) {
                $attribute->attribute_label = $attribute->attribute_name;
            }
            $fields[] = array('name' => sprintf('order_items_attribute_%s', $attribute->attribute_name), 'label' => sprintf(__('Order Items: %s', 'woo_ce'), ucwords($attribute->attribute_label)), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_attribute', '%s: %s (#%d)'), __('Attribute', 'woo_ce'), $attribute->attribute_name, $attribute->attribute_id));
        }
        unset($attributes, $attribute);
    }
    // Custom Order fields
    $custom_orders = woo_ce_get_option('custom_orders', '');
    if (!empty($custom_orders)) {
        foreach ($custom_orders as $custom_order) {
            if (!empty($custom_order)) {
                $fields[] = array('name' => $custom_order, 'label' => woo_ce_clean_export_label($custom_order), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_custom_order_hover', '%s: %s'), __('Custom Order', 'woo_ce'), $custom_order));
            }
        }
        unset($custom_orders, $custom_order);
    }
    // Custom Order Items fields
    $custom_order_items = woo_ce_get_option('custom_order_items', '');
    if (!empty($custom_order_items)) {
        foreach ($custom_order_items as $custom_order_item) {
            if (!empty($custom_order_item)) {
                $fields[] = array('name' => sprintf('order_items_%s', $custom_order_item), 'label' => sprintf(__('Order Items: %s', 'woo_ce'), woo_ce_clean_export_label($custom_order_item)), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_custom_order_item_hover', '%s: %s'), __('Custom Order Item', 'woo_ce'), $custom_order_item));
            }
        }
    }
    // Custom Product fields
    $custom_product_fields = woo_ce_get_option('custom_products', '');
    if (!empty($custom_product_fields)) {
        foreach ($custom_product_fields as $custom_product_field) {
            if (!empty($custom_product_field)) {
                $fields[] = array('name' => sprintf('order_items_%s', $custom_product_field), 'label' => sprintf(__('Order Items: %s', 'woo_ce'), woo_ce_clean_export_label($custom_product_field)), 'hover' => sprintf(apply_filters('woo_ce_extend_order_fields_custom_product_hover', '%s: %s'), __('Custom Product', 'woo_ce'), $custom_product_field));
            }
        }
    }
    return $fields;
}
Пример #2
0
function woo_ce_extend_product_fields($fields)
{
    // Attributes
    // Attributes
    /*
    	if( $attributes = woo_ce_get_product_attributes() ) {
    		foreach( $attributes as $attribute ) {
    			if( empty( $attribute->attribute_label ) )
    				$attribute->attribute_label = $attribute->attribute_name;
    			$fields[] = array(
    				'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
    				'label' => sprintf( __( 'Attribute: %s', 'woo_ce' ), $attribute->attribute_label )
    			);
    		}
    	}
    */
    // Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
    if (function_exists('woocommerce_gpf_install')) {
        $fields[] = array('name' => 'gpf_availability', 'label' => __('Advanced Google Product Feed - Availability', 'woo_ce'));
        $fields[] = array('name' => 'gpf_condition', 'label' => __('Advanced Google Product Feed - Condition', 'woo_ce'));
        $fields[] = array('name' => 'gpf_brand', 'label' => __('Advanced Google Product Feed - Brand', 'woo_ce'));
        $fields[] = array('name' => 'gpf_product_type', 'label' => __('Advanced Google Product Feed - Product Type', 'woo_ce'));
        $fields[] = array('name' => 'gpf_google_product_category', 'label' => __('Advanced Google Product Feed - Google Product Category', 'woo_ce'));
        $fields[] = array('name' => 'gpf_gtin', 'label' => __('Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woo_ce'));
        $fields[] = array('name' => 'gpf_mpn', 'label' => __('Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woo_ce'));
        $fields[] = array('name' => 'gpf_gender', 'label' => __('Advanced Google Product Feed - Gender', 'woo_ce'));
        $fields[] = array('name' => 'gpf_agegroup', 'label' => __('Advanced Google Product Feed - Age Group', 'woo_ce'));
        $fields[] = array('name' => 'gpf_colour', 'label' => __('Advanced Google Product Feed - Colour', 'woo_ce'));
        $fields[] = array('name' => 'gpf_size', 'label' => __('Advanced Google Product Feed - Size', 'woo_ce'));
    }
    // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
    if (function_exists('aioseop_activate')) {
        $fields[] = array('name' => 'aioseop_keywords', 'label' => __('All in One SEO - Keywords', 'woo_ce'));
        $fields[] = array('name' => 'aioseop_description', 'label' => __('All in One SEO - Description', 'woo_ce'));
        $fields[] = array('name' => 'aioseop_title', 'label' => __('All in One SEO - Title', 'woo_ce'));
        $fields[] = array('name' => 'aioseop_title_attributes', 'label' => __('All in One SEO - Title Attributes', 'woo_ce'));
        $fields[] = array('name' => 'aioseop_menu_label', 'label' => __('All in One SEO - Menu Label', 'woo_ce'));
    }
    // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
    if (function_exists('wpseo_admin_init')) {
        $fields[] = array('name' => 'wpseo_focuskw', 'label' => __('WordPress SEO - Focus Keyword', 'woo_ce'));
        $fields[] = array('name' => 'wpseo_metadesc', 'label' => __('WordPress SEO - Meta Description', 'woo_ce'));
        $fields[] = array('name' => 'wpseo_title', 'label' => __('WordPress SEO - SEO Title', 'woo_ce'));
        $fields[] = array('name' => 'wpseo_googleplus_description', 'label' => __('WordPress SEO - Google+ Description', 'woo_ce'));
        $fields[] = array('name' => 'wpseo_opengraph_description', 'label' => __('WordPress SEO - Facebook Description', 'woo_ce'));
    }
    // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
    if (function_exists('su_wp_incompat_notice')) {
        $fields[] = array('name' => 'useo_meta_title', 'label' => __('Ultimate SEO - Title Tag', 'woo_ce'));
        $fields[] = array('name' => 'useo_meta_description', 'label' => __('Ultimate SEO - Meta Description', 'woo_ce'));
        $fields[] = array('name' => 'useo_meta_keywords', 'label' => __('Ultimate SEO - Meta Keywords', 'woo_ce'));
        $fields[] = array('name' => 'useo_social_title', 'label' => __('Ultimate SEO - Social Title', 'woo_ce'));
        $fields[] = array('name' => 'useo_social_description', 'label' => __('Ultimate SEO - Social Description', 'woo_ce'));
        $fields[] = array('name' => 'useo_meta_noindex', 'label' => __('Ultimate SEO - NoIndex', 'woo_ce'));
        $fields[] = array('name' => 'useo_meta_noautolinks', 'label' => __('Ultimate SEO - Disable Autolinks', 'woo_ce'));
    }
    // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
    if (function_exists('woocommerce_msrp_activate')) {
        $fields[] = array('name' => 'msrp', 'label' => __('MSRP', 'woo_ce'), 'hover' => __('Manufacturer Suggested Retail Price (MSRP)', 'woo_ce'), 'disabled' => 1);
    }
    // WooCommerce Brands Addon - http://woothemes.com/woocommerce/
    // WooCommerce Brands - http://proword.net/Woocommerce_Brands/
    if (class_exists('WC_Brands') || class_exists('woo_brands')) {
        $fields[] = array('name' => 'brands', 'label' => __('Brands', 'woo_ce'), 'disabled' => 1);
    }
    // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
    if (class_exists('WC_COG')) {
        $fields[] = array('name' => 'cost_of_goods', 'label' => __('Cost of Goods', 'woo_ce'), 'disabled' => 1);
    }
    // Per-Product Shipping - http://www.woothemes.com/products/per-product-shipping/
    if (function_exists('woocommerce_per_product_shipping_init')) {
        $fields[] = array('name' => 'per_product_shipping', 'label' => __('Per-Product Shipping', 'woo_ce'), 'disabled' => 1);
    }
    // Product Vendors - http://www.woothemes.com/products/product-vendors/
    if (class_exists('WooCommerce_Product_Vendors')) {
        $fields[] = array('name' => 'vendors', 'label' => __('Product Vendors', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'vendor_ids', 'label' => __('Product Vendor ID\'s', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'vendor_commission', 'label' => __('Vendor Commission', 'woo_ce'), 'disabled' => 1);
    }
    // Advanced Custom Fields - http://www.advancedcustomfields.com
    if (class_exists('acf')) {
        if ($custom_fields = woo_ce_get_acf_product_fields()) {
            foreach ($custom_fields as $custom_field) {
                $fields[] = array('name' => $custom_field['name'], 'label' => $custom_field['label'], 'disabled' => 1);
            }
            unset($custom_fields, $custom_field);
        }
    }
    // WooCommerce Subscriptions -
    if (class_exists('WC_Subscriptions_Manager')) {
        $fields[] = array('name' => 'subscription_price', 'label' => __('Subscription Price', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_period_interval', 'label' => __('Subscription Period Interval', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_period', 'label' => __('Subscription Period', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_length', 'label' => __('Subscription Length', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_sign_up_fee', 'label' => __('Subscription Sign-up Fee', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_trial_length', 'label' => __('Subscription Trial Length', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_trial_period', 'label' => __('Subscription Trial Period', 'woo_ce'), 'disabled' => 1);
        $fields[] = array('name' => 'subscription_limit', 'label' => __('Limit Subscription', 'woo_ce'), 'disabled' => 1);
    }
    // Custom Product meta
    $custom_products = woo_ce_get_option('custom_products', '');
    if (!empty($custom_products)) {
        foreach ($custom_products as $custom_product) {
            if (!empty($custom_product)) {
                $fields[] = array('name' => $custom_product, 'label' => woo_ce_clean_export_label($custom_product), 'hover' => sprintf(apply_filters('woo_ce_extend_product_fields_custom_product_hover', '%s: %s'), __('Custom Product', 'woo_ce'), $custom_product));
            }
        }
        unset($custom_products, $custom_product);
    }
    return $fields;
}
Пример #3
0
function woo_ce_extend_customer_fields( $fields = array() ) {

	// WooCommerce Follow-Up Emails
	if( class_exists( 'FollowUpEmails' ) ) {
		$fields[] = array(
			'name' => 'followup_optout',
			'label' => __( 'Follow-Up Emails: Opted Out', 'woo_ce' )
		);
	}

	// WooCommerce Hear About Us - https://wordpress.org/plugins/woocommerce-hear-about-us/
	if( class_exists( 'WooCommerce_HearAboutUs' ) ) {
		$fields[] = array(
			'name' => 'hear_about_us',
			'label' => __( 'Source', 'woo_ce' ),
			'hover' => __( 'WooCommerce Hear About Us', 'woo_ce' )
		);
	}

	// Custom Customer fields
	$custom_customers = woo_ce_get_option( 'custom_customers', '' );
	if( !empty( $custom_customers ) ) {
		foreach( $custom_customers as $custom_customer ) {
			if( !empty( $custom_customer ) ) {
				$fields[] = array(
					'name' => $custom_customer,
					'label' => woo_ce_clean_export_label( $custom_customer ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_customer_fields_custom_customer_hover', '%s: %s' ), __( 'Custom Customer', 'woo_ce' ), $custom_customer )
				);
			}
		}
		unset( $custom_customers, $custom_customer );
	}

	// Custom User fields
	$custom_users = woo_ce_get_option( 'custom_users', '' );
	if( !empty( $custom_users ) ) {
		foreach( $custom_users as $custom_user ) {
			if( !empty( $custom_user ) ) {
				$fields[] = array(
					'name' => $custom_user,
					'label' => woo_ce_clean_export_label( $custom_user ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_customer_fields_custom_user_hover', '%s: %s' ), __( 'Custom User', 'woo_ce' ), $custom_user )
				);
			}
		}
	}
	unset( $custom_users, $custom_user );

	return $fields;

}
function woo_ce_extend_subscription_fields( $fields = array() ) {

	if( class_exists( 'WC_Admin_Profile' ) ) {
		$admin_profile = new WC_Admin_Profile();
		if( method_exists( 'WC_Admin_Profile', 'get_customer_meta_fields' ) ) {
			$show_fields = $admin_profile->get_customer_meta_fields();
			foreach( $show_fields as $fieldset ) {
				foreach( $fieldset['fields'] as $key => $field ) {
					$fields[] = array(
						'name' => $key,
						'label' => sprintf( apply_filters( 'woo_ce_extend_subscription_fields_wc', '%s: %s' ), $fieldset['title'], esc_html( $field['label'] ) )
					);
				}
			}
			unset( $show_fields, $fieldset, $field );
		}
	}

	// Custom Order fields
	$custom_orders = woo_ce_get_option( 'custom_orders', '' );
	if( !empty( $custom_orders ) ) {
		foreach( $custom_orders as $custom_order ) {
			if( !empty( $custom_order ) ) {
				$fields[] = array(
					'name' => $custom_order,
					'label' => woo_ce_clean_export_label( $custom_order )
				);
			}
		}
		unset( $custom_orders, $custom_order );
	}

	// Custom User fields
	$custom_users = woo_ce_get_option( 'custom_users', '' );
	if( !empty( $custom_users ) ) {
		foreach( $custom_users as $custom_user ) {
			if( !empty( $custom_user ) ) {
				$fields[] = array(
					'name' => $custom_user,
					'label' => woo_ce_clean_export_label( $custom_user ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_subscription_fields_custom_user_hover', '%s: %s' ), __( 'Custom User', 'woo_ce' ), $custom_user )
				);
			}
		}
	}
	unset( $custom_users, $custom_user );

	return $fields;

}
Пример #5
0
function woo_ce_extend_user_fields( $fields = array() ) {

	// WooCommerce Hear About Us - https://wordpress.org/plugins/woocommerce-hear-about-us/
	if( class_exists( 'WooCommerce_HearAboutUs' ) ) {
		$fields[] = array(
			'name' => 'hear_about_us',
			'label' => __( 'Source', 'woo_ce' ),
			'hover' => __( 'WooCommerce Hear About Us', 'woo_ce' )
		);
	}

	// WooCommerce User fields
	if( class_exists( 'WC_Admin_Profile' ) ) {
		$admin_profile = new WC_Admin_Profile();
		if( method_exists( 'WC_Admin_Profile', 'get_customer_meta_fields' ) ) {
			$show_fields = $admin_profile->get_customer_meta_fields();
			foreach( $show_fields as $fieldset ) {
				foreach( $fieldset['fields'] as $key => $field ) {
					$fields[] = array(
						'name' => $key,
						'label' => sprintf( apply_filters( 'woo_ce_extend_user_fields_wc', '%s: %s' ), $fieldset['title'], esc_html( $field['label'] ) )
					);
				}
			}
			unset( $show_fields, $fieldset, $field );
		}
	}

	// Custom User meta
	$custom_users = woo_ce_get_option( 'custom_users', '' );
	if( !empty( $custom_users ) ) {
		foreach( $custom_users as $custom_user ) {
			if( !empty( $custom_user ) ) {
				$fields[] = array(
					'name' => $custom_user,
					'label' => woo_ce_clean_export_label( $custom_user ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_user_fields_custom_user_hover', '%s: %s' ), __( 'Custom User', 'woo_ce' ), $custom_user )
				);
			}
		}
	}
	unset( $custom_users, $custom_user );

	return $fields;

}
Пример #6
0
function woo_ce_extend_product_fields( $fields ) {

	// Attributes
	$has_attributes = false;
	$attribute_taxonomies = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
	if( !empty( $attribute_taxonomies ) ) {
		$has_attributes = true;
		foreach( $attribute_taxonomies as $tax ) {
			$label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
			$fields[] = array(
				'name' => sprintf( 'attribute_%s', esc_attr( $tax->attribute_name ) ),
				'label' => sprintf( __( 'Attribute: %s', 'woo_ce' ), esc_attr( $label ) )
			);
		}
		unset( $attribute_taxonomies, $tax, $label );
	}

	// Custom Attributes
	$custom_attributes = woo_ce_get_option( 'custom_attributes', '' );
	if( !empty( $custom_attributes ) ) {
		$has_attributes = true;
		foreach( $custom_attributes as $custom_attribute ) {
			if( !empty( $custom_attribute ) ) {
				$fields[] = array(
					'name' => sprintf( 'attribute_%s', $custom_attribute ),
					'label' => sprintf( __( 'Attribute: %s', 'woo_ce' ), woo_ce_clean_export_label( $custom_attribute ) ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_product_fields_custom_attribute_hover', '%s: %s' ), __( 'Custom Attribute', 'woo_ce' ), $custom_attribute )
				);
			}
		}
		unset( $custom_attributes, $custom_attribute );
	}

	// Show Default Attributes field
	if( $has_attributes ) {
		$fields[] = array(
			'name' => 'default_attributes',
			'label' => __( 'Default Attributes', 'woo_ce' )
		);
	}

/*
	// Attributes
	if( $attributes = woo_ce_get_product_attributes() ) {
		foreach( $attributes as $attribute ) {
			if( empty( $attribute->attribute_label ) )
				$attribute->attribute_label = $attribute->attribute_name;
			$fields[] = array(
				'name' => sprintf( 'attribute_%s', $attribute->attribute_name ),
				'label' => sprintf( __( 'Attribute: %s', 'woo_ce' ), $attribute->attribute_label )
			);
		}
	}
*/

	// Advanced Google Product Feed - http://www.leewillis.co.uk/wordpress-plugins/
	if( function_exists( 'woocommerce_gpf_install' ) ) {
		$fields[] = array(
			'name' => 'gpf_availability',
			'label' => __( 'Advanced Google Product Feed - Availability', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_condition',
			'label' => __( 'Advanced Google Product Feed - Condition', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_brand',
			'label' => __( 'Advanced Google Product Feed - Brand', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_product_type',
			'label' => __( 'Advanced Google Product Feed - Product Type', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_google_product_category',
			'label' => __( 'Advanced Google Product Feed - Google Product Category', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_gtin',
			'label' => __( 'Advanced Google Product Feed - Global Trade Item Number (GTIN)', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_mpn',
			'label' => __( 'Advanced Google Product Feed - Manufacturer Part Number (MPN)', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_gender',
			'label' => __( 'Advanced Google Product Feed - Gender', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_agegroup',
			'label' => __( 'Advanced Google Product Feed - Age Group', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_colour',
			'label' => __( 'Advanced Google Product Feed - Colour', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'gpf_size',
			'label' => __( 'Advanced Google Product Feed - Size', 'woo_ce' )
		);
	}

	// All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/
	if( function_exists( 'aioseop_activate' ) ) {
		$fields[] = array(
			'name' => 'aioseop_keywords',
			'label' => __( 'All in One SEO - Keywords', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'aioseop_description',
			'label' => __( 'All in One SEO - Description', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'aioseop_title',
			'label' => __( 'All in One SEO - Title', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'aioseop_title_attributes',
			'label' => __( 'All in One SEO - Title Attributes', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'aioseop_menu_label',
			'label' => __( 'All in One SEO - Menu Label', 'woo_ce' )
		);
	}

	// WordPress SEO - http://wordpress.org/plugins/wordpress-seo/
	if( function_exists( 'wpseo_admin_init' ) ) {
		$fields[] = array(
			'name' => 'wpseo_focuskw',
			'label' => __( 'WordPress SEO - Focus Keyword', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'wpseo_metadesc',
			'label' => __( 'WordPress SEO - Meta Description', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'wpseo_title',
			'label' => __( 'WordPress SEO - SEO Title', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'wpseo_googleplus_description',
			'label' => __( 'WordPress SEO - Google+ Description', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'wpseo_opengraph_description',
			'label' => __( 'WordPress SEO - Facebook Description', 'woo_ce' )
		);
	}

	// Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/
	if( function_exists( 'su_wp_incompat_notice' ) ) {
		$fields[] = array(
			'name' => 'useo_meta_title',
			'label' => __( 'Ultimate SEO - Title Tag', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_meta_description',
			'label' => __( 'Ultimate SEO - Meta Description', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_meta_keywords',
			'label' => __( 'Ultimate SEO - Meta Keywords', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_social_title',
			'label' => __( 'Ultimate SEO - Social Title', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_social_description',
			'label' => __( 'Ultimate SEO - Social Description', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_meta_noindex',
			'label' => __( 'Ultimate SEO - NoIndex', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'useo_meta_noautolinks',
			'label' => __( 'Ultimate SEO - Disable Autolinks', 'woo_ce' )
		);
	}

	// WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
	if( function_exists( 'woocommerce_msrp_activate' ) ) {
		$fields[] = array(
			'name' => 'msrp',
			'label' => __( 'MSRP', 'woo_ce' ),
			'hover' => __( 'Manufacturer Suggested Retail Price (MSRP)', 'woo_ce' )
		);
	}

	// WooCommerce Brands Addon - http://woothemes.com/woocommerce/
	// WooCommerce Brands - http://proword.net/Woocommerce_Brands/
	if( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) ) {
		$fields[] = array(
			'name' => 'brands',
			'label' => __( 'Brands', 'woo_ce' )
		);
	}

	// Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
	if( class_exists( 'WC_COG' ) ) {
		$fields[] = array(
			'name' => 'cost_of_goods',
			'label' => __( 'Cost of Goods', 'woo_ce' )
		);
	}

	// Per-Product Shipping - http://www.woothemes.com/products/per-product-shipping/
	if( function_exists( 'woocommerce_per_product_shipping_init' ) ) {
		$fields[] = array(
			'name' => 'per_product_shipping',
			'label' => __( 'Per-Product Shipping', 'woo_ce' )
		);
	}

	// Product Vendors - http://www.woothemes.com/products/product-vendors/
	if( class_exists( 'WooCommerce_Product_Vendors' ) ) {
		$fields[] = array(
			'name' => 'vendors',
			'label' => __( 'Product Vendors', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'vendor_ids',
			'label' => __( 'Product Vendor ID\'s', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'vendor_commission',
			'label' => __( 'Vendor Commission', 'woo_ce' )
		);
	}

	// WooCommerce Wholesale Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/
	if( class_exists( 'woocommerce_wholesale_pricing' ) ) {
		$fields[] = array(
			'name' => 'wholesale_price',
			'label' => __( 'Wholesale Price', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'wholesale_price_text',
			'label' => __( 'Wholesale Text', 'woo_ce' )
		);
	}

	// Advanced Custom Fields - http://www.advancedcustomfields.com
	if( class_exists( 'acf' ) ) {
		if( $custom_fields = woo_ce_get_acf_product_fields() ) {
			foreach( $custom_fields as $custom_field ) {
				$fields[] = array(
					'name' => $custom_field['name'],
					'label' => $custom_field['label']
				);
			}
			unset( $custom_fields, $custom_field );
		}
	}

	// WooCommerce Subscriptions -
	if( class_exists( 'WC_Subscriptions_Manager' ) ) {
		$fields[] = array(
			'name' => 'subscription_price',
			'label' => __( 'Subscription Price', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_period_interval',
			'label' => __( 'Subscription Period Interval', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_period',
			'label' => __( 'Subscription Period', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_length',
			'label' => __( 'Subscription Length', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_sign_up_fee',
			'label' => __( 'Subscription Sign-up Fee', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_trial_length',
			'label' => __( 'Subscription Trial Length', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_trial_period',
			'label' => __( 'Subscription Trial Period', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'subscription_limit',
			'label' => __( 'Limit Subscription', 'woo_ce' )
		);
	}

	// WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
	if( class_exists( 'WC_Bookings' ) ) {
		$fields[] = array(
			'name' => 'booking_has_persons',
			'label' => __( 'Booking Has Persons', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_has_resources',
			'label' => __( 'Booking Has Resources', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_base_cost',
			'label' => __( 'Booking Base Cost', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_block_cost',
			'label' => __( 'Booking Block Cost', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_display_cost',
			'label' => __( 'Booking Display Cost', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_requires_confirmation',
			'label' => __( 'Booking Requires Confirmation', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'booking_user_can_cancel',
			'label' => __( 'Booking Can Be Cancelled', 'woo_ce' )
		);
	}

	// Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/
	if( function_exists( 'wpps_requirements_met' ) ) {
		$fields[] = array(
			'name' => 'barcode_type',
			'label' => __( 'Barcode Type', 'woo_ce' )
		);
		$fields[] = array(
			'name' => 'barcode',
			'label' => __( 'Barcode', 'woo_ce' )
		);
	}

	// Custom Product meta
	$custom_products = woo_ce_get_option( 'custom_products', '' );
	if( !empty( $custom_products ) ) {
		foreach( $custom_products as $custom_product ) {
			if( !empty( $custom_product ) ) {
				$fields[] = array(
					'name' => $custom_product,
					'label' => woo_ce_clean_export_label( $custom_product ),
					'hover' => sprintf( apply_filters( 'woo_ce_extend_product_fields_custom_product_hover', '%s: %s' ), __( 'Custom Product', 'woo_ce' ), $custom_product )
				);
			}
		}
	}
	unset( $custom_products, $custom_product );

	return $fields;

}