Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 protected function newAccount()
 {
     // call FetchToken
     $this->initEC();
     $ebay_token = $this->EC->doFetchToken(false);
     $this->EC->closeEbay();
     // check if we have a token
     if ($ebay_token) {
         // create new account
         $account = new WPLE_eBayAccount();
         // $account->title     = stripslashes( $_POST['wplister_account_title'] );
         $account->title = 'My Account';
         $account->site_id = $_REQUEST['site_id'];
         $account->site_code = EbayController::getEbaySiteCode($_REQUEST['site_id']);
         $account->sandbox_mode = $_REQUEST['sandbox'];
         $account->token = $ebay_token;
         $account->active = 1;
         $account->add();
         // set enabled flag for site
         $site = WPLE_eBaySite::getSiteObj($account->site_id);
         $site->enabled = 1;
         $site->update();
         // update user details
         $account->updateUserDetails();
         // set default account automatically
         if (!get_option('wplister_default_account_id')) {
             update_option('wplister_default_account_id', $account->id);
             $this->makeDefaultAccount($account->id);
         }
         $this->check_wplister_setup('settings');
         $this->showMessage(__('New account was added.', 'wplister') . ' ' . __('Please refresh account and site specific details now.', 'wplister'));
     } else {
         $this->showMessage("There was a problem fetching your token. Make sure you follow the instructions.", 1);
     }
 }
Exemplo n.º 3
0
 static function getEbayCountries($site_id)
 {
     // $countries = maybe_unserialize( get_option( 'wplister_CountryDetails' ) );
     // WPLE()->logger->info('wplister_CountryDetails'.print_r($countries,1));
     $countries = maybe_unserialize(WPLE_eBaySite::getSiteObj($site_id)->CountryDetails);
     if (!is_array($countries)) {
         return array();
     }
     asort($countries);
     return $countries;
 }
Exemplo n.º 4
0
 function downloadReturnPolicyDetails($session, $site_id)
 {
     WPLE()->logger->info("downloadReturnPolicyDetails()");
     $this->initServiceProxy($session);
     // download ebay details
     $req = new GeteBayDetailsRequestType();
     $req->setDetailName('ReturnPolicyDetails');
     $res = $this->_cs->GeteBayDetails($req);
     // handle response and check if successful
     if ($this->handleResponse($res)) {
         // save array of ReturnsWithin options
         $ReturnsWithinOptions = array();
         foreach ($res->ReturnPolicyDetails->ReturnsWithin as $Detail) {
             $ReturnsWithinOptions[$Detail->ReturnsWithinOption] = $Detail->Description;
         }
         // update legacy option
         update_option('wplister_ReturnsWithinOptions', $ReturnsWithinOptions);
         // save array of ShippingCostPaidBy options
         $ShippingCostPaidByOptions = array();
         foreach ($res->ReturnPolicyDetails->ShippingCostPaidBy as $Detail) {
             $ShippingCostPaidByOptions[$Detail->ShippingCostPaidByOption] = $Detail->Description;
         }
         // update legacy option
         update_option('wplister_ShippingCostPaidByOptions', $ShippingCostPaidByOptions);
         // update site properties
         $Site = new WPLE_eBaySite($site_id);
         $Site->ReturnsWithinOptions = serialize($ReturnsWithinOptions);
         $Site->ShippingCostPaidByOptions = serialize($ShippingCostPaidByOptions);
         $Site->update();
     }
     // call successful
 }
Exemplo n.º 5
0
 public function checkItem($item, $reviseItem = false)
 {
     $success = true;
     $this->VariationsHaveStock = false;
     // check StartPrice, Quantity and SKU
     if (is_object($item->Variations)) {
         // item has variations
         $VariationsHaveStock = false;
         $VariationsSkuArray = array();
         $VariationsSkuAreUnique = true;
         $VariationsSkuMissing = false;
         // check each variation
         foreach ($item->Variations->Variation as $var) {
             // StartPrice must be greater than 0
             if (self::dbSafeFloatval($var->StartPrice) == 0) {
                 $longMessage = __('Some variations seem to have no price.', 'wplister');
                 $success = false;
             }
             // Quantity must be greater than 0 - at least for one variation
             if (intval($var->Quantity) > 0) {
                 $VariationsHaveStock = true;
             }
             // SKUs must be unique - if present
             if ($var->SKU != '') {
                 if (in_array($var->SKU, $VariationsSkuArray)) {
                     $VariationsSkuAreUnique = false;
                 } else {
                     $VariationsSkuArray[] = $var->SKU;
                 }
             } else {
                 $VariationsSkuMissing = true;
             }
             // VariationSpecifics values can't be longer than 50 characters
             foreach ($var->VariationSpecifics->NameValueList as $spec) {
                 if (strlen($spec->Value) > 50) {
                     $longMessage = __('eBay does not allow attribute values longer than 50 characters.', 'wplister');
                     $longMessage .= '<br>';
                     $longMessage .= __('You need to shorten this value:', 'wplister') . ' <code>' . $spec->Value . '</code>';
                     $success = false;
                 }
             }
         }
         if (!$VariationsSkuAreUnique) {
             foreach ($item->Variations->Variation as &$var) {
                 $var->SKU = '';
             }
             $longMessage = __('You are using the same SKU for more than one variations which is not allowed by eBay.', 'wplister');
             $longMessage .= '<br>';
             $longMessage .= __('To circumvent this issue, your item will be listed without SKU.', 'wplister');
             // $success = false;
         }
         if ($VariationsSkuMissing) {
             $longMessage = __('Some variations are missing a SKU.', 'wplister');
             $longMessage .= '<br>';
             $longMessage .= __('It is required to assign a unique SKU to each variation to prevent issues syncing sales.', 'wplister');
             // $success = false;
         }
         if (!$VariationsHaveStock && !$reviseItem && !ListingsModel::thisAccountUsesOutOfStockControl($this->account_id)) {
             $longMessage = __('None of these variations are in stock.', 'wplister');
             $success = false;
         }
         // make this info available to reviseItem()
         $this->VariationsHaveStock = $VariationsHaveStock;
     } else {
         // item has no variations
         // StartPrice must be greater than 0
         if (self::dbSafeFloatval($item->StartPrice->value) == 0) {
             $longMessage = __('Price can not be zero.', 'wplister');
             $success = false;
         }
         // check minimum start price if found
         // $min_prices = get_option( 'wplister_MinListingStartPrices', array() );
         $min_prices = $this->site_id ? maybe_unserialize(WPLE_eBaySite::getSiteObj($this->site_id)->MinListingStartPrices) : array();
         if (!is_array($min_prices)) {
             $min_prices = array();
         }
         $listing_type = $item->ListingType ? $item->ListingType : 'FixedPriceItem';
         if (isset($min_prices[$listing_type])) {
             $min_price = $min_prices[$listing_type];
             if ($item->StartPrice->value < $min_price) {
                 $longMessage = sprintf(__('eBay requires a minimum price of %s for this listing type.', 'wplister'), $min_price);
                 $success = false;
             }
         }
     }
     // check if any required item specifics are missing
     $primary_category_id = $item->PrimaryCategory->CategoryID;
     $specifics = EbayCategoriesModel::getItemSpecificsForCategory($primary_category_id, $this->site_id, $this->account_id);
     foreach ($specifics as $req_spec) {
         // skip non-required specs
         if (!$req_spec->MinValues) {
             continue;
         }
         // skip if Name already exists in ItemSpecifics
         if (self::thisNameExistsInNameValueList($req_spec->Name, $item->ItemSpecifics->NameValueList)) {
             continue;
         }
         // skip if Name already exists in VariationSpecificsSet
         if (is_object($item->Variations)) {
             $VariationSpecificsSet = $item->Variations->getVariationSpecificsSet();
             if (self::thisNameExistsInNameValueList($req_spec->Name, $VariationSpecificsSet->NameValueList)) {
                 continue;
             }
         }
         $DoesNotApplyText = WPLE_eBaySite::getSiteObj($this->site_id)->DoesNotApplyText;
         $DoesNotApplyText = empty($DoesNotApplyText) ? 'Does not apply' : $DoesNotApplyText;
         // // add missing item specifics
         $NameValueList = new NameValueListType();
         $NameValueList->setName($req_spec->Name);
         $NameValueList->setValue($DoesNotApplyText);
         $item->ItemSpecifics->addNameValueList($NameValueList);
         wple_show_message('<b>Note:</b> Missing item specifics <b>' . $req_spec->Name . '</b> was set to "' . $DoesNotApplyText . '" in order to prevent listing errors.', 'warn');
     }
     // check if any item specific have more values than allowed
     foreach ($specifics as $req_spec) {
         // skip specs without limit
         if (!$req_spec->MaxValues) {
             continue;
         }
         // count values for this item specific
         $number_of_values = self::countValuesForNameInNameValueList($req_spec->Name, $item->ItemSpecifics->NameValueList);
         if ($number_of_values <= $req_spec->MaxValues) {
             continue;
         }
         // remove additional values from item specific
         for ($i = 0; $i < sizeof($item->ItemSpecifics->NameValueList); $i++) {
             if ($item->ItemSpecifics->NameValueList[$i]->Name != $req_spec->Name) {
                 continue;
             }
             $values_array = $item->ItemSpecifics->NameValueList[$i]->Value;
             $item->ItemSpecifics->NameValueList[$i]->Value = reset($values_array);
         }
         wple_show_message('<b>Note:</b> The item specifics <b>' . $req_spec->Name . '</b> has ' . $number_of_values . ' values, but eBay allows only ' . $req_spec->MaxValues . ' value(s).<br>In order to prevent listing errors, additional values will be omitted.', 'warn');
     }
     // ItemSpecifics values can't be longer than 50 characters
     foreach ($item->ItemSpecifics->NameValueList as $spec) {
         $values = is_array($spec->Value) ? $spec->Value : array($spec->Value);
         foreach ($values as $value) {
             if (strlen($value) > 50) {
                 $longMessage = __('eBay does not allow attribute values longer than 50 characters.', 'wplister');
                 $longMessage .= '<br>';
                 $longMessage .= __('You need to shorten this value:', 'wplister') . ' <code>' . $value . '</code>';
                 $success = false;
             }
         }
     }
     // PrimaryCategory->CategoryID must be greater than 0
     if (intval(@$item->PrimaryCategory->CategoryID) == 0) {
         $longMessage = __('There has been no primary category assigned.', 'wplister');
         $success = false;
     }
     // check for main image
     if (trim(@$item->PictureDetails->GalleryURL) == '') {
         $longMessage = __('You need to add at least one image to your product.', 'wplister');
         $success = false;
     }
     // remove ReservedPrice on fixed price items
     if ($item->getReservePrice() && $item->getListingType() == 'FixedPriceItem') {
         $item->setReservePrice(null);
         $longMessage = __('Reserve price does not apply to fixed price listings.', 'wplister');
         // $success = false;
     }
     // omit price and shipping cost when revising an item with promotional sale enabled
     if ($reviseItem && ListingsModel::thisListingHasPromotionalSale($this->listing_id)) {
         $item->setStartPrice(null);
         $item->setShippingDetails(null);
         wple_show_message(__('Price and shipping were omitted since this item has promotional sale enabled.', 'wplister'), 'info');
     }
     if (!$success && !$this->is_ajax()) {
         wple_show_message($longMessage, 'error');
     } elseif ($longMessage != '' && !$this->is_ajax()) {
         wple_show_message($longMessage, 'warn');
     }
     $htmlMsg = '<div id="message" class="error" style="display:block !important;"><p>';
     $htmlMsg .= '<b>' . 'This item did not pass the validation check' . ':</b>';
     $htmlMsg .= '<br>' . $longMessage . '';
     $htmlMsg .= '</p></div>';
     // save error as array of objects
     $errorObj = new stdClass();
     $errorObj->SeverityCode = 'Validation';
     $errorObj->ErrorCode = '42';
     $errorObj->ShortMessage = $longMessage;
     $errorObj->LongMessage = $longMessage;
     $errorObj->HtmlMessage = $htmlMsg;
     $errors = array($errorObj);
     // save results as local property
     $this->result = new stdClass();
     $this->result->success = $success;
     $this->result->errors = $errors;
     return $success;
 }
Exemplo n.º 6
0
    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>';
    }
Exemplo n.º 7
0
 public function loadPaymentOptions($site_id)
 {
     $sm = new EbayPaymentModel();
     $sm->downloadPaymentDetails($this->session, $site_id);
     $sm->downloadMinimumStartPrices($this->session, $site_id);
     $sm->downloadReturnPolicyDetails($this->session, $site_id);
     // set date of last update for site
     $Site = new WPLE_eBaySite($site_id);
     $Site->last_refresh = date('Y-m-d H:i:s');
     $Site->update();
 }