Pages

2012/05/07

SSP Pages and the Power of Awesome

I am rarely excited by NetSuite announcements, and I tend to wait a while before taking position on the quality of a new feature...but this time, I am very excited about the new SSP pages. I could barely stay on my chair during the NetSuite presentation on the functionality, and could not wait to start coding one for the pleasure of it.

The feature is still in Beta phase according to the description in the 'Enable Features' page (SuiteScript Server Pages (Beta)), but according to NetSuite it should work properly at this point in time.

So, let's dive into this pool of infinite potential (I told you I was excited), and cover some of the things that can be done with SSP pages in the NetSuite Webstore.

Once the feature is enabled (Enable Features), it is possible to access the SSP Application in the Website Setup section. This is where we can create all  of our more-awesome-than-the-other-applications SSP Application. For a quick reference, view the screenshot below of the page we will need to work with in order to create our innovative checkout pages.



To start, set a name for the application which will be used in the generated url to access the application. This can always be changed  later manually to match your needs. The other important section is the Application Folder which will contain a grouping of related applications, and its URL Root  is created by the application folder name (because it is sitting in the live hosting file) and the name of the application.



For those of you who have a keen sense of observation, you may have noticed the Scripts section in the service function. With these we are getting closer to where the magic happens. For those with scripting knowledge, note that service uses the same parameter as a Suitelet (a nlobjRequest and a nlobjResponse).

The Touch Point sub-list  is where you will identify which page you want to change and with which you will create the SSP Page. It is possible to change the checkout pages using your own logic, and if you've been trying to alter those pages through different technique, you know how hard it was. The SSP pages create a plethora of possibilities, and the projects you can now achieve.

---NOTE: This next section contains code samples
Once the page you want to change has been identified, it is time to create the actual SSP pages. Please note that currently this is the only way to get the SSP pages to work.

In the pages, it is possible use all the <% ... %>  tags we have used in the past. This greatly accelerates the creation of the pages because we can reuse the header, footer or navigation we created in the web store theme. For example, if we want to add the header to the page, we would only have to use the following in the SSP page :
...
<table>
<%=getPageTop()%>
</table>
...
And voilĂ . We have our theme header generated in our SSP page.

Finally, the thing I'm the most happy to see is a supported access to the shopping session object. If you have ever had to work to get information from the cart and the session, you know how difficult it can be to fetch the right information. Through nlapiGetWebContainer(). getShoppingSession() we finally have access to the sales information. For example, I need the summary of an order (total, subtotal, shipping cost, etc), I can simply do the following :

<%var summary = nlapiGetWebContainer().getShoppingSession().getOrder().getOrderSummary()%>
<%for(var field in orderSummary){%>
      <tr>
         <td><%=field%></td>
         <td><%=orderSummary[field]%></td>
      </tr>
<%}%>

Simple! In essence, we now have the possibility to use JSP-like pages. With only these two possibilities I would have been satisfied but there is more, so much more we can do with this functionality.





2 comments:

  1. Absolutely, This SSP is going to be great. I wish they opened it up to entire webstore. But I can see why they didn't. Here is my sample. http://codeboxllc.com/ksc/script-library/suitescript-server-pages-sspss/getting-started-on-customizing-webstore-registration-page-using-sspss/

    ReplyDelete
  2. Possible you can guide me how to integrate 3D secure for SSP reference onepage checkout? I followed the article but sill no luck

    ReplyDelete