Services represent different methods of shipping from a provider. Usually the prices of these rates are based on the weight of the package, the distance the package must travel and the speed of delivery. For example, FedEx provides services such as “First Overnight”, “2 Day” and “International Priority”.
If your custom shipping provider is retrieving the services for the shipping carrier via an external service, you may want to setup the provider’s services in the backend, and then display only the active/defined services to your customer in the front end. For example, your external shipping carrier may provide 20 different service rates, but you may only want to display 4 or 5 of those rates to your customer. In this case you will define these 4 or 5 services in the backend and then use them to filter the services, returned by the provider.
To setup services for your shipping carrier provider, perform the following:
NOTE: The Shipping Service Settings screen may already display a number of services for any existing shipping providers.
To query the predefined services for your provider, you must perform the following:
The list of shipping services will come in handy when processing the data that is returned from an external shipping carrier and that contains the shipping services and their rates. When parsing the service data that is returned from the shipping carrier, retrieve its service code and check if there is a service with the same code in your list of shipping services. If it does, then parse the rate of the service and wrap it in a GenericShippingResponse object. Use the values of the Title and SortOrder properties of the ShippingServiceSettings instance for the ServiceName and SrotOrder properties of the GenericServerResponse instance. If a service with the same code is not present, then do not add this service to your ShippingResponse list. Using this method, you can filter the set of external provider’s services down to a subset of just those services you want to provide to your customers.
Use the following code example for parsing a sample XML response of a shipping carrier’s external service:
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important