Description: In the matrix child item the images of the respect child will not be stored if we required to access child item images we need to access from parent item, we can use this solution to get images from parent item.
JavaScript:
Entry Point:
let itemId = self.itemModel.get("itemid")// childitem SKU
itemId = itemId.replace(new RegExp("[0-9]", "g"), "");// removing any numbersfrom sku
let searchParams = {
q: itemId,
fieldset: "relateditems",
dimensions: "52x30"
};
self.searchItemModel = new SCModel.SCModel();
self.searchItemModel.urlRoot = ()=>search.getUrl(searchParams);
self.searchItemModel.fetch().then(res => {
let parentItem = _.find(res.items, data => {
let isParent = false;
_.each(data.matrixchilditems_detail, line=>{
isParent = line.itemid === self.itemModel.get("itemid") ? true : isParent;
})
return isParent;
})//finding parentItem
var childItemImages = parentItem.itemimages_detail[this.itemModel.get("custitem_jj_colour")]//
self.itemModel.set("parentItem", parentItem);
self.render();