SWS GetAvailableRetailItems Method
Retrieves a list of retail items available for purchase from a site. Also includes bulk pricing information for each retail item returned from the list. The bulk pricing information returns the new discount amount for all retail items, if the minimum bulk threshold amount is reached.
Parameters
Name | DataType | Is Required |
---|---|---|
Filter | RetailFilter | Optional |
Description | Allows you to add a filter by which you can search for the retail items. Available values:
|
|
SearchTerm | String | Optional |
Description | The filter information for which you are searching. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
Details | AVAIL_SITE_RETAIL_ITEMS |
Description | Object containing on the item details for available items. |
DiscountAmount | Decimal |
Description | The discounted price if the bulk pricing minimum threshold is met. This will only apply if a bulk discount was created for the item. |
DiscountType | BulkDiscountTypes |
Description | The bulk pricing discount type. Available values:
|
MinThreshold | Integer |
Description | The minimum number of retail items to be sold before the bulk pricing discount can be applied. |
RetailId | Long |
Description | The retail item’s ID number at the organization level. |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, a GetAvailableRetailItems request object and a GetAvailableRetailItems response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.GetAvailableRetailItems_Request request = new SWS.GetAvailableRetailItems_Request();
SWS.GetAvailableRetailItems_Response response;
Here’s my sample code of the Request object.
// GetAvailableRetailItems Request
request.SiteID = 123456;
request.Filter = SWS.RetailFilter.ALL_SITE_ITEMS;
request.SearchTerm = "Box";
Finally we can call the method and pass across the login object and the request object to retrieve our retail items. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.GetAvailableRetailItems(user_request,request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.