Version: eXtendASI 1.3.3 and above
Audience: Administrator, Developer
Overview
This article provides a guide on how to set the image URLs based on the variant-specific image URLs received in the response from ASI when using eXtendASI. By default, eXtendASI sets the image URLs received in the item response during item constitution.
Configuration
To utilize variant-specific image URLs, you'll need to implement the setItemImageUrls() function in the suite_asi_transformers.js file. Below is a sample code snippet explaining how the function works:
/*** @param {Object} args* @property {Object} args.imageUrlObject* @property {Object} args.itemRecord* @property {Object} args.variant* @property {Object} args.product*/function setItemImageUrls(args) {var imageUrlObject = args.imageUrlObject;var itemRecord = args.itemRecord;var variant = args.variant;var product = args.product;if (imageUrlObject.urlPathLarge) {itemRecord.setValue({ fieldId: 'custitem_extend_asi_item_url_large', value: imageUrlObject.urlPathLarge });}if (imageUrlObject.urlPathNormal) {itemRecord.setValue({ fieldId: 'custitem_extend_asi_item_url_normal', value: imageUrlObject.urlPathNormal });}if (imageUrlObject.urlPathSmall) {itemRecord.setValue({ fieldId: 'custitem_extend_asi_item_url_small', value: imageUrlObject.urlPathSmall });}}
This function checks if image URLs for large, normal, and small sizes exist in the imageUrlObject. If they do, it sets the respective item record values accordingly.