0

我正在尝试通过 SSP 应用程序创建自定义“查看购物车”。我想检查客户当前是否登录,并尝试获取客户信息。不幸的是,它总是返回错误。

我很确定,我的帐户已登录,因为我可以访问我的自定义中心页面。

我什至在 SS 文件中尝试过。这里似乎有什么问题?感谢您的任何帮助。在 SSP 和 SS 中检查它的任何其他方式?

SSP 文件:

  <html>
  <head>
  <%=getPageFullHead()%>
  <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
  <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
  <%  var container = nlapiGetWebContainer(),
      session = container.getShoppingSession(),
      orders = session.getOrder(),
      orderSummaryTotal = orders.getOrderSummary();
  %>
 </head>
 <body>
   <div><%=session.isLoggedIn()%></div>
 </body>
 </html>

SS文件:

  function service(request, response) {

    var session = nlapiGetWebContainer().getShoppingSession(),
        orders = session.getOrder(),
        isLoggedIn = session.isLoggedIn();

           response.setContentType('JSON');
       response.write(JSON.stringify(isLoggedIn));

  }

还尝试在控制台console.log(<%=JSON.stringify(session)%>)中查看对象,但它给了我这样的错误

“此操作前请先登录。”

4

1 回答 1

1

在 NetSuite 世界中,有一些方法可以检索已登录:

  1. isLoggedIn()需要安全 https 和活动会话(登录用户)
  2. getCurrentAttribute适用于 http 和过期会话(已识别、已注销的用户)。

例如,使用以下内容获取有关非安全 SSP 购物车的客户信息。

<%=getCurrentAttribute('customer','firstname')%>
<%=getCurrentAttribute('customer','lastname')%>
<%=getCurrentAttribute('customer','companyname')%>
<%=getCurrentAttribute('site','name')%>
<%=getCurrentAttribute('customer','currency')%>
<%=getCurrentAttribute('customer','category')%>
于 2015-01-21T21:00:13.020 回答