Beispiel #1
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;
}
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;

}