【问题标题】:Calculate Discount from Price Levels in Netsuite Suitecommerce Advanced在 Netsuite Suitecommerce Advanced 中根据价格水平计算折扣
【发布时间】:2016-06-14 21:07:21
【问题描述】:

我正在尝试在我的 ItemsKeyMapping.js 中创建一个函数,该函数将计算客户在产品上节省的百分比。我是 javascript 新手,一直在使用教程。这就是我所拥有的:

// @property _DiscountPercent calculates the percentage between customers price and MSRP
    ,   _DiscountPercent: function (item)
        {
            var attributes = item.get('onlinecustomerprice') || ('pricelevel15');

            if ((pricelevel15 != 0) && (onlinecustomerprice != 0)) 

            {
                DiscountPercent = (1 - pricelevel15 / onlinecustomerprice) * 100;
            }
            else 
            {
             DiscountPercent = null;
             }
            return 'DiscountPercent';
        }

有哪位熟悉 SCA Mont Blanc 的人可以帮我完成这件事吗?谢谢。

【问题讨论】:

  • 你能发布更多的上下文代码吗?
  • 您好 Tony,SCA 中有大量代码。有什么帮助?该文件告诉后端在项目记录中提供 onenecustomer 价格和价格级别 15 的值。这是另一个请求文本字段中信息的调用示例:// @property _StoreDescription grab the html in the web store description field , _StoreDescription: function(item) { return item.get('storedescription') }

标签: javascript netsuite


【解决方案1】:

试试这个:

,   _DiscountPercent: function (item)
    {
        var normalPrice= item.get('onlinecustomerprice') 
        var discountedPrice= item.get('pricelevel15');
        var DiscountPercent = null;

        if ((discountedPrice > 0) && (normalPrice > 0)) 

        {
            DiscountPercent = (1 - discountedPrice / normalPrice) * 100;
        }

        return DiscountPercent;
    }

【讨论】:

  • 这看起来更近了!还不能让它正常工作,例如,不确定我是否想要 onlinecustomer price 或_priceDetails。我会做一些额外的测试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-05
  • 2020-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多