public function displayEditPage() { // init model $profilesModel = new ProfilesModel(); // get item if ($this->requestAction() == 'add_new_profile') { $item = $profilesModel->newItem(); } else { $item = $profilesModel->getItem($_REQUEST['profile']); } // set account id $account_id = $item['account_id']; $site_id = isset($item['site_id']) ? $item['site_id'] : false; if (!$account_id) { $account_id = get_option('wplister_default_account_id'); } if (!$site_id) { $site_id = WPLE()->accounts[$account_id]->site_id; } // get ebay data $payment_options = EbayPaymentModel::getAll($site_id); $loc_flat_shipping_options = EbayShippingModel::getAllLocal($site_id, 'flat'); $int_flat_shipping_options = EbayShippingModel::getAllInternational($site_id, 'flat'); $shipping_locations = EbayShippingModel::getShippingLocations($site_id); $exclude_locations = EbayShippingModel::getExcludeShippingLocations($site_id); $countries = EbayShippingModel::getEbayCountries($site_id); $template_files = $this->getTemplatesList(); $store_categories = $this->getStoreCategories($account_id); $loc_calc_shipping_options = EbayShippingModel::getAllLocal($site_id, 'calculated'); $int_calc_shipping_options = EbayShippingModel::getAllInternational($site_id, 'calculated'); $available_attributes = ProductWrapper::getAttributeTaxonomies(); // add attribute for SKU // $attrib = new stdClass(); // $attrib->name = '_sku'; // $attrib->label = 'SKU'; // $available_attributes[] = $attrib; // process custom attributes $wpl_custom_attributes = array(); $custom_attributes = apply_filters('wplister_custom_attributes', array()); if (is_array($custom_attributes)) { foreach ($custom_attributes as $attrib) { $new_attribute = new stdClass(); $new_attribute->name = $attrib['id']; $new_attribute->label = $attrib['label']; $wpl_custom_attributes[] = $new_attribute; } } // $available_dispatch_times = self::getOption('DispatchTimeMaxDetails'); // $available_shipping_packages = self::getOption('ShippingPackageDetails'); // $ReturnsWithinOptions = get_option('wplister_ReturnsWithinOptions') $available_dispatch_times = WPLE_eBaySite::getSiteObj($site_id)->getDispatchTimeMaxDetails(); $available_shipping_packages = WPLE_eBaySite::getSiteObj($site_id)->getShippingPackageDetails(); $ReturnsWithinOptions = WPLE_eBaySite::getSiteObj($site_id)->getReturnsWithinOptions(); $ShippingCostPaidByOptions = WPLE_eBaySite::getSiteObj($site_id)->getShippingCostPaidByOptions(); $prepared_listings = WPLE_ListingQueryHelper::countItemsUsingProfile($item['profile_id'], 'prepared'); $verified_listings = WPLE_ListingQueryHelper::countItemsUsingProfile($item['profile_id'], 'verified'); $published_listings = WPLE_ListingQueryHelper::countItemsUsingProfile($item['profile_id'], 'published'); $ended_listings = WPLE_ListingQueryHelper::countItemsUsingProfile($item['profile_id'], 'ended'); $locked_listings = WPLE_ListingQueryHelper::countItemsUsingProfile($item['profile_id'], 'locked'); // this turned out to be to ressource intensive with 10k listings: // $prepared_listings = WPLE_ListingQueryHelper::getAllPreparedWithProfile( $item['profile_id'] ); // $verified_listings = WPLE_ListingQueryHelper::getAllVerifiedWithProfile( $item['profile_id'] ); // $published_listings = WPLE_ListingQueryHelper::getAllPublishedWithProfile( $item['profile_id'] ); // $ended_listings = WPLE_ListingQueryHelper::getAllEndedWithProfile( $item['profile_id'] ); // $locked_listings = WPLE_ListingQueryHelper::getAllLockedWithProfile( $item['profile_id'] ); // do we have a primary category? $details = $item['details']; if (intval($details['ebay_category_1_id']) != 0) { $primary_category_id = $details['ebay_category_1_id']; } else { // if not use default category $primary_category_id = self::getOption('default_ebay_category_id'); } // fetch updated item specifics for category $specifics = EbayCategoriesModel::getItemSpecificsForCategory($primary_category_id, $site_id, $account_id); // fetch updated available conditions array // $item['conditions'] = $this->fetchItemConditions( $primary_category_id, $item['profile_id'], $item['account_id'] ); $available_conditions = EbayCategoriesModel::getConditionsForCategory($primary_category_id, false, $account_id); // // build available conditions array // $available_conditions = false; // if ( isset( $item['conditions'][ $primary_category_id ] ) ) { // $available_conditions = $item['conditions'][ $primary_category_id ]; // } // // echo "<pre>";print_r($available_conditions);echo"</pre>"; // check if COD is available on the selected site $cod_available = false; foreach ($payment_options as $po) { if ('COD' == $po['payment_name']) { $cod_available = true; } } // fetch available shipping discount profiles $shipping_flat_profiles = array(); $shipping_calc_profiles = array(); $ShippingDiscountProfiles = self::getOption('ShippingDiscountProfiles', array()); if (isset($ShippingDiscountProfiles['FlatShippingDiscount'])) { $shipping_flat_profiles = $ShippingDiscountProfiles['FlatShippingDiscount']; } if (isset($ShippingDiscountProfiles['CalculatedShippingDiscount'])) { $shipping_calc_profiles = $ShippingDiscountProfiles['CalculatedShippingDiscount']; } // echo "<pre>";print_r($shipping_flat_profiles);echo"</pre>"; // get available seller profiles $seller_profiles_enabled = get_option('wplister_ebay_seller_profiles_enabled'); $seller_shipping_profiles = get_option('wplister_ebay_seller_shipping_profiles'); $seller_payment_profiles = get_option('wplister_ebay_seller_payment_profiles'); $seller_return_profiles = get_option('wplister_ebay_seller_return_profiles'); if (isset(WPLE()->accounts[$account_id])) { $account = WPLE()->accounts[$account_id]; $seller_profiles_enabled = $account->seller_profiles; $seller_shipping_profiles = maybe_unserialize($account->shipping_profiles); $seller_payment_profiles = maybe_unserialize($account->payment_profiles); $seller_return_profiles = maybe_unserialize($account->return_profiles); } $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'item' => $item, 'site_id' => $site_id, 'account_id' => $account_id, 'payment_options' => $payment_options, 'loc_flat_shipping_options' => $loc_flat_shipping_options, 'int_flat_shipping_options' => $int_flat_shipping_options, 'loc_calc_shipping_options' => $loc_calc_shipping_options, 'int_calc_shipping_options' => $int_calc_shipping_options, 'available_attributes' => $available_attributes, 'custom_attributes' => $wpl_custom_attributes, 'calc_shipping_enabled' => in_array(self::getOption('ebay_site_id'), array(0, 2, 15, 100)), 'default_ebay_category_id' => self::getOption('default_ebay_category_id'), 'shipping_locations' => $shipping_locations, 'exclude_locations' => $exclude_locations, 'countries' => $countries, 'template_files' => $template_files, 'store_categories' => $store_categories, 'prepared_listings_count' => $prepared_listings, 'verified_listings_count' => $verified_listings, 'published_listings_count' => $published_listings, 'ended_listings_count' => $ended_listings, 'locked_listings_count' => $locked_listings, 'total_listings_count' => $prepared_listings + $verified_listings + $published_listings, 'available_dispatch_times' => $available_dispatch_times, 'specifics' => $specifics, 'available_conditions' => $available_conditions, 'available_shipping_packages' => $available_shipping_packages, 'shipping_flat_profiles' => $shipping_flat_profiles, 'shipping_calc_profiles' => $shipping_calc_profiles, 'cod_available' => $cod_available, 'ReturnsWithinOptions' => $ReturnsWithinOptions, 'ShippingCostPaidByOptions' => $ShippingCostPaidByOptions, 'seller_profiles_enabled' => $seller_profiles_enabled, 'seller_shipping_profiles' => $seller_shipping_profiles, 'seller_payment_profiles' => $seller_payment_profiles, 'seller_return_profiles' => $seller_return_profiles, 'form_action' => 'admin.php?page=' . self::ParentMenuId . '-profiles'); $this->display('profiles_edit_page', array_merge($aData, $item)); }
public function displayEditPage() { // get item $item = ListingsModel::getItem($_REQUEST['auction']); // unserialize details $this->initEC($item['account_id']); // $item['details'] = maybe_unserialize( $item['details'] ); // echo "<pre>";print_r($item);echo"</pre>";die(); // get ebay data $countries = EbayShippingModel::getEbayCountries(); // $template_files = $this->getTemplatesList(); $templatesModel = new TemplatesModel(); $templates = $templatesModel->getAll(); $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'item' => $item, 'countries' => $countries, 'template_files' => $templates, 'form_action' => 'admin.php?page=' . self::ParentMenuId . (isset($_REQUEST['paged']) ? '&paged=' . $_REQUEST['paged'] : '')); $this->display('listings_edit_page', array_merge($aData, $item)); }
?> ><?php echo __('Yes', 'wplister'); ?> </option> </select> </div> <?php if (isset($wpl_seller_shipping_profiles) && is_array($wpl_seller_shipping_profiles)) { ?> <?php $wpl_seller_shipping_profiles = EbayShippingModel::sortSellerProfiles($wpl_seller_shipping_profiles); ?> <label for="wpl-text-seller_shipping_profile_id" class="text_label"> <?php echo __('Shipping policy', 'wplister'); ?> <?php wplister_tooltip('Instead of setting your shipping details in WP-Lister you can select a predefined shipping policy from your eBay account.<br><br>Note: Due to limitations in the eBay API you need to select at least one shipping service above, even though it will be overwritten by your shipping policy.<br><br>Please note that if you use a predefined shipping policy, you might have to use payment and return policies as well.'); ?> </label> <select id="wpl-text-seller_shipping_profile_id" name="wpl_e2e_seller_shipping_profile_id" class=" required-entry select" style="width:65%;">> <option value="">-- <?php echo __('no policy', 'wplister'); ?> --</option> <?php
public function buildShipping($id, $item, $post_id, $profile_details, $listing, $isVariation) { // no shipping options for classified ads if ($item->ListingType == 'LeadGeneration') { return $item; } // handle flat and calc shipping WPLE()->logger->info('shipping_service_type: ' . $profile_details['shipping_service_type']); // $isFlat = $profile_details['shipping_service_type'] != 'calc' ? true : false; // $isCalc = $profile_details['shipping_service_type'] == 'calc' ? true : false; // if this is a single split variation, use variation post_id instead of parent post_id for weight and dimensions $actual_post_id = $isVariation ? $listing['post_id'] : $post_id; // handle flat and calc shipping (new version) $service_type = $profile_details['shipping_service_type']; if ($service_type == '') { $service_type = 'Flat'; } if ($service_type == 'flat') { $service_type = 'Flat'; } if ($service_type == 'calc') { $service_type = 'Calculated'; } $isFlatLoc = in_array($service_type, array('Flat', 'FreightFlat', 'FlatDomesticCalculatedInternational')) ? true : false; $isFlatInt = in_array($service_type, array('Flat', 'FreightFlat', 'CalculatedDomesticFlatInternational')) ? true : false; $hasWeight = in_array($service_type, array('Calculated', 'FreightFlat', 'FlatDomesticCalculatedInternational', 'CalculatedDomesticFlatInternational')) ? true : false; $isCalcLoc = !$isFlatLoc; $isCalcInt = !$isFlatInt; $shippingDetails = new ShippingDetailsType(); $shippingDetails->ShippingType = $service_type; WPLE()->logger->info('shippingDetails->ShippingType: ' . $shippingDetails->ShippingType); // local shipping options $localShippingOptions = $profile_details['loc_shipping_options']; WPLE()->logger->debug('localShippingOptions: ' . print_r($localShippingOptions, 1)); $pr = 1; $localShippingServices = array(); foreach ($localShippingOptions as $opt) { $price = $this->getDynamicShipping($opt['price'], $post_id); $add_price = $this->getDynamicShipping($opt['add_price'], $post_id); if ($price == '') { $price = 0; } if ($opt['service_name'] == '') { continue; } $ShippingServiceOptions = new ShippingServiceOptionsType(); $ShippingServiceOptions->setShippingService($opt['service_name']); $ShippingServiceOptions->setShippingServicePriority($pr); // set shipping costs for flat services if ($isFlatLoc) { $ShippingServiceOptions->setShippingServiceCost($price); // FreeShipping is only allowed for the first shipping service if ($price == 0 && $pr == 1) { $ShippingServiceOptions->setFreeShipping(true); } // price for additonal items if (trim($add_price) == '') { $ShippingServiceOptions->setShippingServiceAdditionalCost($price); } else { $ShippingServiceOptions->setShippingServiceAdditionalCost($add_price); } } else { // enable FreeShipping option for calculated shipping services if specified in profile (or product meta) $free_shipping_enabled = isset($profile_details['shipping_loc_enable_free_shipping']) ? $profile_details['shipping_loc_enable_free_shipping'] : false; // $free_shipping_enabled = $free_shipping_enabled || get_post_meta( $post_id, '_ebay_shipping_loc_enable_free_shipping', true ); if ($free_shipping_enabled && $pr == 1) { $ShippingServiceOptions->setFreeShipping(true); } } $localShippingServices[] = $ShippingServiceOptions; $pr++; $EbayShippingModel = new EbayShippingModel(); $lastShippingCategory = $EbayShippingModel->getShippingCategoryByServiceName($opt['service_name']); WPLE()->logger->debug('ShippingCategory: ' . print_r($lastShippingCategory, 1)); } // apply filter and set shipping services $localShippingServices = apply_filters('wple_local_shipping_services', $localShippingServices, $post_id, $actual_post_id, $listing); $shippingDetails->setShippingServiceOptions($localShippingServices, null); // $intlShipping = array( // 'UK_RoyalMailAirmailInternational' => array ( // 'Europe' => 1, // 'Worldwide' => 1.50 // ), // 'UK_RoyalMailInternationalSignedFor' => array ( // 'Europe' => 5, // ) // ); $intlShipping = $profile_details['int_shipping_options']; WPLE()->logger->debug('intlShipping: ' . print_r($intlShipping, 1)); $pr = 1; $shippingInternational = array(); foreach ($intlShipping as $opt) { // foreach ($opt as $loc=>$price) { $price = $this->getDynamicShipping($opt['price'], $post_id); $add_price = $this->getDynamicShipping($opt['add_price'], $post_id); // if ( ( $price == '' ) || ( $opt['service_name'] == '' ) ) continue; if ($price == '') { $price = 0; } if ($opt['location'] == '') { continue; } if ($opt['service_name'] == '') { continue; } $InternationalShippingServiceOptions = new InternationalShippingServiceOptionsType(); $InternationalShippingServiceOptions->setShippingService($opt['service_name']); $InternationalShippingServiceOptions->setShippingServicePriority($pr); // $InternationalShippingServiceOptions->setShipToLocation( $opt['location'] ); if (is_array($opt['location'])) { foreach ($opt['location'] as $location) { $InternationalShippingServiceOptions->addShipToLocation($location); } } else { $InternationalShippingServiceOptions->setShipToLocation($opt['location']); } $InternationalShippingServiceOptions->setShipToLocation($opt['location']); // set shipping costs for flat services if ($isFlatInt) { $InternationalShippingServiceOptions->setShippingServiceCost($price); if (trim($add_price) == '') { $InternationalShippingServiceOptions->setShippingServiceAdditionalCost($price); } else { $InternationalShippingServiceOptions->setShippingServiceAdditionalCost($add_price); } } $shippingInternational[] = $InternationalShippingServiceOptions; $pr++; // } } // filter international shipping services $shippingInternational = apply_filters('wple_international_shipping_services', $shippingInternational, $post_id, $actual_post_id, $listing); // only set international shipping if $intlShipping array contains one or more valid items if (isset($intlShipping[0]['service_name']) && $intlShipping[0]['service_name'] != '') { $shippingDetails->setInternationalShippingServiceOption($shippingInternational, null); } // set CalculatedShippingRate if ($isCalcLoc || $isCalcInt) { $calculatedShippingRate = new CalculatedShippingRateType(); $calculatedShippingRate->setOriginatingPostalCode($profile_details['postcode']); // set ShippingPackage if calculated shipping is used if ($isCalcInt) { $calculatedShippingRate->setShippingPackage($profile_details['shipping_package']); } if ($isCalcLoc) { $calculatedShippingRate->setShippingPackage($profile_details['shipping_package']); } if ($isCalcLoc) { $calculatedShippingRate->setPackagingHandlingCosts(self::dbSafeFloatval(@$profile_details['PackagingHandlingCosts'])); } if ($isCalcInt) { // $calculatedShippingRate->setPackagingHandlingCosts( self::dbSafeFloatval( @$profile_details['PackagingHandlingCosts'] ) ); $calculatedShippingRate->setInternationalPackagingHandlingCosts(self::dbSafeFloatval(@$profile_details['InternationalPackagingHandlingCosts'])); } list($weight_major, $weight_minor) = ProductWrapper::getEbayWeight($actual_post_id); $calculatedShippingRate->setWeightMajor(self::dbSafeFloatval($weight_major)); $calculatedShippingRate->setWeightMinor(self::dbSafeFloatval($weight_minor)); $dimensions = ProductWrapper::getDimensions($actual_post_id); if (trim(@$dimensions['width']) != '') { $calculatedShippingRate->setPackageWidth($dimensions['width']); } if (trim(@$dimensions['length']) != '') { $calculatedShippingRate->setPackageLength($dimensions['length']); } if (trim(@$dimensions['height']) != '') { $calculatedShippingRate->setPackageDepth($dimensions['height']); } // debug // $weight = ProductWrapper::getWeight( $actual_post_id ) ; // WPLE()->logger->info('weight: '.print_r($weight,1)); // WPLE()->logger->info('dimensions: '.print_r($dimensions,1)); $shippingDetails->setCalculatedShippingRate($calculatedShippingRate); } // handle option to always send weight and dimensions if (get_option('wplister_send_weight_and_size', 'default') == 'always') { $hasWeight = ProductWrapper::getWeight($actual_post_id); } // set ShippingPackageDetails if ($hasWeight) { $shippingPackageDetails = new ShipPackageDetailsType(); // set ShippingPackage if calculated shipping is used if ($isCalcInt) { $shippingPackageDetails->setShippingPackage($profile_details['shipping_package']); } if ($isCalcLoc) { $shippingPackageDetails->setShippingPackage($profile_details['shipping_package']); } list($weight_major, $weight_minor) = ProductWrapper::getEbayWeight($actual_post_id); $shippingPackageDetails->setWeightMajor(self::dbSafeFloatval($weight_major)); $shippingPackageDetails->setWeightMinor(self::dbSafeFloatval($weight_minor)); $dimensions = ProductWrapper::getDimensions($actual_post_id); if (trim(@$dimensions['width']) != '') { $shippingPackageDetails->setPackageWidth($dimensions['width']); } if (trim(@$dimensions['length']) != '') { $shippingPackageDetails->setPackageLength($dimensions['length']); } if (trim(@$dimensions['height']) != '') { $shippingPackageDetails->setPackageDepth($dimensions['height']); } // debug // $weight = ProductWrapper::getWeight( $actual_post_id ) ; // WPLE()->logger->info('weight: '.print_r($weight,1)); // WPLE()->logger->info('dimensions: '.print_r($dimensions,1)); $item->setShippingPackageDetails($shippingPackageDetails); } // set local shipping discount profile if ($isFlatLoc) { $local_profile_id = isset($profile_details['shipping_loc_flat_profile']) ? $profile_details['shipping_loc_flat_profile'] : false; if ($custom_profile_id = get_post_meta($post_id, '_ebay_shipping_loc_flat_profile', true)) { $local_profile_id = $custom_profile_id; } } else { $local_profile_id = isset($profile_details['shipping_loc_calc_profile']) ? $profile_details['shipping_loc_calc_profile'] : false; if ($custom_profile_id = get_post_meta($post_id, '_ebay_shipping_loc_calc_profile', true)) { $local_profile_id = $custom_profile_id; } } if ($local_profile_id) { $shippingDetails->setShippingDiscountProfileID($local_profile_id); } // set international shipping discount profile if ($isFlatLoc) { $int_profile_id = isset($profile_details['shipping_int_flat_profile']) ? $profile_details['shipping_int_flat_profile'] : false; if ($custom_profile_id = get_post_meta($post_id, '_ebay_shipping_int_flat_profile', true)) { $int_profile_id = $custom_profile_id; } } else { $int_profile_id = isset($profile_details['shipping_int_calc_profile']) ? $profile_details['shipping_int_calc_profile'] : false; if ($custom_profile_id = get_post_meta($post_id, '_ebay_shipping_int_calc_profile', true)) { $int_profile_id = $custom_profile_id; } } if ($int_profile_id) { $shippingDetails->setInternationalShippingDiscountProfileID($int_profile_id); } // PromotionalShippingDiscount $PromotionalShippingDiscount = isset($profile_details['PromotionalShippingDiscount']) ? $profile_details['PromotionalShippingDiscount'] : false; if ($PromotionalShippingDiscount == '1') { $shippingDetails->setPromotionalShippingDiscount(true); } // InternationalPromotionalShippingDiscount $InternationalPromotionalShippingDiscount = isset($profile_details['InternationalPromotionalShippingDiscount']) ? $profile_details['InternationalPromotionalShippingDiscount'] : false; if ($InternationalPromotionalShippingDiscount == '1') { $shippingDetails->setInternationalPromotionalShippingDiscount(true); } // ShipToLocations if (is_array($ShipToLocations = maybe_unserialize($profile_details['ShipToLocations']))) { foreach ($ShipToLocations as $location) { $item->addShipToLocations($location); } } // ExcludeShipToLocations if (is_array($ExcludeShipToLocations = maybe_unserialize($profile_details['ExcludeShipToLocations']))) { foreach ($ExcludeShipToLocations as $location) { $shippingDetails->addExcludeShipToLocation($location); } } // global shipping if (@$profile_details['global_shipping'] == 1) { $shippingDetails->setGlobalShipping(true); // available since api version 781 } if (get_post_meta($post_id, '_ebay_global_shipping', true) == 'yes') { $shippingDetails->setGlobalShipping(true); } // store pickup if (@$profile_details['store_pickup'] == 1) { $item->PickupInStoreDetails = new PickupInStoreDetailsType(); $item->PickupInStoreDetails->setEligibleForPickupInStore(true); } // Payment Instructions if (trim(@$profile_details['payment_instructions']) != '') { $shippingDetails->setPaymentInstructions(nl2br($profile_details['payment_instructions'])); } if (trim(get_post_meta($post_id, '_ebay_payment_instructions', true)) != '') { $shippingDetails->setPaymentInstructions(nl2br(get_post_meta($post_id, '_ebay_payment_instructions', true))); } // COD cost if (isset($profile_details['cod_cost']) && trim($profile_details['cod_cost'])) { $shippingDetails->setCODCost(str_replace(',', '.', $profile_details['cod_cost'])); } // check if we have local pickup only if (count($localShippingOptions) == 1 && $lastShippingCategory == 'PICKUP') { $item->setShipToLocations('None'); $item->setDispatchTimeMax(null); WPLE()->logger->info('PICKUP ONLY mode'); // don't set ShippingDetails for pickup-only in UK! if ($item->Site != 'UK') { $item->setShippingDetails($shippingDetails); } } else { $item->setShippingDetails($shippingDetails); } // force AutoPay off for Freight shipping if ($service_type == 'FreightFlat') { $item->setAutoPay(0); } return $item; }
function showShippingOptions() { global $post; // 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'); $wpl_loc_flat_shipping_options = EbayShippingModel::getAllLocal($wpl_site_id, 'flat'); $wpl_int_flat_shipping_options = EbayShippingModel::getAllInternational($wpl_site_id, 'flat'); $wpl_shipping_locations = EbayShippingModel::getShippingLocations($wpl_site_id); $wpl_exclude_locations = EbayShippingModel::getExcludeShippingLocations($wpl_site_id); $wpl_countries = EbayShippingModel::getEbayCountries($wpl_site_id); $wpl_loc_calc_shipping_options = EbayShippingModel::getAllLocal($wpl_site_id, 'calculated'); $wpl_int_calc_shipping_options = EbayShippingModel::getAllInternational($wpl_site_id, 'calculated'); $wpl_calc_shipping_enabled = in_array(get_option('wplister_ebay_site_id'), array(0, 2, 15, 100)); // $wpl_available_shipping_packages = get_option('wplister_ShippingPackageDetails'); $wpl_available_shipping_packages = WPLE_eBaySite::getSiteObj($wpl_site_id)->getShippingPackageDetails(); // get available seller profiles $wpl_seller_profiles_enabled = get_option('wplister_ebay_seller_profiles_enabled'); $wpl_seller_shipping_profiles = get_option('wplister_ebay_seller_shipping_profiles'); $wpl_seller_payment_profiles = get_option('wplister_ebay_seller_payment_profiles'); $wpl_seller_return_profiles = get_option('wplister_ebay_seller_return_profiles'); $ShippingDiscountProfiles = get_option('wplister_ShippingDiscountProfiles', array()); if (isset(WPLE()->accounts[$wpl_account_id])) { $account = WPLE()->accounts[$wpl_account_id]; $wpl_seller_profiles_enabled = $account->seller_profiles; $wpl_seller_shipping_profiles = maybe_unserialize($account->shipping_profiles); $wpl_seller_payment_profiles = maybe_unserialize($account->payment_profiles); $wpl_seller_return_profiles = maybe_unserialize($account->return_profiles); $ShippingDiscountProfiles = maybe_unserialize($account->shipping_discount_profiles); } // fetch available shipping discount profiles $wpl_shipping_flat_profiles = array(); $wpl_shipping_calc_profiles = array(); // $ShippingDiscountProfiles = get_option('wplister_ShippingDiscountProfiles', array() ); if (isset($ShippingDiscountProfiles['FlatShippingDiscount'])) { $wpl_shipping_flat_profiles = $ShippingDiscountProfiles['FlatShippingDiscount']; } if (isset($ShippingDiscountProfiles['CalculatedShippingDiscount'])) { $wpl_shipping_calc_profiles = $ShippingDiscountProfiles['CalculatedShippingDiscount']; } // make sure that at least one payment and shipping option exist $item_details['loc_shipping_options'] = ProfilesModel::fixShippingArray(get_post_meta($post->ID, '_ebay_loc_shipping_options', true)); $item_details['int_shipping_options'] = ProfilesModel::fixShippingArray(get_post_meta($post->ID, '_ebay_int_shipping_options', true)); $item_details['shipping_loc_calc_profile'] = get_post_meta($post->ID, '_ebay_shipping_loc_calc_profile', true); $item_details['shipping_loc_flat_profile'] = get_post_meta($post->ID, '_ebay_shipping_loc_flat_profile', true); $item_details['shipping_int_calc_profile'] = get_post_meta($post->ID, '_ebay_shipping_int_calc_profile', true); $item_details['shipping_int_flat_profile'] = get_post_meta($post->ID, '_ebay_shipping_int_flat_profile', true); $item_details['seller_shipping_profile_id'] = get_post_meta($post->ID, '_ebay_seller_shipping_profile_id', true); $item_details['PackagingHandlingCosts'] = get_post_meta($post->ID, '_ebay_PackagingHandlingCosts', true); $item_details['InternationalPackagingHandlingCosts'] = get_post_meta($post->ID, '_ebay_InternationalPackagingHandlingCosts', true); $item_details['shipping_service_type'] = get_post_meta($post->ID, '_ebay_shipping_service_type', true); $item_details['shipping_package'] = get_post_meta($post->ID, '_ebay_shipping_package', true); $item_details['shipping_loc_enable_free_shipping'] = get_post_meta($post->ID, '_ebay_shipping_loc_enable_free_shipping', true); $item_details['ShipToLocations'] = get_post_meta($post->ID, '_ebay_shipping_ShipToLocations', true); $item_details['ExcludeShipToLocations'] = get_post_meta($post->ID, '_ebay_shipping_ExcludeShipToLocations', true); if (!$item_details['shipping_service_type']) { $item_details['shipping_service_type'] = 'disabled'; } // echo '<h2>'. __('Shipping Options','wplister') . '</h2>'; ?> <!-- service type selector --> <label for="wpl-text-loc_shipping_service_type" class="text_label"><?php echo __('Custom shipping options', 'wplister'); ?> </label> <select name="wpl_e2e_shipping_service_type" id="wpl-text-loc_shipping_service_type" class="required-entry select select_shipping_type" style="width:auto;" onchange="handleShippingTypeSelectionChange(this)"> <option value="disabled" <?php if (@$item_details['shipping_service_type'] == 'disabled') { ?> selected="selected"<?php } ?> ><?php echo __('-- use profile setting --', 'wplister'); ?> </option> <option value="flat" <?php if (@$item_details['shipping_service_type'] == 'flat') { ?> selected="selected"<?php } ?> ><?php echo __('Use Flat Shipping', 'wplister'); ?> </option> <option value="calc" <?php if (@$item_details['shipping_service_type'] == 'calc') { ?> selected="selected"<?php } ?> ><?php echo __('Use Calculated Shipping', 'wplister'); ?> </option> <option value="FlatDomesticCalculatedInternational" <?php if (@$item_details['shipping_service_type'] == 'FlatDomesticCalculatedInternational') { ?> selected="selected"<?php } ?> ><?php echo __('Use Flat Domestic and Calculated International Shipping', 'wplister'); ?> </option> <option value="CalculatedDomesticFlatInternational" <?php if (@$item_details['shipping_service_type'] == 'CalculatedDomesticFlatInternational') { ?> selected="selected"<?php } ?> ><?php echo __('Use Calculated Domestic and Flat International Shipping', 'wplister'); ?> </option> <option value="FreightFlat" <?php if (@$item_details['shipping_service_type'] == 'FreightFlat') { ?> selected="selected"<?php } ?> ><?php echo __('Use Freight Shipping', 'wplister'); ?> </option> </select> <?php echo '<div class="ebay_shipping_options_wrapper">'; if (isset($account)) { echo '<small>The options below are based on the selected account <b>' . $account->title . '</b> (' . $account->site_code . ').</small>'; } echo '<h2>' . __('Domestic shipping', 'wplister') . '</h2>'; include WPLISTER_PATH . '/views/profile/edit_shipping_loc.php'; echo '<h2>' . __('International shipping', 'wplister') . '</h2>'; include WPLISTER_PATH . '/views/profile/edit_shipping_int.php'; echo '</div>'; echo '<script>'; include WPLISTER_PATH . '/views/profile/edit_shipping.js'; echo '</script>'; }
public function loadShippingDiscountProfiles() { $sm = new EbayShippingModel(); return $sm->downloadShippingDiscountProfiles($this->session); }