CatalogsThursday, June 30, 2016 11:16 PM
The SDK Catalog functionality allows users to retrieve, save and purchase from merchant catalogs.
Each catalog is created by a merchant and contains categories of products that the user can select and purchase.
There are two ways in which catalogs can be retrieved:
Catalog Workflow: A catalog is returned as part of a
CatalogWorkflowwhich is triggered by a user scaning a Bidco tag.
- Profile Catalogs: A list of saved catalogs can be retrieved from the user's profile.
Retrieving a Catalog From The Workflow
Each time a user interacts with a Bidco tag that results in a
CatalogWorkflow, a catalog is returned and automatically added to the user's profile.
The workflow also contains a possible set of coupons that the user can redeem on future purchases. The coupons are automatically saved to the user's profile but returned here so they can be displayed to the user.
Catalog catalog = workflow.Catalog; Merchant merchant = workflow.Merchant; List<Coupon> coupons = workflow.TriggeredCoupons; // Display coupons to user
Retrieving Catalogs From The User's Profile
Each time a user scans a Bidco tag associated with a catalog, that catalog is saved to the user's profile.
To obtain all catalogs that have been saved to the profile:
CatalogManager catalogManager = ManagerFactory.GetInstance().CatalogManager; List<Catalog> catalogs = await catalogManager.GetCatalogsAsync(); // Display the list of catalogs to user showing the catalog Name, Description, merchant logo and any images.
Deleting a Catalog From the User's Profile
When a user no longer needs a catalog they will choose to delete it from the profile:
// Delete the selected Catalog from the user's profile await catalogManager.DeleteCatalogAsync(catalog);
Retreiving Categories From The Catalog
Categories only exist within a catalog so once the user has selected the Catalog they would like to work with, you can retrieve its categories.
List<Category> categores = await catalogManager.GetCategoriesAsync(selectedCatalog); // Display the list of categories to user showing the catalog Name, Description and any images.
Retrieving Products For a Category
You can now retrieve all the products linked to the category selected by the user:
Page page = new Page(20); page.PageNumber = 1; List<Product> products = await ManagerFactory.getInstance().ProductManager.GetProductsAsync(category, page); // Display the list of products to the user
When a catalog is retrieved from a user's profile the catalog only contains a reference to the merchant who created it. In this case there is one final step to perform before products can be added to a basket.
Retrieve the merchant for the selected catalog:
MerchantManager merchantManager = ManagerFactory.GetInstance().MerchantManager; Merchant merchant = await merchantManager.GetMerchantAsync(catalog); // Use the merchant to get the basket