/** * @return GetUserPreferencesResponseType * @param GetUserPreferencesRequestType $request */ function GetUserPreferences($request) { $request->setVersion(EBAY_WSDL_VERSION); return $this->call('GetUserPreferences', $request); }
public function GetUserPreferences($return_result = false) { // prepare request $req = new GetUserPreferencesRequestType(); $req->setShowSellerProfilePreferences(true); $req->setShowOutOfStockControlPreference(true); // $req->setShowSellerExcludeShipToLocationPreference( true ); // send request $res = $this->sp->GetUserPreferences($req); // echo "<pre>";print_r($res);echo"</pre>";#die(); // handle response error if ('EbatNs_ResponseError' == get_class($res)) { return false; } $result = new stdClass(); $result->success = true; $result->seller_shipping_profiles = array(); $result->seller_payment_profiles = array(); $result->seller_return_profiles = array(); $result->SellerProfileOptedIn = $res->SellerProfilePreferences->SellerProfileOptedIn; $result->OutOfStockControl = $res->OutOfStockControlPreference; $profiles = $res->getSellerProfilePreferences()->getSupportedSellerProfiles()->getSupportedSellerProfile(); // echo "<pre>";print_r($profiles);echo"</pre>";#die(); // if ( $result->SellerProfileOptedIn ) { if (sizeof($res->SellerProfilePreferences->SupportedSellerProfiles->SupportedSellerProfile) > 0) { foreach ($res->SellerProfilePreferences->SupportedSellerProfiles->SupportedSellerProfile as $profile) { $seller_profile = new stdClass(); $seller_profile->ProfileID = $profile->ProfileID; $seller_profile->ProfileName = $profile->ProfileName; $seller_profile->ProfileType = $profile->ProfileType; $seller_profile->ShortSummary = $profile->ShortSummary; switch ($profile->ProfileType) { case 'SHIPPING': $result->seller_shipping_profiles[] = $seller_profile; break; case 'PAYMENT': $result->seller_payment_profiles[] = $seller_profile; break; case 'RETURN_POLICY': $result->seller_return_profiles[] = $seller_profile; break; } } if ($return_result) { return $result; } update_option('wplister_ebay_seller_shipping_profiles', $result->seller_shipping_profiles); update_option('wplister_ebay_seller_payment_profiles', $result->seller_payment_profiles); update_option('wplister_ebay_seller_return_profiles', $result->seller_return_profiles); } else { if ($return_result) { return $result; } delete_option('wplister_ebay_seller_shipping_profiles'); delete_option('wplister_ebay_seller_payment_profiles'); delete_option('wplister_ebay_seller_return_profiles'); } if ($return_result) { return $result; } update_option('wplister_ebay_seller_profiles_enabled', $result->SellerProfileOptedIn ? 'yes' : 'no'); delete_option('wplister_ebay_seller_profiles'); }