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 PTKCatalogWorkflow which 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 PTKCatalogWorkflow, 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.

Retrieve the catalog from the PTKCatalogWorkflow. (see triggers and workflows for how to get the workflow).

PTKCatalog *catalog = workflow.catalog;
PTKMerchant *merchant = workflow.merchant;
NSArray<PTKCoupon> *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:

PTKCatalogManager *catalogManager = [[PTKManagerFactory sharedManager] workflowManager];
[catalogManager catalogsWithCompletion completion:^(NSArray<PTKCatalog> *catalogs, NSError *error) {
	// 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:

[catalogManager deleteCatalog:selectedCatalog completion:^(NSError *error) {
	if (!error) {
		// Catalog has been removed from the user's profile
	}
}];

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.

[catalogManager categoriesWithCatalog:selectedCatalog completion:^(NSArray<PTKCategory> *categories, NSError *error) {
	// 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:

PTKPage *page = [PTKPage pageWithNumberPage:[NSNumber numberWithInt:1] pageSize:[NSNumber numberWithInt:25]];
PTKProductManager *productanager = [[PTKManagerFactory sharedManager] workflowManager];
[productManager productsWithCategory:selectedCategory page:page completion:^(NSArray<PTKProduct> *products, NSError *error) {
	// Display the list of products to the user
}];

Next Steps

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:

PTKMerchantManager *merchantManager = [[PTKManagerFactory sharedManager] merchantManager];
[merchantManager getMerchantFromCatalog:catalog withCompletion:^(PTKMerchant *merchant, NSError *error) {
    // Use the merchant to get the basket
}];

From here the user can select products they would like to add to a basket.