function save_meta_box($post_id, $post) { // check if current user can manage listings if (!current_user_can('manage_ebay_listings')) { return; } if (!isset($_POST['wpl_ebay_title'])) { return; } self::check_max_post_vars(); // get field values $wpl_ebay_title = esc_attr(@$_POST['wpl_ebay_title']); $wpl_ebay_subtitle = esc_attr(@$_POST['wpl_ebay_subtitle']); $wpl_ebay_global_shipping = esc_attr(@$_POST['wpl_ebay_global_shipping']); $wpl_ebay_payment_instructions = esc_attr(@$_POST['wpl_ebay_payment_instructions']); $wpl_ebay_condition_description = esc_attr(@$_POST['wpl_ebay_condition_description']); $wpl_ebay_condition_id = esc_attr(@$_POST['wpl_ebay_condition_id']); $wpl_ebay_auction_type = esc_attr(@$_POST['wpl_ebay_auction_type']); $wpl_ebay_listing_duration = esc_attr(@$_POST['wpl_ebay_listing_duration']); $wpl_ebay_start_price = esc_attr(@$_POST['wpl_ebay_start_price']); $wpl_ebay_reserve_price = esc_attr(@$_POST['wpl_ebay_reserve_price']); $wpl_ebay_buynow_price = esc_attr(@$_POST['wpl_ebay_buynow_price']); $wpl_ebay_upc = esc_attr(@$_POST['wpl_ebay_upc']); $wpl_ebay_ean = esc_attr(@$_POST['wpl_ebay_ean']); $wpl_ebay_isbn = esc_attr(@$_POST['wpl_ebay_isbn']); $wpl_ebay_mpn = esc_attr(@$_POST['wpl_ebay_mpn']); $wpl_ebay_brand = esc_attr(@$_POST['wpl_ebay_brand']); $wpl_ebay_epid = esc_attr(@$_POST['wpl_ebay_epid']); $wpl_ebay_hide_from_unlisted = esc_attr(@$_POST['wpl_ebay_hide_from_unlisted']); $wpl_ebay_category_1_id = esc_attr(@$_POST['wpl_ebay_category_1_id']); $wpl_ebay_category_2_id = esc_attr(@$_POST['wpl_ebay_category_2_id']); $wpl_store_category_1_id = esc_attr(@$_POST['wpl_ebay_store_category_1_id']); $wpl_store_category_2_id = esc_attr(@$_POST['wpl_ebay_store_category_2_id']); $wpl_ebay_gallery_image_url = esc_attr(@$_POST['wpl_ebay_gallery_image_url']); $wpl_amazon_id_type = esc_attr(@$_POST['wpl_amazon_id_type']); $wpl_amazon_product_id = esc_attr(@$_POST['wpl_amazon_product_id']); // sanitize prices - convert decimal comma to decimal point $wpl_ebay_start_price = str_replace(',', '.', $wpl_ebay_start_price); $wpl_ebay_reserve_price = str_replace(',', '.', $wpl_ebay_reserve_price); $wpl_ebay_buynow_price = str_replace(',', '.', $wpl_ebay_buynow_price); // use UPC from WPLA, if currently empty if (empty($wpl_ebay_upc) && 'UPC' == $wpl_amazon_id_type) { $wpl_ebay_upc = $wpl_amazon_product_id; } // use EAN from WPLA, if currently empty if (empty($wpl_ebay_ean) && 'EAN' == $wpl_amazon_id_type) { $wpl_ebay_ean = $wpl_amazon_product_id; } // Update product data update_post_meta($post_id, '_ebay_title', $wpl_ebay_title); update_post_meta($post_id, '_ebay_subtitle', $wpl_ebay_subtitle); update_post_meta($post_id, '_ebay_global_shipping', $wpl_ebay_global_shipping); update_post_meta($post_id, '_ebay_payment_instructions', $wpl_ebay_payment_instructions); update_post_meta($post_id, '_ebay_condition_id', $wpl_ebay_condition_id); update_post_meta($post_id, '_ebay_condition_description', $wpl_ebay_condition_description); update_post_meta($post_id, '_ebay_listing_duration', $wpl_ebay_listing_duration); update_post_meta($post_id, '_ebay_auction_type', $wpl_ebay_auction_type); update_post_meta($post_id, '_ebay_start_price', $wpl_ebay_start_price); update_post_meta($post_id, '_ebay_reserve_price', $wpl_ebay_reserve_price); update_post_meta($post_id, '_ebay_buynow_price', $wpl_ebay_buynow_price); update_post_meta($post_id, '_ebay_upc', $wpl_ebay_upc); update_post_meta($post_id, '_ebay_ean', $wpl_ebay_ean); update_post_meta($post_id, '_ebay_isbn', $wpl_ebay_isbn); update_post_meta($post_id, '_ebay_mpn', $wpl_ebay_mpn); update_post_meta($post_id, '_ebay_brand', $wpl_ebay_brand); update_post_meta($post_id, '_ebay_epid', $wpl_ebay_epid); update_post_meta($post_id, '_ebay_hide_from_unlisted', $wpl_ebay_hide_from_unlisted); update_post_meta($post_id, '_ebay_category_1_id', $wpl_ebay_category_1_id); update_post_meta($post_id, '_ebay_category_2_id', $wpl_ebay_category_2_id); update_post_meta($post_id, '_ebay_store_category_1_id', $wpl_store_category_1_id); update_post_meta($post_id, '_ebay_store_category_2_id', $wpl_store_category_2_id); update_post_meta($post_id, '_ebay_gallery_image_url', $wpl_ebay_gallery_image_url); update_post_meta($post_id, '_ebay_seller_payment_profile_id', esc_attr(@$_POST['wpl_ebay_seller_payment_profile_id'])); update_post_meta($post_id, '_ebay_seller_return_profile_id', esc_attr(@$_POST['wpl_ebay_seller_return_profile_id'])); update_post_meta($post_id, '_ebay_bestoffer_enabled', esc_attr(@$_POST['wpl_ebay_bestoffer_enabled'])); update_post_meta($post_id, '_ebay_bo_autoaccept_price', esc_attr(@$_POST['wpl_ebay_bo_autoaccept_price'])); update_post_meta($post_id, '_ebay_bo_minimum_price', esc_attr(@$_POST['wpl_ebay_bo_minimum_price'])); // shipping options $ebay_shipping_service_type = esc_attr(@$_POST['wpl_e2e_shipping_service_type']); if ($ebay_shipping_service_type && $ebay_shipping_service_type != 'disabled') { update_post_meta($post_id, '_ebay_shipping_service_type', $ebay_shipping_service_type); $details = ProfilesPage::getPreprocessedPostDetails(); update_post_meta($post_id, '_ebay_loc_shipping_options', $details['loc_shipping_options']); update_post_meta($post_id, '_ebay_int_shipping_options', $details['int_shipping_options']); update_post_meta($post_id, '_ebay_shipping_package', esc_attr(@$_POST['wpl_e2e_shipping_package'])); update_post_meta($post_id, '_ebay_PackagingHandlingCosts', esc_attr(@$_POST['wpl_e2e_PackagingHandlingCosts'])); update_post_meta($post_id, '_ebay_InternationalPackagingHandlingCosts', esc_attr(@$_POST['wpl_e2e_InternationalPackagingHandlingCosts'])); update_post_meta($post_id, '_ebay_shipping_loc_flat_profile', esc_attr(@$_POST['wpl_e2e_shipping_loc_flat_profile'])); update_post_meta($post_id, '_ebay_shipping_int_flat_profile', esc_attr(@$_POST['wpl_e2e_shipping_int_flat_profile'])); update_post_meta($post_id, '_ebay_shipping_loc_calc_profile', esc_attr(@$_POST['wpl_e2e_shipping_loc_calc_profile'])); update_post_meta($post_id, '_ebay_shipping_int_calc_profile', esc_attr(@$_POST['wpl_e2e_shipping_int_calc_profile'])); update_post_meta($post_id, '_ebay_seller_shipping_profile_id', esc_attr(@$_POST['wpl_e2e_seller_shipping_profile_id'])); $loc_free_shipping = strstr('calc', strtolower($ebay_shipping_service_type)) ? @$_POST['wpl_e2e_shipping_loc_calc_free_shipping'] : @$_POST['wpl_e2e_shipping_loc_flat_free_shipping']; update_post_meta($post_id, '_ebay_shipping_loc_enable_free_shipping', $loc_free_shipping); update_post_meta($post_id, '_ebay_shipping_ShipToLocations', @$_POST['wpl_e2e_ShipToLocations']); update_post_meta($post_id, '_ebay_shipping_ExcludeShipToLocations', @$_POST['wpl_e2e_ExcludeShipToLocations']); } else { delete_post_meta($post_id, '_ebay_shipping_service_type'); delete_post_meta($post_id, '_ebay_loc_shipping_options'); delete_post_meta($post_id, '_ebay_int_shipping_options'); delete_post_meta($post_id, '_ebay_shipping_package'); delete_post_meta($post_id, '_ebay_PackagingHandlingCosts'); delete_post_meta($post_id, '_ebay_InternationalPackagingHandlingCosts'); delete_post_meta($post_id, '_ebay_shipping_loc_flat_profile'); delete_post_meta($post_id, '_ebay_shipping_int_flat_profile'); delete_post_meta($post_id, '_ebay_shipping_loc_calc_profile'); delete_post_meta($post_id, '_ebay_shipping_int_calc_profile'); delete_post_meta($post_id, '_ebay_seller_shipping_profile_id'); delete_post_meta($post_id, '_ebay_shipping_loc_enable_free_shipping'); delete_post_meta($post_id, '_ebay_shipping_ShipToLocations'); delete_post_meta($post_id, '_ebay_shipping_ExcludeShipToLocations'); } // get listing object $listing = $this->get_current_ebay_item(); $wpl_account_id = $listing && $listing->account_id ? $listing->account_id : get_option('wplister_default_account_id'); $wpl_site_id = $listing ? $listing->site_id : get_option('wplister_ebay_site_id'); // process item specifics $item_specifics = array(); $itmSpecs_name = @$_POST['itmSpecs_name']; $itmSpecs_value = @$_POST['itmSpecs_value']; $itmSpecs_attrib = @$_POST['itmSpecs_attrib']; if (is_array($itmSpecs_name)) { foreach ($itmSpecs_name as $key => $name) { #$name = str_replace('\\\\', '', $name ); $name = stripslashes($name); $value = trim($itmSpecs_value[$key]); $attribute = trim($itmSpecs_attrib[$key]); if ($value != '' || $attribute != '') { // $spec = new stdClass(); // $spec->name = $name; // $spec->value = $value; // $spec->attribute = $attribute; $spec = array(); $spec['name'] = $name; $spec['value'] = $value; $spec['attribute'] = $attribute; $item_specifics[] = $spec; } } } update_post_meta($post_id, '_ebay_item_specifics', $item_specifics); }