Having some difficulties adding some fields to the...
# suitecommerce
k
Having some difficulties adding some fields to the
ItemRelations.RelatedItem.View
.
Copy code
Layout.addToViewContextDefinition('ItemRelations.RelatedItem.View', 'Extrass', 'object', function(context) {
                console.log("Related - Add to View", context);
                var items = PDP.getItemsInfo();
                console.log("Get Items: " + items);
                var item = _.find(items, {internalid: context.itemId});
                return {
                    storedescription : item.storedescription,
                };
            })
What am I doing wrong? It doesn’t seem to like getting the items from the PDP component.
s
There a few typos in your code, the primary one being that it should be PDP.getItemInfo() -- you've used the plural
k
Oof - that’ll do it… thanks for the sanity check. Do you have a link handy where I can view all available methods / functions?
btw I don't know exactly what you're trying to do, but if you're in the context of ItemRelations, you may wish to use a
contextDataRequest
instead https://developers.suitecommerce.com/access-model-and-collection-data-in-a-child-view-with-contextdata.html
k
Ahhh that’s what I was looking for, makes a lot more sense to do it that way. I’m just adding some custom fields but I may be able to accomplish it an easier way. Nice to have options