function woo_ce_extend_order_items_combined( $order ) { global $export; // Product Add-ons - http://www.woothemes.com/ $product_addons = woo_ce_get_product_addons(); if( $product_addons && $order->order_items ) { foreach( $product_addons as $product_addon ) { foreach( $order->order_items as $order_item ) { if( isset( $order_item->product_addons[$product_addon->post_name] ) ) $order->{'order_items_product_addon_' . $product_addon->post_name} .= $order_item->product_addons[$product_addon->post_name] . $export->category_separator; } if( isset( $order->{'order_items_product_addon_' . $product_addon->post_name} ) ) $order->{'order_items_product_addon_' . $product_addon->post_name} = substr( $order->{'order_items_product_addon_' . $product_addon->post_name}, 0, -1 ); } } // Gravity Forms - http://woothemes.com/woocommerce $gf_fields = woo_ce_get_gravity_form_fields(); if( $gf_fields && $order->order_items ) { $meta_type = 'order_item'; $order->order_items_gf_form_id = ''; $order->order_items_gf_form_label = ''; foreach( $order->order_items as $order_item ) { $gravity_forms_history = get_metadata( $meta_type, $order_item->id, '_gravity_forms_history', true ); // Check that Gravity Forms Order item meta isn't empty if( !empty( $gravity_forms_history ) ) { if( isset( $gravity_forms_history['_gravity_form_data'] ) ) { $order->order_items_gf_form_id .= $gravity_forms_history['_gravity_form_data']['id'] . $export->category_separator; $gravity_form = ( method_exists( 'RGFormsModel', 'get_form' ) ? RGFormsModel::get_form( $gravity_forms_history['_gravity_form_data']['id'] ) : array() ); $order->order_items_gf_form_label .= ( !empty( $gravity_form ) ? $gravity_form->title : '' ) . $export->category_separator; unset( $gravity_form ); } } foreach( $gf_fields as $gf_field ) { // Check that we only fill export fields for forms that are actually filled if( $gf_field['formId'] == $gravity_forms_history['_gravity_form_data']['id'] ) $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} .= get_metadata( $meta_type, $order_item->id, $gf_field['label'], true ) . $export->category_separator; } unset( $gravity_forms_history ); } if( isset( $order->order_items_gf_form_id ) ) $order->order_items_gf_form_id = substr( $order->order_items_gf_form_id, 0, -1 ); if( isset( $order->order_items_gf_form_label ) ) $order->order_items_gf_form_label = substr( $order->order_items_gf_form_label, 0, -1 ); if( isset( $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} ) ) $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} = substr( $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )}, 0, -1 ); } // WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/ if( function_exists( 'init_woocommerce_checkout_add_ons' ) && $order->order_items ) { $meta_type = 'order_item'; foreach( $order->order_items as $order_item ) { $order->order_items_checkout_addon_id .= $order_item->checkout_addon_id . $export->category_separator; $order->order_items_checkout_addon_label .= $order_item->checkout_addon_label . $export->category_separator; $order->order_items_checkout_addon_value .= $order_item->checkout_addon_value . $export->category_separator; } if( isset( $order->order_items_checkout_addon_id ) ) $order->order_items_checkout_addon_id = substr( $order->order_items_checkout_addon_id, 0, -1 ); if( isset( $order->order_items_checkout_addon_label ) ) $order->order_items_checkout_addon_label = substr( $order->order_items_checkout_addon_label, 0, -1 ); if( isset( $order->order_items_checkout_addon_value ) ) $order->order_items_checkout_addon_value = substr( $order->order_items_checkout_addon_value, 0, -1 ); } // 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' ) ) ) && $order->order_items ) { $meta_type = 'order_item'; foreach( $order->order_items as $order_item ) $order->order_items_brand .= woo_ce_get_product_assoc_brands( $order_item->product_id ) . $export->category_separator; if( isset( $order->order_items_brand ) ) $order->order_items_brand = substr( $order->order_items_brand, 0, -1 ); } // Product Vendors - http://www.woothemes.com/products/product-vendors/ if( class_exists( 'WooCommerce_Product_Vendors' ) && $order->order_items ) { $meta_type = 'order_item'; foreach( $order->order_items as $order_item ) $order->order_items_vendor = woo_ce_get_product_assoc_product_vendors( $order_item->product_id ) . $export->category_separator; if( isset( $order->order_items_vendor ) ) $order->order_items_vendor = substr( $order->order_items_vendor, 0, -1 ); } // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/ if( class_exists( 'WC_COG' ) && $order->order_items ) { $meta_type = 'order_item'; foreach( $order->order_items as $order_item ) { $order->order_items_cost_of_goods .= woo_ce_format_price( get_metadata( $meta_type, $order_item->id, '_wc_cog_item_cost', true ), $order->order_currency ) . $export->category_separator; $order->order_items_total_cost_of_goods .= woo_ce_format_price( get_metadata( $meta_type, $order_item->id, '_wc_cog_item_total_cost', true ), $order->order_currency ) . $export->category_separator; } if( isset( $order->order_items_cost_of_goods ) ) $order->order_items_cost_of_goods = substr( $order->order_items_cost_of_goods, 0, -1 ); if( isset( $order->order_items_total_cost_of_goods ) ) $order->order_items_total_cost_of_goods = substr( $order->order_items_total_cost_of_goods, 0, -1 ); } // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/ if( function_exists( 'woocommerce_msrp_activate' ) && $order->order_items ) { foreach( $order->order_items as $order_item ) { $order->order_items_msrp .= woo_ce_format_price( get_post_meta( $order_item->product_id, '_msrp_price', true ) ) . $export->category_separator; } if( isset( $order->order_items_msrp ) ) $order->order_items_msrp = substr( $order->order_items_msrp, 0, -1 ); } // Local Pickup Plus - http://www.woothemes.com/products/local-pickup-plus/ if( class_exists( 'WC_Local_Pickup_Plus' ) && $order->order_items ) { $meta_type = 'order_item'; $order->order_items_pickup_location = ''; foreach( $order->order_items as $order_item ) { $pickup_location = get_metadata( $meta_type, $order_item->id, 'Pickup Location', true ); if( !empty( $pickup_location ) ) $order->order_items_pickup_location .= get_metadata( $meta_type, $order_item->id, 'Pickup Location', true ) . $export->category_separator; unset( $pickup_location ); } if( isset( $order->order_items_pickup_location ) ) $order->order_items_pickup_location = substr( $order->order_items_pickup_location, 0, -1 ); } // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/ if( class_exists( 'WC_Bookings' ) && $order->order_items ) { $meta_type = 'order_item'; $order->order_items_booking_id = ''; $order->order_items_booking_date = ''; $order->order_items_booking_type = ''; $order->order_items_booking_start_date = ''; $order->order_items_booking_end_date = ''; foreach( $order->order_items as $order_item ) { $booking_id = woo_ce_get_order_assoc_booking_id( $order->id ); if( !empty( $booking_id ) ) { $order->order_items_booking_id .= $booking_id . $export->category_separator; $booking_start_date = get_post_meta( $booking_id, '_booking_start', true ); if( !empty( $booking_start_date ) ) $order->order_items_start_date .= woo_ce_format_date( date( 'Y-m-d', strtotime( $booking_start_date ) ) ) . $export->category_separator; unset( $booking_start_date ); $booking_end_date = get_post_meta( $booking_id, '_booking_end', true ); if( !empty( $booking_end_date ) ) $order->order_items_booking_end_date .= woo_ce_format_date( date( 'Y-m-d', strtotime( $booking_end_date ) ) ) . $export->category_separator; unset( $booking_end_date ); } unset( $booking_id ); $booking_date = get_metadata( $meta_type, $order_item->id, 'Booking Date', true ); if( !empty( $booking_date ) ) $order->order_items_booking_date .= get_metadata( $meta_type, $order_item->id, 'Booking Date', true ) . $export->category_separator; unset( $booking_date ); $booking_type = get_metadata( $meta_type, $order_item->id, 'Booking Type', true ); if( !empty( $booking_type ) ) $order->order_items_booking_type .= get_metadata( $meta_type, $order_item->id, 'Booking Type', true ) . $export->category_separator; unset( $booking_type ); } if( isset( $order->order_items_booking_id ) ) $order->order_items_booking_id = substr( $order->order_items_booking_id, 0, -1 ); if( isset( $order->order_items_booking_date ) ) $order->order_items_booking_date = substr( $order->order_items_booking_date, 0, -1 ); if( isset( $order->order_items_booking_type ) ) $order->order_items_booking_type = substr( $order->order_items_booking_type, 0, -1 ); if( isset( $order->order_items_booking_start_date ) ) $order->order_items_booking_start_date = substr( $order->order_items_booking_start_date, 0, -1 ); if( isset( $order->order_items_booking_end_date ) ) $order->order_items_booking_end_date = substr( $order->order_items_booking_end_date, 0, -1 ); } // WooCommerce TM Extra Product Options - http://codecanyon.net/item/woocommerce-extra-product-options/7908619 if( class_exists( 'TM_Extra_Product_Options' ) && $order->order_items ) { if( $tm_fields = woo_ce_get_extra_product_option_fields() ) { foreach( $tm_fields as $tm_field ) $order->{'order_items_tm_' . sanitize_key( $tm_field['name'] )} = ''; foreach( $order->order_items as $order_item ) { foreach( $tm_fields as $tm_field ) $order->{sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) )} .= $order_item->{'tm_' . sanitize_key( $tm_field['name'] )} . $export->category_separator; } foreach( $tm_fields as $tm_field ) { if( isset( $order->{sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) )} ) ) $order->{sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) )} = substr( $order->{sprintf( 'order_items_tm_%s', sanitize_key( $tm_field['name'] ) )}, 0, -1 ); } } } // Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/ if( function_exists( 'wpps_requirements_met' ) ) { foreach( $order->order_items as $order_item ) { $order->order_items_barcode_type .= get_post_meta( $order_item->product_id, '_barcode_type', true ) . $export->category_separator; $order->order_items_barcode .= get_post_meta( $order_item->product_id, '_barcode', true ) . $export->category_separator; } if( isset( $order->order_items_barcode_type ) ) $order->order_items_barcode_type = substr( $order->order_items_barcode_type, 0, -1 ); if( isset( $order->order_items_barcode ) ) $order->order_items_barcode = substr( $order->order_items_barcode, 0, -1 ); } // Attributes $attributes = woo_ce_get_product_attributes(); if( $attributes && $order->order_items ) { foreach( $attributes as $attribute ) $order->{'order_items_attribute_' . sanitize_key( $attribute->attribute_name )} = ''; foreach( $order->order_items as $order_item ) { foreach( $attributes as $attribute ) { if( isset( $order_item->{'attribute_' . $attribute->attribute_name} ) ) $order->{'order_items_attribute_' . sanitize_key( $attribute->attribute_name )} .= $order_item->{'attribute_' . $attribute->attribute_name} . $export->category_separator; } } foreach( $attributes as $attribute ) { if( isset( $order->{'order_items_attribute_' . sanitize_key( $attribute->attribute_name )} ) ) $order->{'order_items_attribute_' . sanitize_key( $attribute->attribute_name )} = substr( $order->{'order_items_attribute_' . sanitize_key( $attribute->attribute_name )}, 0, -1 ); } unset( $attributes, $attribute ); } // Custom Order Items fields $custom_order_items = woo_ce_get_option( 'custom_order_items', '' ); if( !empty( $custom_order_items ) && $order->order_items ) { foreach( $custom_order_items as $custom_order_item ) $order->{'order_items_' . $custom_order_item} = ''; foreach( $order->order_items as $order_item ) { foreach( $custom_order_items as $custom_order_item ) { if( !empty( $custom_order_item ) ) $order->{'order_items_' . $custom_order_item} .= $order_item->{$custom_order_item} . $export->category_separator; } } foreach( $custom_order_items as $custom_order_item ) { if( isset( $order->{'order_items_' . $custom_order_item} ) ) $order->{'order_items_' . $custom_order_item} = substr( $order->{'order_items_' . $custom_order_item}, 0, -1 ); } } // Custom Product fields $custom_products = woo_ce_get_option( 'custom_products', '' ); if( !empty( $custom_products ) ) { foreach( $custom_products as $custom_product ) $order->{'order_items_' . $custom_product} = ''; foreach( $order->order_items as $order_item ) { foreach( $custom_products as $custom_product ) { if( !empty( $custom_product ) ) $order->{'order_items_' . $custom_product} .= $order_item->{$custom_product} . $export->category_separator; } } foreach( $custom_products as $custom_product ) { if( isset( $order->{'order_items_' . $custom_product} ) ) $order->{'order_items_' . $custom_product} = substr( $order->{'order_items_' . $custom_product}, 0, -1 ); } } return $order; }
function woo_ce_extend_product_item( $product, $product_id ) { global $export; // Advanced Google Product Feed - http://plugins.leewillis.co.uk/downloads/wp-e-commerce-product-feeds/ if( function_exists( 'woocommerce_gpf_install' ) ) { $product->gpf_data = get_post_meta( $product_id, '_woocommerce_gpf_data', true ); $product->gpf_availability = ( isset( $product->gpf_data['availability'] ) ? woo_ce_format_gpf_availability( $product->gpf_data['availability'] ) : '' ); $product->gpf_condition = ( isset( $product->gpf_data['condition'] ) ? woo_ce_format_gpf_condition( $product->gpf_data['condition'] ) : '' ); $product->gpf_brand = ( isset( $product->gpf_data['brand'] ) ? $product->gpf_data['brand'] : '' ); $product->gpf_product_type = ( isset( $product->gpf_data['product_type'] ) ? $product->gpf_data['product_type'] : '' ); $product->gpf_google_product_category = ( isset( $product->gpf_data['google_product_category'] ) ? $product->gpf_data['google_product_category'] : '' ); $product->gpf_gtin = ( isset( $product->gpf_data['gtin'] ) ? $product->gpf_data['gtin'] : '' ); $product->gpf_mpn = ( isset( $product->gpf_data['mpn'] ) ? $product->gpf_data['mpn'] : '' ); $product->gpf_gender = ( isset( $product->gpf_data['gender'] ) ? $product->gpf_data['gender'] : '' ); $product->gpf_age_group = ( isset( $product->gpf_data['age_group'] ) ? $product->gpf_data['age_group'] : '' ); $product->gpf_color = ( isset( $product->gpf_data['color'] ) ? $product->gpf_data['color'] : '' ); $product->gpf_size = ( isset( $product->gpf_data['size'] ) ? $product->gpf_data['size'] : '' ); } // All in One SEO Pack - http://wordpress.org/extend/plugins/all-in-one-seo-pack/ if( function_exists( 'aioseop_activate' ) ) { $product->aioseop_keywords = get_post_meta( $product_id, '_aioseop_keywords', true ); $product->aioseop_description = get_post_meta( $product_id, '_aioseop_description', true ); $product->aioseop_title = get_post_meta( $product_id, '_aioseop_title', true ); $product->aioseop_title_attributes = get_post_meta( $product_id, '_aioseop_titleatr', true ); $product->aioseop_menu_label = get_post_meta( $product_id, '_aioseop_menulabel', true ); } // WordPress SEO - http://wordpress.org/plugins/wordpress-seo/ if( function_exists( 'wpseo_admin_init' ) ) { $product->wpseo_focuskw = get_post_meta( $product_id, '_yoast_wpseo_focuskw', true ); $product->wpseo_metadesc = get_post_meta( $product_id, '_yoast_wpseo_metadesc', true ); $product->wpseo_title = get_post_meta( $product_id, '_yoast_wpseo_title', true ); $product->wpseo_googleplus_description = get_post_meta( $product_id, '_yoast_wpseo_google-plus-description', true ); $product->wpseo_opengraph_description = get_post_meta( $product_id, '_yoast_wpseo_opengraph-description', true ); } // Ultimate SEO - http://wordpress.org/plugins/seo-ultimate/ if( function_exists( 'su_wp_incompat_notice' ) ) { $product->useo_meta_title = get_post_meta( $product_id, '_su_title', true ); $product->useo_meta_description = get_post_meta( $product_id, '_su_description', true ); $product->useo_meta_keywords = get_post_meta( $product_id, '_su_keywords', true ); $product->useo_social_title = get_post_meta( $product_id, '_su_og_title', true ); $product->useo_social_description = get_post_meta( $product_id, '_su_og_description', true ); $product->useo_meta_noindex = get_post_meta( $product_id, '_su_meta_robots_noindex', true ); $product->useo_meta_noautolinks = get_post_meta( $product_id, '_su_disable_autolinks', true ); } // WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/ if( function_exists( 'woocommerce_msrp_activate' ) ) { $product->msrp = get_post_meta( $product_id, '_msrp_price', true ); if( $product->msrp == false && $product->post_type == 'product_variation' ) $product->msrp = get_post_meta( $product_id, '_msrp', true ); // Check that a valid price has been provided if( isset( $product->msrp ) && $product->msrp != '' ) $product->msrp = woo_ce_format_price( $product->msrp ); } // 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' ) ) ) $product->brands = woo_ce_get_product_assoc_brands( $product_id, $product->parent_id ); // Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/ if( class_exists( 'WC_COG' ) ) $product->cost_of_goods = get_post_meta( $product_id, '_wc_cog_cost', true ); // Per-Product Shipping - http://www.woothemes.com/products/per-product-shipping/ if( function_exists( 'woocommerce_per_product_shipping_init' ) ) $product->per_product_shipping = get_post_meta( $product_id, '_per_product_shipping', true ); // Product Vendors - http://www.woothemes.com/products/product-vendors/ if( class_exists( 'WooCommerce_Product_Vendors' ) ) { $product->vendors = woo_ce_get_product_assoc_product_vendors( $product_id, $product->parent_id ); $product->vendor_ids = woo_ce_get_product_assoc_product_vendors( $product_id, $product->parent_id, 'term_id' ); $product->vendor_commission = woo_ce_get_product_assoc_product_vendor_commission( $product_id, $product->vendor_ids ); } // WooCommerce Wholesale Pricing - http://ignitewoo.com/woocommerce-extensions-plugins-themes/woocommerce-wholesale-pricing/ if( class_exists( 'woocommerce_wholesale_pricing' ) ) { $product->wholesale_price = woo_ce_format_price( get_post_meta( $product_id, 'wholesale_price', true ) ); $product->wholesale_price_text = get_post_meta( $product_id, 'wholesale_price_text', true ); } // WooCommerce Subscriptions - http://www.woothemes.com/products/woocommerce-subscriptions/ if( class_exists( 'WC_Subscriptions_Manager' ) ) { $product->subscription_price = get_post_meta( $product_id, '_subscription_price', true ); $product->subscription_period_interval = woo_ce_format_product_subscription_period_interval( get_post_meta( $product_id, '_subscription_period_interval', true ) ); $product->subscription_period = get_post_meta( $product_id, '_subscription_period', true ); $product->subscription_length = woo_ce_format_product_subscripion_length( get_post_meta( $product_id, '_subscription_length', true ), $product->subscription_period ); $product->subscription_sign_up_fee = get_post_meta( $product_id, '_subscription_sign_up_fee', true ); $product->subscription_trial_length = get_post_meta( $product_id, '_subscription_trial_length', true ); $product->subscription_trial_period = get_post_meta( $product_id, '_subscription_trial_period', true ); $product->subscription_limit = woo_ce_format_product_subscription_limit( get_post_meta( $product_id, '_subscription_limit', true ) ); } // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/ if( class_exists( 'WC_Bookings' ) ) { $product->booking_has_persons = get_post_meta( $product_id, '_wc_booking_has_persons', true ); $product->booking_has_resources = get_post_meta( $product_id, '_wc_booking_has_resources', true ); $product->booking_base_cost = get_post_meta( $product_id, '_wc_booking_cost', true ); $product->booking_block_cost = get_post_meta( $product_id, '_wc_booking_base_cost', true ); $product->booking_display_cost = get_post_meta( $product_id, '_wc_display_cost', true ); $product->booking_requires_confirmation = get_post_meta( $product_id, '_wc_booking_requires_confirmation', true ); $product->booking_user_can_cancel = get_post_meta( $product_id, '_wc_booking_user_can_cancel', true ); } // Barcodes for WooCommerce - http://www.wolkenkraft.com/produkte/barcodes-fuer-woocommerce/ if( function_exists( 'wpps_requirements_met' ) ) { // Cannot clean up the barcode type as the developer has not exposed any functions or methods $product->barcode_type = get_post_meta( $product_id, '_barcode_type', true ); $product->barcode = get_post_meta( $product_id, '_barcode', true ); } // 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 ) ) { $product->{$custom_product} = woo_ce_format_custom_meta( get_post_meta( $product_id, $custom_product, true ) ); } } } if( $export->gallery_unique ) { $max_size = woo_ce_get_option( 'max_product_gallery', 3 ); if( !empty( $product->product_gallery ) ) { // Tack on a extra digit to max_size so we get the correct number of columns $max_size++; $product_gallery = explode( $export->category_separator, $product->product_gallery ); $size = count( $product_gallery ); for( $i = 1; $i < $size; $i++ ) { if( $i == $max_size ) break; $product->{'product_gallery_' . $i} = $product_gallery[$i]; } $product->product_gallery = $product_gallery[0]; unset( $product_gallery ); } } return $product; }