It is provided with the ProductCollection model of grouping the products in catalogs or creating special collections with various rule sets. The collection type may be Dynamic or Static. Collection items are created only from items available for sale. In dynamic collections, a collection rule set is created using certain filters so that the products are dynamically added to the collection through this rule set. Dynamic collections remain active for the specified time expiration_date period. As long as they are not expired, the items in the collection are updated according to the rule set. This process is managed with tasks. In static collections, the items are added to the collection once and remain stable. While the created collections can be used to create special pages, they can also be used to create campaigns.
GET Product Collection
Sample HTTP request to get all product_collections lists from the system.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. You can retrieve api_token by logging in.
Records new objects in the ProductCollection table. The ProductCollectionSerializer class defined at omnitron.channels.integrations.omniweb.serializers is used to validate the data.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. You can retrieve api_token by logging in.
Request
Path: /api/v1/product_collections/
import requests
url = "https://{customer_api_url}/api/v1/product_collections/"
api_token = "API TOKEN"
headers = {
'content-type': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}
data = {
"name": "test-collection-1",
"collection_type": "static", # can be "static" or "dynamic"
"catalog": {catalog-id}
}
response = requests.post(url, headers=headers, data=data)
print(response.text)
Allows users to create their own product collections. Dynamic refers users to add dynamic filters and automatically find and add products that fit into filters. Users can mark these collections as active or inactive, by default is_active is true.
Update can be performed for collections with PATCH Patch operations. The following request is an example of a rule set assignment for a dynamic collection.
With the deletion request, the collection is deactivated but not completely removed from the system.The sample is_active parameter is updated to false because the perform_destroy method of the ProductCollectionViewSet is overridden.
The endpoint where the products in the collection are listed so all the products belonging to this collection are listed. Listing is done by calling the item_list method of the ProductCollectionViewSet.
The endpoint where the products that can be added in the collection are listed. Listing is done by calling the product_list method of the ProductCollectionViewSet.