如何在SCA阿空加瓜的产品详细信息模板中显示产品评论

时间:2018-08-02 08:45:23

标签: suitecommerce

我正在尝试在product_details_information.tpl而不是product_details_full.tpl模板上显示“产品评论”。评论完全没有显示。我尝试将产品评论作为子视图添加到“产品详细信息”视图中,但没有成功。这是产品评论模块:

ProductReviews.js

/*
    © 2017 NetSuite Inc.
    User may not copy, modify, distribute, or re-bundle or otherwise make available this code;
    provided, however, if you are an authorized user with a NetSuite account or log-in, you
    may use this code subject to the terms that govern your access and use.
*/

// @module ProductReviews
// Defines the ProductReviews module (Model, Collection, Views, Router)
// Mount to App also handles rendering of the reviews
// if the current view has any placeholder for them
define('ProductReviews'
,   [
        'ProductReviews.Router'
    ,   'ProductReviews.Center.View'
    ,   'GlobalViews.StarRating.View'
    ,   'ProductDetails.Full.View'
        ,'ProductDetails.Information.View'
    ]
,   function(
        Router
    ,   ProductReviewsCenterView
    ,   GlobalViewsStarRatingView
    ,   ProductDetailsFullView
        , ProductDetailsInformationView
    )
{
    'use strict';

    // @class ProductReviews @extends ApplicationModule
    var ProductReviewsModule =
    {
        mountToApp: function (application)
        {
            if (SC.ENVIRONMENT.REVIEWS_CONFIG && SC.ENVIRONMENT.REVIEWS_CONFIG.enabled)
            {
                ProductDetailsFullView.addChildViews({
                    'ProductReviews.Center': function wrapperFunction (options)
                    {
                        return function ()
                        {
                            return new ProductReviewsCenterView({
                                item: options.model.get('item')
                            ,   application: options.application
                            });
                        };
                    }
                });

                ProductDetailsInformationView.addChildViews({
                    'ProductReviews.Center': function wrapperFunction (options)
                    {
                        return function ()
                        {
                            return new ProductReviewsCenterView({
                                item: options.model.get('item')
                                ,   application: options.application
                            });
                        };
                    }
                });

                ProductDetailsFullView.addChildViews({
                    'Global.StarRating': function wrapperFunction (options)
                    {
                        return function ()
                        {
                            return new GlobalViewsStarRatingView({
                                model: options.model.get('item')
                            ,   showRatingCount: true
                            ,   showSchemaInfo: true
                            });
                        };
                    }
                });

                ProductDetailsInformationView.addChildViews({
                    'Global.StarRating': function wrapperFunction (options)
                    {
                        return function ()
                        {
                            return new GlobalViewsStarRatingView({
                                model: options.model.get('item')
                                ,   showRatingCount: true
                                ,   showSchemaInfo: true
                            });
                        };
                    }
                });
            }

            // default behavior for mount to app
            return new Router(application);
        }
    };

    return ProductReviewsModule;
});

和product_details_information.tpl

<div data-view="ProductReviews.Center"></div>

对此有何想法?

0 个答案:

没有答案