Blog_Featured_Network_Solutions

For those of you wishing to learn some of the advanced functions in Network Solution’s nsCommerceSpace, you are going to need to learn some of the functions listed here below.  I am going to start going in-depth as to how these are used over time here on the blog.  I have received a large amount of questions in regards to some of the functions, as Network Solutions does not do a real good job at going into them on their website.  In fact, I have found more broken links than I have found anything else.  In fact, a large amount of their product manual still links back to their now defunct Monster Commerce website, in which I originally assisted in creating manuals for.

Here are the current nsScript operators and functions, which will allow you to create customized aspects to your website.  Basic uses of the script are described below.  I will continue to create new blog articles, describing each as we go.

Operators

Arithmetic Operators

+ Addition Example: <% Product.ImageCount + 2 %>
Subtraction Example: <% Product.ImageCount – 2 %>
* Multiplication Example: <% Product.ImageCount * 2 %>
/ Division Example: <% Product.ImageCount / 2 %>
% Modulus Example: <ns:if condition “Product.ImageCount % 2 = 1″></ns:if>

 

Assignment Operators

=

Equals Example: <ns:if condition “Customer.Notes =’ ‘”>
!= Not-Equal….. Example: <ns:if condition “Customer.Notes !=’ ‘”>
|| Or Example: <ns:if condition=” Product.HasOnSalePromo || Product.HasTaxFreePromo”></ns:if>
&& And Example: <ns:if condition=”Product.DisplayImageUrl != ‘ ‘ &&  Product.CustomerPrice > 10.00″></ns:if>

 

Conditionals

In addition to a section’s pre-defined Conditionals, any of that section’s values can be used in a conditional statement.  Below is an example using the customer notes value in the Invoice Design section.

Example:

<ns:if condition=”Customer.Notes != ‘ ‘”><!– do things –>
</ns:if>

 

The Choose statement can be used to create a more complex conditional. In ns:Script the Choose When/Otherwise block is used in place of the common If/Else statement.

Example:

<ns:choose>
<ns:when condition=”Product.ImageCount > 1″>View More Images</ns:when>
<ns:otherwise>View Larger Image</ns:otherwise>
</ns:choose>

 

Using JavaScript

nsScript can also be used within JavaScript.

Example:

<script type=”text/javascript”>
var prodId = <% Product.Id %>;
if (prodId = ‘120’){
document.getElementById(‘message’).innerHTML = “Hello World”;
}
</script>

Basic Functions

Basic functions can be used anywhere on the storefront where functions are allowed.  This includes:  page content, module HTML content, header/footer HTML, product layout, and order confirmation messages.

 

Values:

Example:

<%Company.Name%>

 

Available Values:

  • CurrentThemePath (String)
  • Company.Name (String)
  • User.FirstName (String)
  • User.LastName (String)
  • User.Name (String)
  • Cart.Count (Integer)
  • Cart.Total (Decimal)

 

Conditionals (Predefined):

Example:

<ns:if condition=”User.IsLoggedIn”><!– do things –></ns:if>

 

Available Predefined Conditional:

  • User.IsLoggedIn (True/False)

 

Content Area Functions

 

Content Area functions can be used only on the page content that is displayed in the center column.

Quick Order

Quick Order allows you to display multiple products on one page for faster purchases. Ten products will be displayed per page. Customers can specify the product quantities needed and click the Add to Cart button once at the bottom of each page.

 

Example:

<ns:QuickOrder showimages=”true” showdescriptions=”true” showstockmessage=”true” />

 

Syntax:

  • ns:QuickOrder

Parameters:

  • showimages – true/false, true default
  • showdescriptions – true/false, true default
  • showstockmessage – true/false, true default
  • showcategoryselector – true/false, true default
  • showsearch – true/false, true default
  • pagesize – string
  • initialcategoryid – null

 

Click Here For: Programming In nsCommerceSpace nsScript (Part 2)