how can we display group item on SuiteCommerce por...
# ask-stanley-ai
u
how can we display group item on SuiteCommerce portal?
c
AI generated answer (using internal Slack threads):
To display group items on the SuiteCommerce portal, you would need to customize the product detail page (PDP) of your SuiteCommerce site. This can be done by modifying the SuiteCommerce Advanced (SCA) modules or creating a custom module. Here are the steps you might follow: 1. Create a custom module that extends the
ProductDetails
module. This module will be responsible for fetching and displaying the group items. 2. In your custom module, override the
getDetails
method of the
ProductDetails
module. In this method, you can fetch the group items related to the current product. 3. To fetch the group items, you can use the
commerce/catalog/storefront/items
API. This API allows you to fetch items by their internal ID. You can use the
expand
parameter to fetch the group items. 4. Once you have fetched the group items, you can display them on the PDP. You can do this by modifying the PDP's template and adding a section for the group items. Here is a sample code snippet that shows how you might extend the
ProductDetails
module:
Copy code
javascript
define('Custom.ProductDetails', [
    'ProductDetails.Full.View'
], function (
    ProductDetailsFullView
) {
    'use strict';

    _.extend(ProductDetailsFullView.prototype, {
        getDetails: function () {
            var self = this;
            var item = this.model.get('item');
            var groupItems = item.get('_matrixParent').get('_groupItems');

            // Fetch the group items
            var groupItemsPromise = this.fetchGroupItems(groupItems);

            groupItemsPromise.done(function (groupItems) {
                // Add the group items to the model
                self.model.set('groupItems', groupItems);
            });

            return this._super();
        },

        fetchGroupItems: function (groupItems) {
            // Implement the logic to fetch the group items
        }
    });
});
Please note that this is a simplified example and might not cover all the edge cases. You might need to adjust the code to fit your specific needs. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817382872
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812866271
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806030393
Please provide your feedback on this answer.
u
what about the PLP ? how can we fetch the parent item only for PLP and hide all the other component from PLP