Difference between revisions of "NVelocity variables available in scriptlets"

From AbleCommerce Wiki
Jump to: navigation, search
Line 1: Line 1:
Following will be available on the product details page
+
<div id="warning" style="text-align: center; background: #ffffee; margin: .75em 10%; padding: .5em; border: 2px solid #ffc3b0;">
 +
'''WARNING'''
 +
Use NVelocity to only control the layout. Don't use it as a programming alternative otherwise it will slow down your pages. If you want to customize some logic then its better to modify the ConLib controls or create new controls to meet your requirements.
 +
</div>
  
<code>
 
<pre>
 
store
 
  
customer
+
The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context.
  
page
+
{| {{Prettytable}}
 +
|- {{Hl3}}
 +
!Variable!!Type!!Comments
 +
|-
 +
|$store or $Store||CommerceBuilder.Stores.Store||Reference to the current store. Available for all pages
 +
|-
 +
|$customer or $User ||CommerceBuilder.Users.User||Reference to the current user. Available for all pages
 +
|-
 +
|$page ||System.Web.UI.Page||The ASP.NET page object. Available for all pages
 +
|-
 +
|$Category ||CommerceBuilder.Catalog.Category||Category object is available on category, product, webpage and link display pages and wherever a CategoryId parameter is available in URL.
 +
|-
 +
|$Product ||CommerceBuilder.Products.Product||Product object is available on product display pages and wherever a ProductId is available in URL.
 +
|-
 +
|$Webpage ||CommerceBuilder.Catalog.Webpage||Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.
 +
|-
 +
|$Link ||CommerceBuilder.Catalog.Link||Link object is available on link display pages and wherever a LinkId is available in URL.
 +
|}
  
Store
+
In the scriptlet code you can access almost anything using the above objects. For example if you want to get the Orders for current user then $User.Orders will provide you that information etc. However it is '''strongly discouraged''' to use nVelocity scriptlets for anything other than controlling the display layout.
 
+
User
+
 
+
Category
+
 
+
Product
+
 
+
</pre>
+
</code>
+
 
+
Bellow is the list available across all store side pages
+
 
+
<code>
+
<pre>
+
store
+
 
+
customer
+
 
+
page
+
 
+
Store
+
 
+
User
+
 
+
Category
+
 
+
Product
+
 
+
Webpage
+
 
+
Link
+
</pre>
+
</code>
+
 
+
You can use access other objects using above. For example if you want to get the Orders for current user then $User.Orders will provide you that info etc.
+
 
+
'''NOTE:''' Use NVelocity to only control the layout. Don't use it as a programming alternative otherwise it will slow down your pages. If you want to customize some logic etc then better to modify the ConLib controls or create new controls to meet your requirements.
+

Revision as of 05:33, 4 September 2008

WARNING Use NVelocity to only control the layout. Don't use it as a programming alternative otherwise it will slow down your pages. If you want to customize some logic then its better to modify the ConLib controls or create new controls to meet your requirements.


The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context.

Variable Type Comments
$store or $Store CommerceBuilder.Stores.Store Reference to the current store. Available for all pages
$customer or $User CommerceBuilder.Users.User Reference to the current user. Available for all pages
$page System.Web.UI.Page The ASP.NET page object. Available for all pages
$Category CommerceBuilder.Catalog.Category Category object is available on category, product, webpage and link display pages and wherever a CategoryId parameter is available in URL.
$Product CommerceBuilder.Products.Product Product object is available on product display pages and wherever a ProductId is available in URL.
$Webpage CommerceBuilder.Catalog.Webpage Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.
$Link CommerceBuilder.Catalog.Link Link object is available on link display pages and wherever a LinkId is available in URL.

In the scriptlet code you can access almost anything using the above objects. For example if you want to get the Orders for current user then $User.Orders will provide you that information etc. However it is strongly discouraged to use nVelocity scriptlets for anything other than controlling the display layout.