http://wiki.ablecommerce.com/api.php?action=feedcontributions&user=Loganr&feedformat=atomAbleCommerce Wiki - User contributions [en]2024-03-28T23:42:35ZUser contributionsMediaWiki 1.23.17http://wiki.ablecommerce.com/index.php/Main_PageMain Page2012-11-21T18:20:47Z<p>Loganr: /* AbleCommerce Gold */</p>
<hr />
<div><big>'''Welcome to the AbleCommerce Developers Wiki'''</big><br />
<br />
This wiki contains extra documentation that is geared toward advanced customization and development tasks using the AbleCommerce shopping cart. <br />
<br />
<br />
== AbleCommerce Gold ==<br />
* [[AbleCommerce Gold Code Differences]]<br />
* [[Look and Feel Customization - AC Gold]]<br />
* [[Feature Customization - AC Gold]]<br />
* [[Database - AC Gold]]<br />
* [[Data Access Layer - AC Gold]]<br />
<br />
== AbleCommerce 7x ==<br />
* [[Look and Feel Customization - AC7]]<br />
* [[Feature Customization - AC7]]<br />
* [[Database - AC7]]<br />
* [[Data Port Utility]]<br />
* [[Data Port Utility FAQ]]<br />
<br />
<br />
== Common Topics ==<br />
* [[CommerceBuilder API]]<br />
* [[Development Resources]]<br />
* [[Third Party Integrations]]<br />
* [[Running Your Store]]<br />
* [[Search Engine Optimization]]<br />
* [[Misc Tips]]<br />
* [[Release History]]<br />
<br />
<br />
== External Links (AbleCommerce websites)==<br />
<br />
* [http://www.ablecommerce.com AbleCommerce.com]<br />
* [http://help.ablecommerce.com Help documentation and frequently asked questions]<br />
* [http://forums.ablecommerce.com Community forums]<br />
* [http://blog.ablecommerce.com AbleCommerce Blog - Learn more...Sell more]<br />
* [http://topsites.ablecommerce.com Client Gallery]<br />
* [http://ablecommerce.net Search All Sites]<br />
<br />
If you find anything posted in violation of the [[Guidelines]] please edit it or [http://www.ablecommerce.com/ecommerce-contacts.aspx let us know].</div>Loganrhttp://wiki.ablecommerce.com/index.php/CommerceBuilder_APICommerceBuilder API2012-11-21T18:18:39Z<p>Loganr: </p>
<hr />
<div>AbleCommerce websites are built around a set of compiled libraries known as CommerceBuilder. This is a set of object oriented classes that powers the ecommerce features of the site. It isolates complex business code from your web scripts so that during custom development you can focus on the user interface. <br />
<br />
The CommerceBuilder API is a set of .NET classes that are used to build the ecommerce store front. They facilitate access to the database, enforcement of business rules and calculations, and order processing.<br />
<br />
A compiled help file is available that gives detailed information on the classes and methods available. If you have a newer operating system like Vista or Windows 7, be aware that there is a security feature that may prevent you from opening this file. After downloading, you should go to the file properties and unblock it. Download the appropriate file for your version, or if that is unavailable choose the newest version closest to your own.<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_702.chm AbleCommerce 7.0.2]<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_705.chm AbleCommerce 7.0.5]<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilderGold.chm AbleCommerce Gold]<br />
<br />
<br />
== Topics ==<br />
<br />
[[Data Access Layer - AC7]] (DAL)<br />
<br />
[[Custom Queries - AC7]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Integrating A Payment Gateway]] (Payment Provider API)<br />
<br />
[[Integrating A Shipping Carrier]] (Shipping Provider API)<br />
<br />
[[Integrating A Tax Provider]] (Tax Provider API)<br />
<br />
[[Creating Digital Delivery Licensing Module]] (Serial Key Provider API)<br />
<br />
[[Creating A Custom Feed Provider]] (Feed Provider API)<br />
<br />
[[URL Rewrite Provider API]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Nullable_DatesNullable Dates2012-10-17T16:13:41Z<p>Loganr: </p>
<hr />
<div>In AbleCommerce 7.0.0 through AbleCommerce 7.0.7, many of our objects had DateTime properties that were nullable in the database. In these versions we would translate null into the value System.DateTime.MinValue when reading the records. When making business logic decisions the DateTime property would need to be checked against DateTime.MinValue to see if it was present.<br />
<br />
In AbleCommerce Gold the behavior changes slightly. Instead of translating null dates, our DateTime properties are nullable. This means the property can either be null or it can have a value. In order to use these DateTime properties you must be sure to factor in the possibility that the value does not exist in the database. In these cases you must decide how to handle that condition.<br />
<br />
A list of the properties that are nullable are below:<br />
<br />
{| class="wikitable" border="1" width="100%"<br />
|-<br />
!scope="col" | CLASS<br />
!scope="col" | PROPERTY<br />
!scope="col" | SIGNIFICANCE OF NULL<br />
|-<br />
| Coupon || StartDate || The coupon has no restriction on when it starts to be valid.<br />
|-<br />
| Coupon || EndDate|| The coupon has no restriction on when it ceases to be valid.<br />
|-<br />
| EmailList || LastSendDate || The email list has never been sent.<br />
|-<br />
| EmailListUser || LastSendDate || The email list has never been sent to this list member.<br />
|-<br />
| OrderItemDigitalGood || ActivationDate || The digital good has not been activated.<br />
|-<br />
| OrderItemDigitalGood || DownloadDate || The digital good has not been downloaded.<br />
|-<br />
| OrderShipment|| ShipDate || The order shipment has not been shipped.<br />
|-<br />
| Subscription|| ExpirationDate || The subscription has no expiration.<br />
|-<br />
| Payment|| CompletedDate || The payment has not yet been completed.<br />
|-<br />
| Special || StartDate || The special has no restriction on when it starts to be active.<br />
|-<br />
| Special || EndDate || The special has no restriction on when it ceases to be active.<br />
|-<br />
| Redirect || LastVisitedDate || The redirect has never been visited.<br />
|-<br />
| Currency || LastUpdate || The exchange rate for the currency has never been updated.<br />
|-<br />
| User || AffiliateReferralDate || The user has not been referred by an affiliate.<br />
|-<br />
| User || LastActivityDate || The user has never browsed the site.<br />
|-<br />
| User || LastLoginDate || The user has never logged in.<br />
|-<br />
| User || LastPasswordChangedDate || The user has never changed the password.<br />
|-<br />
| User || LastLockoutDate || The user has never been locked out.<br />
|}<br />
<br />
==Working with Nullable Dates==<br />
<br />
In customizing code with these properties you may notice from Intellisense that nullable dates act a little different from regular DateTime values. There are two different ways to decide if a DateTime has a value:<br />
<br />
<code>if (Coupon.StartDate.HasValue)</code><br />
<br />
OR<br />
<br />
<code>if (Coupon.StartDate != null)</code><br />
<br />
And when accessing the DateTime you need to use the Value property:<br />
<br />
<code>Coupon.StartDate.Value</code></div>Loganrhttp://wiki.ablecommerce.com/index.php/Nullable_DatesNullable Dates2012-10-17T16:13:10Z<p>Loganr: </p>
<hr />
<div>In AbleCommerce 7.0.0 through AbleCommerce 7.0.7, many of our objects had DateTime properties that were nullable in the database. In these versions we would translate null into the value System.DateTime.MinValue when reading the records. When making business logic decisions the DateTime property would need to be checked against DateTime.MinValue to see if it was present.<br />
<br />
In AbleCommerce Gold the behavior changes slightly. Instead of translating null dates, our DateTime properties are nullable. This means the property can either be null or it can have a value. In order to use these DateTime properties you must be sure to factor in the possibility that the value does not exist in the database. In these cases you must decide how to handle that condition.<br />
<br />
A list of the properties that are nullable are below:<br />
<br />
{| class="wikitable" border="1" width="100%"<br />
|-<br />
!scope="col" | CLASS<br />
!scope="col" | PROPERTY<br />
!scope="col" | SIGNIFICANCE OF NULL<br />
|-<br />
| Coupon || StartDate || The coupon has no restriction on when it starts to be valid.<br />
|-<br />
| Coupon || EndDate|| The coupon has no restriction on when it ceases to be valid.<br />
|-<br />
| EmailList || LastSendDate || The email list has never been sent.<br />
|-<br />
| EmailListUser || LastSendDate || The email list has never been sent to this list member.<br />
|-<br />
| OrderItemDigitalGood || ActivationDate || The digital good has not been activated.<br />
|-<br />
| OrderItemDigitalGood || DownloadDate || The digital good has not been downloaded.<br />
|-<br />
| OrderShipment|| ShipDate || The order shipment has not been shipped.<br />
|-<br />
| Subscription|| ExpirationDate || The subscription has no expiration.<br />
|-<br />
| Payment|| CompletedDate || The payment has not yet been completed.<br />
|-<br />
| Special || StartDate || The special has no restriction on when it starts to be active.<br />
|-<br />
| Special || EndDate || The special has no restriction on when it ceases to be active.<br />
|-<br />
| Redirect || LastVisitedDate || The redirect has never been visited.<br />
|-<br />
| Currency || LastUpdate || The exchange rate for the currency has never been updated.<br />
|-<br />
| User || AffiliateReferralDate || The user has not been referred by an affiliate.<br />
|-<br />
| User || LastActivityDate || The user has never browsed the site.<br />
|-<br />
| User || LastLoginDate || The user has never logged in.<br />
|-<br />
| User || LastPasswordChangedDate || The user has never changed the password.<br />
|-<br />
| User || LastLockoutDate || The user has never been locked out.<br />
|}<br />
<br />
==Working with Nullable Dates==<br />
<br />
In customizing code with these properties you may notice from Intellisense that nullable dates act a little different from regular DateTime values. There are two different ways to decide if a DateTime has a value:<br />
<br />
<code>if (Coupon.StartDate.HasValue)</code><br />
<code>if (Coupon.StartDate != null)</code><br />
<br />
And when accessing the DateTime you need to use the Value property:<br />
<br />
<code>Coupon.StartDate.Value</code></div>Loganrhttp://wiki.ablecommerce.com/index.php/Nullable_DatesNullable Dates2012-10-17T15:59:22Z<p>Loganr: </p>
<hr />
<div>In AbleCommerce 7.0.0 through AbleCommerce 7.0.7, many of our objects had DateTime properties that were nullable in the database. In these versions we would translate null into the value System.DateTime.MinValue when reading the records. When making business logic decisions the DateTime property would need to be checked against DateTime.MinValue to see if it was present.<br />
<br />
In AbleCommerce Gold the behavior changes slightly. Instead of translating null dates, our DateTime properties are nullable. This means the property can either be null or it can have a value. In order to use these DateTime properties you must be sure to factor in the possibility that the value does not exist in the database. In these cases you must decide how to handle that condition.<br />
<br />
A list of the properties that are nullable are below:<br />
<br />
{| class="wikitable" border="1" width="100%"<br />
|-<br />
!scope="col" | CLASS<br />
!scope="col" | PROPERTY<br />
!scope="col" | SIGNIFICANCE OF NULL<br />
|-<br />
| Coupon || StartDate || The coupon has no restriction on when it starts to be valid.<br />
|-<br />
| Coupon || EndDate|| The coupon has no restriction on when it ceases to be valid.<br />
|-<br />
| EmailList || LastSendDate || The email list has never been sent.<br />
|-<br />
| EmailListUser || LastSendDate || The email list has never been sent to this list member.<br />
|-<br />
| OrderItemDigitalGood || ActivationDate || The digital good has not been activated.<br />
|-<br />
| OrderItemDigitalGood || DownloadDate || The digital good has not been downloaded.<br />
|-<br />
| OrderShipment|| ShipDate || The order shipment has not been shipped.<br />
|-<br />
| Subscription|| ExpirationDate || The subscription has no expiration.<br />
|-<br />
| Payment|| CompletedDate || The payment has not yet been completed.<br />
|-<br />
| Special || StartDate || The special has no restriction on when it starts to be active.<br />
|-<br />
| Special || EndDate || The special has no restriction on when it ceases to be active.<br />
|-<br />
| Redirect || LastVisitedDate || The redirect has never been visited.<br />
|-<br />
| Currency || LastUpdate || The exchange rate for the currency has never been updated.<br />
|-<br />
| User || AffiliateReferralDate || The user has not been referred by an affiliate.<br />
|-<br />
| User || LastActivityDate || The user has never browsed the site.<br />
|-<br />
| User || LastLoginDate || The user has never logged in.<br />
|-<br />
| User || LastPasswordChangedDate || The user has never changed the password.<br />
|-<br />
| User || LastLockoutDate || The user has never been locked out.<br />
|}</div>Loganrhttp://wiki.ablecommerce.com/index.php/Nullable_DatesNullable Dates2012-10-17T15:41:17Z<p>Loganr: New page: In AbleCommerce 7.0.0 through AbleCommerce 7.0.7, many of our objects had DateTime properties that were nullable in the database. In these versions we would translate null into the value ...</p>
<hr />
<div>In AbleCommerce 7.0.0 through AbleCommerce 7.0.7, many of our objects had DateTime properties that were nullable in the database. In these versions we would translate null into the value System.DateTime.MinValue when reading the records. When making business logic decisions the DateTime property would need to have the value checked to see if a value was present.<br />
<br />
In AbleCommerce Gold the behavior changes slightly. Instead of translating null dates, our DateTime properties are nullable. This means the property can either be null or it can have a value. In order to use these DateTime properties you must be sure to factor in the possibility that the value does not exist in the database. In these cases you must decide how to handle that condition.<br />
<br />
A list of the properties that are nullable are below:<br />
<br />
{| class="wikitable" border="1" width="100%"<br />
|-<br />
!scope="col" | CLASS<br />
!scope="col" | PROPERTY<br />
!scope="col" | SIGNIFICANCE OF NULL<br />
|-<br />
| Coupon || StartDate || The coupon has no restriction on when it starts to be valid.<br />
|-<br />
| Coupon || EndDate|| The coupon has no restriction on when it ceases to be valid.<br />
|-<br />
| EmailList || LastSendDate || The email list has never been sent.<br />
|-<br />
| EmailListUser || LastSendDate || The email list has never been sent to this list member.<br />
|-<br />
| OrderItemDigitalGood || ActivationDate || The digital good has not been activated.<br />
|-<br />
| OrderItemDigitalGood || DownloadDate || The digital good has not been downloaded.<br />
|-<br />
| OrderShipment|| ShipDate || The order shipment has not been shipped.<br />
|-<br />
| Subscription|| ExpirationDate || The subscription has no expiration.<br />
|-<br />
| Payment|| CompletedDate || The payment has not yet been completed.<br />
|-<br />
| Special || StartDate || The special has no restriction on when it starts to be active.<br />
|-<br />
| Special || EndDate || The special has no restriction on when it ceases to be active.<br />
|-<br />
| Redirect || LastVisitedDate || The redirect has never been visited.<br />
|-<br />
| Currency || LastUpdate || The exchange rate for the currency has never been updated.<br />
|-<br />
| User || AffiliateReferralDate || The user has not been referred by an affiliate.<br />
|-<br />
| User || LastActivityDate || The user has never browsed the site.<br />
|-<br />
| User || LastLoginDate || The user has never logged in.<br />
|-<br />
| User || LastPasswordChangedDate || The user has never changed the password.<br />
|-<br />
| User || LastLockoutDate || The user has never been locked out.<br />
|}</div>Loganrhttp://wiki.ablecommerce.com/index.php/AbleCommerce_Gold_Code_DifferencesAbleCommerce Gold Code Differences2012-10-17T15:20:08Z<p>Loganr: initial content</p>
<hr />
<div>If you are familiar with custom development in AC707 and prior, there are some notable differences in syntax when moving to AbleCommerce Gold. Some of the major differences are:<br />
<br />
[[Nullable Dates]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Main_PageMain Page2012-10-17T15:18:53Z<p>Loganr: add link for coding differences</p>
<hr />
<div><big>'''Welcome to the AbleCommerce Developers Wiki'''</big><br />
<br />
This wiki contains extra documentation that is geared toward advanced customization and development tasks using the AbleCommerce shopping cart. Some popular topics include:<br />
<br />
* [[AbleCommerce Gold Reference Documentation]]<br />
* [[AbleCommerce Gold Code Differences]]<br />
* [[Store Customization]] <br />
* [[Store Design]]<br />
* [[CommerceBuilder API]]<br />
* [[Database]]<br />
* [[Running Your Store]]<br />
* [[Search Engine Optimization]]<br />
* [[Data Port Utility]]<br />
* [[Data Port Utility FAQ]]<br />
* [[Development Resources]]<br />
* [[Third Party Integrations]]<br />
* [[Misc Tips]]<br />
* [[Release History]] <br />
<br />
== External Links (AbleCommerce websites)==<br />
<br />
* [http://www.ablecommerce.com AbleCommerce.com]<br />
* [http://help.ablecommerce.com Help documentation and frequently asked questions]<br />
* [http://forums.ablecommerce.com Community forums]<br />
* [http://blog.ablecommerce.com AbleCommerce Blog - Learn more...Sell more]<br />
* [http://topsites.ablecommerce.com Client Gallery]<br />
* [http://ablecommerce.net Search All Sites]<br />
<br />
If you find anything posted in violation of the [[Guidelines]] please edit it or [http://www.ablecommerce.com/ecommerce-contacts.aspx let us know].</div>Loganrhttp://wiki.ablecommerce.com/index.php/Main_PageMain Page2012-10-12T21:12:45Z<p>Loganr: update introduction</p>
<hr />
<div><big>'''Welcome to the AbleCommerce Developers Wiki'''</big><br />
<br />
This wiki contains extra documentation that is geared toward advanced customization and development tasks using the AbleCommerce shopping cart. Some popular topics include:<br />
<br />
* [[AbleCommerce Gold Reference Documentation]]<br />
* [[Store Customization]] <br />
* [[Store Design]]<br />
* [[CommerceBuilder API]]<br />
* [[Database]]<br />
* [[Running Your Store]]<br />
* [[Search Engine Optimization]]<br />
* [[Data Port Utility]]<br />
* [[Data Port Utility FAQ]]<br />
* [[Development Resources]]<br />
* [[Third Party Integrations]]<br />
* [[Misc Tips]]<br />
* [[Release History]] <br />
<br />
== External Links (AbleCommerce websites)==<br />
<br />
* [http://www.ablecommerce.com AbleCommerce.com]<br />
* [http://help.ablecommerce.com Help documentation and frequently asked questions]<br />
* [http://forums.ablecommerce.com Community forums]<br />
* [http://blog.ablecommerce.com AbleCommerce Blog - Learn more...Sell more]<br />
* [http://topsites.ablecommerce.com Client Gallery]<br />
* [http://ablecommerce.net Search All Sites]<br />
<br />
If you find anything posted in violation of the [[Guidelines]] please edit it or [http://www.ablecommerce.com/ecommerce-contacts.aspx let us know].</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocity_variables_available_in_scriptletsNVelocity variables available in scriptlets2012-03-01T16:21:03Z<p>Loganr: Eliminate legacy parameter names.</p>
<hr />
<div><div id="warning" style="text-align: center; background: #ffffee; margin: .75em 10%; padding: .5em; border: 2px solid #ffc3b0;"><br />
<span style="color: red">'''WARNING'''</span><br />
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.<br />
</div><br />
<br />
<br />
The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context. <br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Variable!!Type!!Comments<br />
|-<br />
|$store||CommerceBuilder.Stores.Store||Reference to the current store. Available for all pages<br />
|-<br />
|$customer||CommerceBuilder.Users.User||Reference to the current user. Available for all pages<br />
|-<br />
|$page ||System.Web.UI.Page||The ASP.NET page object. Available for all pages<br />
|-<br />
|$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.<br />
|-<br />
|$Product ||CommerceBuilder.Products.Product||Product object is available on product display pages and wherever a ProductId is available in URL.<br />
|-<br />
|$Webpage ||CommerceBuilder.Catalog.Webpage||Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.<br />
|-<br />
|$Link ||CommerceBuilder.Catalog.Link||Link object is available on link display pages and wherever a LinkId is available in URL.<br />
|}<br />
<br />
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 $customer.Orders will provide you that information etc. However it is '''strongly discouraged''' to use nVelocity scriptlets for anything other than controlling the display layout.<br />
<br />
== Common Properties ==<br />
<br />
A sample of some of the properties commonly accessed is shown in the table below. For a full listing of all object properties, see the [[CommerceBuilder_API|API]].<br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Type!!Property!!Usage<br />
|-<br />
|CommerceBuilder.Users.User||UserName||$customer.UserName<br />
|-<br />
|CommerceBuilder.Users.User||Email||$customer.Email<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FirstName||$customer.PrimaryAddress.FirstName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.LastName||$customer.PrimaryAddress.LastName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FullName||$customer.PrimaryAddress.FullName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.Phone||$customer.PrimaryAddress.Phone<br />
|}<br />
<br />
== External Links ==<br />
* [http://www.castleproject.org/others/nvelocity/ NVelocity (castleroject)]<br />
* [http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html User Guide (velocity)]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocity_variables_available_in_scriptletsNVelocity variables available in scriptlets2012-02-22T18:19:49Z<p>Loganr: /* Common Properties */</p>
<hr />
<div><div id="warning" style="text-align: center; background: #ffffee; margin: .75em 10%; padding: .5em; border: 2px solid #ffc3b0;"><br />
<span style="color: red">'''WARNING'''</span><br />
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.<br />
</div><br />
<br />
<br />
The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context. <br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Variable!!Type!!Comments<br />
|-<br />
|$store or $Store||CommerceBuilder.Stores.Store||Reference to the current store. Available for all pages<br />
|-<br />
|$customer or $User ||CommerceBuilder.Users.User||Reference to the current user. Available for all pages<br />
|-<br />
|$page ||System.Web.UI.Page||The ASP.NET page object. Available for all pages<br />
|-<br />
|$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.<br />
|-<br />
|$Product ||CommerceBuilder.Products.Product||Product object is available on product display pages and wherever a ProductId is available in URL.<br />
|-<br />
|$Webpage ||CommerceBuilder.Catalog.Webpage||Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.<br />
|-<br />
|$Link ||CommerceBuilder.Catalog.Link||Link object is available on link display pages and wherever a LinkId is available in URL.<br />
|}<br />
<br />
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.<br />
<br />
== Common Properties ==<br />
<br />
A sample of some of the properties commonly accessed is shown in the table below. For a full listing of all object properties, see the [[CommerceBuilder_API|API]].<br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Type!!Property!!Usage<br />
|-<br />
|CommerceBuilder.Users.User||UserName||$User.UserName<br />
|-<br />
|CommerceBuilder.Users.User||Email||$User.Email<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FirstName||$User.PrimaryAddress.FirstName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.LastName||$User.PrimaryAddress.LastName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FullName||$User.PrimaryAddress.FullName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.Phone||$User.PrimaryAddress.Phone<br />
|}<br />
<br />
== External Links ==<br />
* [http://www.castleproject.org/others/nvelocity/ NVelocity (castleroject)]<br />
* [http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html User Guide (velocity)]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocity_variables_available_in_scriptletsNVelocity variables available in scriptlets2012-02-22T18:11:51Z<p>Loganr: /* Common Properties */</p>
<hr />
<div><div id="warning" style="text-align: center; background: #ffffee; margin: .75em 10%; padding: .5em; border: 2px solid #ffc3b0;"><br />
<span style="color: red">'''WARNING'''</span><br />
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.<br />
</div><br />
<br />
<br />
The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context. <br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Variable!!Type!!Comments<br />
|-<br />
|$store or $Store||CommerceBuilder.Stores.Store||Reference to the current store. Available for all pages<br />
|-<br />
|$customer or $User ||CommerceBuilder.Users.User||Reference to the current user. Available for all pages<br />
|-<br />
|$page ||System.Web.UI.Page||The ASP.NET page object. Available for all pages<br />
|-<br />
|$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.<br />
|-<br />
|$Product ||CommerceBuilder.Products.Product||Product object is available on product display pages and wherever a ProductId is available in URL.<br />
|-<br />
|$Webpage ||CommerceBuilder.Catalog.Webpage||Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.<br />
|-<br />
|$Link ||CommerceBuilder.Catalog.Link||Link object is available on link display pages and wherever a LinkId is available in URL.<br />
|}<br />
<br />
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.<br />
<br />
== Common Properties ==<br />
<br />
A sample of some of the properties commonly accessed is shown in the table below. For a full listing of all object properties, see the [[CommerceBuilder_API|API]].<br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Type!!Property!!Usage<br />
|-<br />
|CommerceBuilder.Users.User||UserName||$User.UserName<br />
|-<br />
|CommerceBuilder.Users.User||Email||$User.Email<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FirstName||$User.PrimaryAddress.FirstName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.LastName||$User.PrimaryAddress.LastName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FullName||$User.PrimaryAddress.FullName<br />
|}<br />
<br />
== External Links ==<br />
* [http://www.castleproject.org/others/nvelocity/ NVelocity (castleroject)]<br />
* [http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html User Guide (velocity)]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocity_variables_available_in_scriptletsNVelocity variables available in scriptlets2012-02-22T18:08:32Z<p>Loganr: </p>
<hr />
<div><div id="warning" style="text-align: center; background: #ffffee; margin: .75em 10%; padding: .5em; border: 2px solid #ffc3b0;"><br />
<span style="color: red">'''WARNING'''</span><br />
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.<br />
</div><br />
<br />
<br />
The following nVelocity variables are available in scriptlets. Some variables are available only in a particular context. <br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Variable!!Type!!Comments<br />
|-<br />
|$store or $Store||CommerceBuilder.Stores.Store||Reference to the current store. Available for all pages<br />
|-<br />
|$customer or $User ||CommerceBuilder.Users.User||Reference to the current user. Available for all pages<br />
|-<br />
|$page ||System.Web.UI.Page||The ASP.NET page object. Available for all pages<br />
|-<br />
|$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.<br />
|-<br />
|$Product ||CommerceBuilder.Products.Product||Product object is available on product display pages and wherever a ProductId is available in URL.<br />
|-<br />
|$Webpage ||CommerceBuilder.Catalog.Webpage||Webpage object is available on webpage display pages and wherever a WebpageId is available in URL.<br />
|-<br />
|$Link ||CommerceBuilder.Catalog.Link||Link object is available on link display pages and wherever a LinkId is available in URL.<br />
|}<br />
<br />
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.<br />
<br />
== Common Properties ==<br />
<br />
A sample of some of the properties commonly accessed is shown in the table below. For a full listing of all object properties, see the API.<br />
<br />
{| {{Prettytable}}<br />
|- {{Hl3}}<br />
!Type!!Property!!Usage<br />
|-<br />
|CommerceBuilder.Users.User||UserName||$User.UserName<br />
|-<br />
|CommerceBuilder.Users.User||Email||$User.Email<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FirstName||$User.PrimaryAddress.FirstName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.LastName||$User.PrimaryAddress.LastName<br />
|-<br />
|CommerceBuilder.Users.User||PrimaryAddress.FullName||$User.PrimaryAddress.FullName<br />
|}<br />
<br />
== External Links ==<br />
* [http://www.castleproject.org/others/nvelocity/ NVelocity (castleroject)]<br />
* [http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html User Guide (velocity)]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_-_AC7Database - AC72011-07-25T17:25:32Z<p>Loganr: </p>
<hr />
<div>The AbleCommerce 7.0 database was completely rebuilt from the last major releases of version 5.5. If you worked with the prior version, many tables will be familar and changed only in minor ways, such as names or field sizes.<br />
<br />
[[Media:AbleCommerce_7.0.7_Database.chm|7.0.7 Database Schema (chm)]]<br />
<br />
If you download the above file on Windows Vista or higher, you may need to unblock the file before you can browse the contents. Right click on the downloaded file, choose properties, then click the button to unblock.<br />
<br />
== Importing Data ==<br />
<br />
Many people want to import data directly to support custom integrations with other platforms. Some common tables may have special requirements when inserting data in them.<br />
<br />
* [[Importing Categories]]<br />
* [[Data Port Utility]]<br />
<br />
== Full Text Searching ==<br />
<br />
Full text search is fully supported in AbleCommerce versions 7.0.5 forward for your product catalog. This feature is only supported for SQL Server 2005 and above, and your database server must have the FTS service installed and available. If you are using SQL Server Express versions, this feature is available when you install SQL Server Express with Advanced Services.<br />
<br />
When using FTS, be aware that certain words are ignored in searches. These are known as "stop words". The [[stop words list]] can be customized if the default list is not appropriate for your situation.<br />
<br />
== See Also ==<br />
<br />
[[Custom Queries]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Data Access Layer]] (DAL)</div>Loganrhttp://wiki.ablecommerce.com/index.php/File:AbleCommerce_7.0.7_Database.chmFile:AbleCommerce 7.0.7 Database.chm2011-07-25T17:21:28Z<p>Loganr: AbleCommerce 7.0.7 Database Schema</p>
<hr />
<div>AbleCommerce 7.0.7 Database Schema</div>Loganrhttp://wiki.ablecommerce.com/index.php/CommerceBuilder_APICommerceBuilder API2010-11-10T20:37:08Z<p>Loganr: </p>
<hr />
<div>AbleCommerce websites are built around a set of compiled libraries known as CommerceBuilder. This is a set of object oriented classes that powers the ecommerce features of the site. It isolates complex business code from your web scripts so that during custom development you can focus on the user interface. <br />
<br />
The CommerceBuilder API is a set of .NET classes that are used to build the ecommerce store front. They facilitate access to the database, enforcement of business rules and calculations, and order processing.<br />
<br />
A compiled help file is available that gives detailed information on the classes and methods available. If you have a newer operating system like Vista or Windows 7, be aware that there is a security feature that may prevent you from opening this file. After downloading, you should go to the file properties and unblock it. Download the appropriate file for your version, or if that is unavailable choose the newest version closest to your own.<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_702.chm AbleCommerce 7.0.2]<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_705.chm AbleCommerce 7.0.5]<br />
<br />
== Topics ==<br />
<br />
[[Data Access Layer]] (DAL)<br />
<br />
[[Custom Queries]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Integrating A Payment Gateway]] (Payment Provider API)<br />
<br />
[[Integrating A Shipping Carrier]] (Shipping Provider API)<br />
<br />
[[Integrating A Tax Provider]] (Tax Provider API)<br />
<br />
[[Creating Digital Delivery Licensing Module]] (Serial Key Provider API)<br />
<br />
[[Creating A Custom Feed Provider]] (Feed Provider API)<br />
<br />
[[URL Rewrite Provider API]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/CommerceBuilder_APICommerceBuilder API2010-11-10T20:36:49Z<p>Loganr: allow for CHM updates</p>
<hr />
<div>AbleCommerce websites are built around a set of compiled libraries known as CommerceBuilder. This is a set of object oriented classes that powers the ecommerce features of the site. It isolates complex business code from your web scripts so that during custom development you can focus on the user interface. <br />
<br />
The CommerceBuilder API is a set of .NET classes that are used to build the ecommerce store front. They facilitate access to the database, enforcement of business rules and calculations, and order processing.<br />
<br />
A compiled help file is available that gives detailed information on the classes and methods available. If you have a newer operating system like Vista or Windows 7, be aware that there is a security feature that may prevent you from opening this file. After downloading, you should go to the file properties and unblock it. Download the appropriate file for your version, or if that is unavailable choose the newest version closest to your own.<br />
<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_702.chm AbleCommerce 7.0.2]<br />
[ftp://ftp.ablecommerce.com/docs/CommerceBuilder_705.chm AbleCommerce 7.0.5]<br />
<br />
== Topics ==<br />
<br />
[[Data Access Layer]] (DAL)<br />
<br />
[[Custom Queries]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Integrating A Payment Gateway]] (Payment Provider API)<br />
<br />
[[Integrating A Shipping Carrier]] (Shipping Provider API)<br />
<br />
[[Integrating A Tax Provider]] (Tax Provider API)<br />
<br />
[[Creating Digital Delivery Licensing Module]] (Serial Key Provider API)<br />
<br />
[[Creating A Custom Feed Provider]] (Feed Provider API)<br />
<br />
[[URL Rewrite Provider API]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Stop_words_listStop words list2010-10-29T20:13:55Z<p>Loganr: </p>
<hr />
<div>The AbleCommerce search parser ignores certain words if they are entered as part of a search query. These are known as stop words. SQL Server maintains a list of words that it does not index because generally speaking they would not be unique or helpful. Examples of stop words might be the, of, a, an, and so forth.<br />
<br />
Out of the box, AbleCommerce ignores the stop words that are by default in use with SQL Server 2008. However some people may wish to alter the list of words, either to add words or remove them. To do this, you must alter in two locations.<br />
<br />
The first location that must be altered is your SQL Server.<br />
<br />
== SQL Server 2005 ==<br />
<br />
In SQL Server 2005, there is only one set of words for all databases. It is a global setting, and in this version was called "noise words". Please refer to the Microsoft documentation on changing the noise words for your server:<br />
<br />
http://msdn.microsoft.com/en-us/library/ms142551(SQL.90).aspx<br />
<br />
== SQL Server 2008 ==<br />
<br />
With SQL Server 2008, noise words were replaced by stop words. And the best part is the stop words lists can be database specific instead of global to the whole server. To change a stop words list, see here:<br />
<br />
http://msdn.microsoft.com/en-us/library/ms142551(v=SQL.100).aspx<br />
<br />
== AbleCommerce ==<br />
<br />
If you do change the stop words list, you will need to let the AbleCommerce installation know of the change. Do this by altering the file ~/App_Data/stopwords.txt. This is a simple text file list of words that should be ignored in the search. The list of words should match what is in place on your database.<br />
<br />
If you make the proper change in both locations, your searches will ignore your custom list of words. In most cases, this will not be necessary and this should be considered an advanced type of change.</div>Loganrhttp://wiki.ablecommerce.com/index.php/Stop_words_listStop words list2010-10-29T20:13:00Z<p>Loganr: initial content</p>
<hr />
<div>The AbleCommerce search parser ignores certain words if they are entered as part of a search query. These are known as stop words. SQL Server maintains a list of words that it does not index because generally speaking they would not be unique or helpful. Examples of stop words might be the, of, a, an, and so forth.<br />
<br />
Out of the box, AbleCommerce ignores the stop words that are by default in use with SQL Server 2008. However some people may wish to alter the list of words, either to add words or remove them. To do this, you must alter in two locations.<br />
<br />
The first location that must be altered is your SQL Server.<br />
<br />
<br />
== SQL Server 2005 ==<br />
<br />
In SQL Server 2005, there is only one set of words for all databases. It is a global setting, and in this version was called "noise words". Please refer to the Microsoft documentation on changing the noise words for your server:<br />
<br />
http://msdn.microsoft.com/en-us/library/ms142551(SQL.90).aspx<br />
<br />
== SQL Server 2008 ==<br />
<br />
With SQL Server 2008, noise words were replaced by stop words. And the best part is the stop words lists can be database specific instead of global to the whole server. To change a stop words list, see here:<br />
<br />
http://msdn.microsoft.com/en-us/library/ms142551(v=SQL.100).aspx<br />
<br />
== AbleCommerce ==<br />
<br />
If you do change the stop words list, you will need to let the AbleCommerce installation know of the change. Do this by altering the file ~/App_Data/stopwords.txt. This is a simple text file list of words that should be ignored in the search. The list of words should match what is in place on your database.</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_-_AC7Database - AC72010-10-29T20:02:56Z<p>Loganr: Include information on FTS and stop words</p>
<hr />
<div>The AbleCommerce 7.0 database was completely rebuilt from the last major releases of version 5.5. If you worked with the prior version, many tables will be familar and changed only in minor ways, such as names or field sizes.<br />
<br />
[[Media:AbleCommerce_70_Database_Schema.pdf|Database Schema (pdf)]]<br />
<br />
== Importing Data ==<br />
<br />
Many people want to import data directly to support custom integrations with other platforms. Some common tables may have special requirements when inserting data in them.<br />
<br />
* [[Importing Categories]]<br />
* [[Data Port Utility]]<br />
<br />
== Full Text Searching ==<br />
<br />
Full text search is fully supported in AbleCommerce versions 7.0.5 forward for your product catalog. This feature is only supported for SQL Server 2005 and above, and your database server must have the FTS service installed and available. If you are using SQL Server Express versions, this feature is available when you install SQL Server Express with Advanced Services.<br />
<br />
When using FTS, be aware that certain words are ignored in searches. These are known as "stop words". The [[stop words list]] can be customized if the default list is not appropriate for your situation.<br />
<br />
== See Also ==<br />
<br />
[[Custom Queries]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Data Access Layer]] (DAL)</div>Loganrhttp://wiki.ablecommerce.com/index.php/How_to_debug_PayPal_IPN_Handler_using_ASP.NET_TraceHow to debug PayPal IPN Handler using ASP.NET Trace2010-07-27T21:00:42Z<p>Loganr: </p>
<hr />
<div>'''What is ASP.NET Trace?'''<br />
<br />
ASP.NET tracing enables you to view diagnostic information about a single request for an ASP.NET page. ASP.NET tracing enables you to follow a page's execution path, display diagnostic information at run time, and debug your application. ASP.NET tracing can be integrated with system-level tracing to provide multiple levels of tracing output in distributed and multi-tier applications.<br />
<br />
'''How to enable ASP.NET Trace in AbleCommerce?'''<br />
<br />
* Edit your Website/Web.config file<br />
* Locate following element in it<br />
<pre><br />
<trace enabled="false" requestLimit="10" pageOutput="false" localOnly="true" /><br />
</pre><br />
and update its enabled property value to true like below. You will also want to turn off the localOnly option and for best results set mostRecent option to true.<br />
<pre><br />
<trace enabled="true" requestLimit="100" pageOutput="false" localOnly="false" mostRecent="true" /><br />
</pre><br />
* Save Web.config and if you followed the procedure properly then trace is now availble on your AbleCommerce powered store<br />
<br />
Trace should be disabled again once you have completed the troubleshooting.<br />
<br />
'''How to open Trace viewer?'''<br />
<br />
You need to open URL with following pattern in your browser<br />
<pre><br />
http://yourdomain/Trace.axd<br />
</pre><br />
for example<br />
<pre><br />
http://www.mydomain.tld/Trace.axd<br />
</pre><br />
<br />
When you open the Trace viewer you will see trace information for pages that have been recently accessed in your website.<br />
<br />
'''What is PayPal IPN Handler?'''<br />
<br />
PayPal IPN handler is a special callback page that's been called by PayPal to inform about different transactions. For example when some one uses Pay Now button to pay an order and fulfills the payment upon PayPal website. Then against that transaction PayPal sends the notification to IPN Handler with transaction data to give us a chance to update order data in our store depending upon the results of transaction made by customer.<br />
<br />
In AbleCommerce powered stores the URL of IPN Handler is<br />
<pre><br />
http://yourdomain/ProcessPayPal.ashx<br />
</pre><br />
<br />
'''How to debug PayPal IPN Handler?'''<br />
<br />
First of enable ASP.NET tracing as described above. Once tracing is available then better to put PayPal in sandbox environment by choosing sandbox option on PayPal gateway screen in AbleCommerce merchant side. You can test the PayPal in live mode too but sandbox is the preferred one because its specifically for testing purpose. All the payments stuff/card details etc would be for demo purpose nothing real. Then try checking out with some items in cart, upon payment step choose PayPal as payment method and checkout. Then it will take your receipt page where you will see Pay Now button. Before using the PayNow button it would be better to open the trace viewer and clear all previous records from it using clear option. Then use Pay Now button, complete the payment on PayPal website. Once you are done with payment then open the trace viewer. <br />
<br />
* If you see an entry in trace viewer for ProcessPayPal.ashx, then it means that PayPal is able to access your IPN Handler.<br />
* If you see transaction data information in page then it means that PayPal is successfully sending transaction information in IPN. You can use this information to confirm that certain information is available in IPN message or not.</div>Loganrhttp://wiki.ablecommerce.com/index.php/How_to_debug_PayPal_IPN_Handler_using_ASP.NET_TraceHow to debug PayPal IPN Handler using ASP.NET Trace2010-07-27T20:55:49Z<p>Loganr: Improve trace configuration</p>
<hr />
<div>'''What is ASP.NET Trace?'''<br />
<br />
ASP.NET tracing enables you to view diagnostic information about a single request for an ASP.NET page. ASP.NET tracing enables you to follow a page's execution path, display diagnostic information at run time, and debug your application. ASP.NET tracing can be integrated with system-level tracing to provide multiple levels of tracing output in distributed and multi-tier applications.<br />
<br />
'''How to enable ASP.NET Trace in AbleCommerce?'''<br />
<br />
* Edit your Website/Web.config file<br />
* Locate following element in it<br />
<pre><br />
<trace enabled="false" requestLimit="10" pageOutput="false" localOnly="true" /><br />
</pre><br />
and update its enabled property value to true like below. You will also want to turn off the localOnly option and for best results set mostRecent option to true.<br />
<pre><br />
<trace enabled="true" requestLimit="100" pageOutput="false" localOnly="false" mostRecent="true" /><br />
</pre><br />
* Save Web.config and if you followed the procedure properly then trace is now availble on your AbleCommerce powered store<br />
<br />
'''How to open Trace viewer?'''<br />
<br />
You need to open URL with following pattern in your browser<br />
<pre><br />
http://yourdomain/Trace.axd<br />
</pre><br />
for example<br />
<pre><br />
http://www.mydomain.tld/Trace.axd<br />
</pre><br />
<br />
When you open the Trace viewer you will see trace information for pages that have been recently accessed in your website.<br />
<br />
'''What is PayPal IPN Handler?'''<br />
<br />
PayPal IPN handler is a special callback page that's been called by PayPal to inform about different transactions. For example when some one uses Pay Now button to pay an order and fulfills the payment upon PayPal website. Then against that transaction PayPal sends the notification to IPN Handler with transaction data to give us a chance to update order data in our store depending upon the results of transaction made by customer.<br />
<br />
In AbleCommerce powered stores the URL of IPN Handler is<br />
<pre><br />
http://yourdomain/ProcessPayPal.ashx<br />
</pre><br />
<br />
'''How to debug PayPal IPN Handler?'''<br />
<br />
First of enable ASP.NET tracing as described above. Once tracing is available then better to put PayPal in sandbox environment by choosing sandbox option on PayPal gateway screen in AbleCommerce merchant side. You can test the PayPal in live mode too but sandbox is the preferred one because its specifically for testing purpose. All the payments stuff/card details etc would be for demo purpose nothing real. Then try checking out with some items in cart, upon payment step choose PayPal as payment method and checkout. Then it will take your receipt page where you will see Pay Now button. Before using the PayNow button it would be better to open the trace viewer and clear all previous records from it using clear option. Then use Pay Now button, complete the payment on PayPal website. Once you are done with payment then open the trace viewer. <br />
<br />
* If you see an entry in trace viewer for ProcessPayPal.ashx, then it means that PayPal is able to access your IPN Handler.<br />
* If you see transaction data information in page then it means that PayPal is successfully sending transaction information in IPN. You can use this information to confirm that certain information is available in IPN message or not.</div>Loganrhttp://wiki.ablecommerce.com/index.php/URL_Rewrite_Provider_API_-_AC7URL Rewrite Provider API - AC72009-09-04T16:07:20Z<p>Loganr: update to note missing urlrewriter provider indicators</p>
<hr />
<div>From version 7.0.3 forward, AbleCommerce exposes the URL rewrite functions using a provider API. This allows you to override the default URL rewrite handling and implement your own custom rules.<br />
<br />
To create a custom rewriter, you must implement two interfaces from the CommerceBuilder.Catalog namespace: IUrlRewriter and IUrlGenerator. A sample project for both C# and VB is available [ftp://ftp.ablecommerce.com/dev/SampleProviders.zip here]. Inside you will find the source for the default URL rewriter and a skeleton class for creating your own custom provider. Be aware that to make the project compile, you must update the reference to the CommerceBuilder.dll file.<br />
<br />
When you compile your provider assembly, you must copy the created DLL to the bin folder of your AbleCommerce installation. Then you must activate it by manual modification of the App_Data/ablecommerce.config file. Out of the box, the file contains two lines like this at the bottom:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlRewriter" /><br />
<urlGenerator enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlGenerator" /><br />
</application><br />
</source><br />
<br />
You must update the provider attribute to point to your new class:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
<urlGenerator enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
</application><br />
</source><br />
<br />
After this change is made, it may be necessary to restart the web application for your custom rewriter to take effect. If you have upgraded from a pre-7.0.3 version, you may not have the urlRewriter and urlGenerator lines in your ablecommerce.config. This was noted in an optional post-upgrade step. If the lines are missing, simply add them just above the </application> line.</div>Loganrhttp://wiki.ablecommerce.com/index.php/URL_Rewrite_Provider_API_-_AC7URL Rewrite Provider API - AC72009-09-04T16:02:18Z<p>Loganr: </p>
<hr />
<div>From version 7.0.3 forward, AbleCommerce exposes the URL rewrite functions using a provider API. This allows you to override the default URL rewrite handling and implement your own custom rules.<br />
<br />
To create a custom rewriter, you must implement two interfaces from the CommerceBuilder.Catalog namespace: IUrlRewriter and IUrlGenerator. A sample project for both C# and VB is available [ftp://ftp.ablecommerce.com/dev/SampleProviders.zip here]. Inside you will find the source for the default URL rewriter and a skeleton class for creating your own custom provider. Be aware that to make the project compile, you must update the reference to the CommerceBuilder.dll file.<br />
<br />
When you compile your provider assembly, you must copy the created DLL to the bin folder of your AbleCommerce installation. Then you must activate it by manual modification of the App_Data/ablecommerce.config file. Out of the box, the file contains two lines like this at the bottom:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlRewriter" /><br />
<urlGenerator enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlGenerator" /><br />
</source><br />
<br />
You must update the provider attribute to point to your new class:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
<urlGenerator enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
</source><br />
<br />
After this change is made, it may be necessary to restart the web application for your custom rewriter to take effect.</div>Loganrhttp://wiki.ablecommerce.com/index.php/URL_Rewrite_Provider_API_-_AC7URL Rewrite Provider API - AC72009-09-04T16:01:21Z<p>Loganr: initial page content</p>
<hr />
<div>From version 7.0.3 forward, AbleCommerce exposes the URL rewrite functions using a provider API. This allows you to override the default URL rewrite handling and implement your own custom rules.<br />
<br />
To create a custom rewriter, you must implement two interfaces from the CommerceBuilder.Catalog namespace: IUrlRewriter and IUrlGenerator. A sample project for both C# and VB is available [ftp://ftp.ablecommerce.com/dev/SampleProviders.zip|here]. Inside you will find the source for the default URL rewriter and a skeleton class for creating your own custom provider. Be aware that to make the project compile, you must update the reference to the CommerceBuilder.dll file.<br />
<br />
When you compile your provider assembly, you must copy the created DLL to the bin folder of your AbleCommerce installation. Then you must activate it by manual modification of the App_Data/ablecommerce.config file. Out of the box, the file contains two lines like this at the bottom:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlRewriter" /><br />
<urlGenerator enabled="true" provider="CommerceBuilder.Catalog.DefaultUrlGenerator" /><br />
</source><br />
<br />
You must update the provider attribute to point to your new class:<br />
<br />
<source lang="xml"><br />
<urlRewriter enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
<urlGenerator enabled="true" provider="AbleCommerce.Samples.UrlRewriter.DefaultProvider, SampleUrlRewriter" /><br />
</source><br />
<br />
After this change is made, it may be necessary to restart the web application for your custom rewriter to take effect.</div>Loganrhttp://wiki.ablecommerce.com/index.php/CommerceBuilder_APICommerceBuilder API2009-09-04T15:49:08Z<p>Loganr: /* Topics */</p>
<hr />
<div>The CommerceBuilder API is a set of .NET classes that are used to build the ecommerce store front. They facilitate access to the database, enforcement of business rules and calculations, and order processing.<br />
<br />
A compiled [ftp://ftp.ablecommerce.com/evals/CommerceBuilder_7_Help.zip compiled help file] is available that gives detailed information on the classes and methods available. If you have the Vista operating system, be aware that there is a security feature that may prevent you from opening this file. After downloading, you should go to the file properties and unblock it.<br />
<br />
== Topics ==<br />
<br />
[[Data Access Layer]] (DAL)<br />
<br />
[[Custom Queries]] (Adding custom SQL to AbleCommerce .aspx pages)<br />
<br />
[[Integrating A Payment Gateway]] (Payment Provider API)<br />
<br />
[[Integrating A Shipping Carrier]] (Shipping Provider API)<br />
<br />
[[Integrating A Tax Provider]] (Tax Provider API)<br />
<br />
[[Creating Digital Delivery Licensing Module]] (Serial Key Provider API)<br />
<br />
[[Creating A Custom Feed Provider]] (Feed Provider API)<br />
<br />
[[URL Rewrite Provider API]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Integrating_A_Tax_ProviderIntegrating A Tax Provider2009-09-02T15:44:18Z<p>Loganr: update deployment instructions for new 7.0.3 interface</p>
<hr />
<div>== Sample Provider ==<br />
To integrate a tax provider with Ablecommerce 7 you must implement '''CommerceBuilder.Taxes.Providers.ITaxProvider''' interface. This interface defines how tax providers interact with Ablecommerce. This should be done by extending the TaxProviderBase class. Below is a sample code to get you started. All you need to do is create a new windows class library solution, paste this code into a new class, and set a reference to the CommerceBuilder.DLL file. Once you have the solution set up, you must implement the properties and methods for your specific provider.<br />
<br />
<source lang="csharp"><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using CommerceBuilder.Common;<br />
using CommerceBuilder.Orders;<br />
using CommerceBuilder.Taxes.Providers;<br />
<br />
namespace SampleTaxProvider<br />
{<br />
public class TaxProvider : TaxProviderBase<br />
{<br />
#region Properties<br />
/// <summary><br />
/// The name of the tax provider implementation<br />
/// </summary><br />
public override string Name<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// The version of the tax provider implementation<br />
/// </summary><br />
public override string Version<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// Is the tax provider activated or not<br />
/// </summary><br />
public override bool Activated<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
#endregion<br />
<br />
/// <summary><br />
/// Initialize the tax provider with the given configuration data. Called by AC at the time of initialization.<br />
/// </summary><br />
/// <param name="taxGatewayId">The tax gateway id</param><br />
/// <param name="configurationData">Configuration data in the form of name value paris</param><br />
public override void Initialize(int taxGatewayId, Dictionary<string, string> configurationData)<br />
{<br />
base.Initialize(taxGatewayId, configurationData);<br />
}<br />
<br />
/// <summary><br />
/// Calculate the taxes using this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket to calculate tax for</param><br />
/// <returns>Total tax calculated</returns><br />
public override LSDecimal Calculate(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Cancel the taxes by this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket for which to cancel the taxes</param><br />
public override void Cancel(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Commit the taxes by this provider for the given order<br />
/// </summary><br />
/// <param name="order">The order for which to commit the taxes</param><br />
public override void Commit(Order order)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
}<br />
}<br />
</source><br />
<br />
== Method Overview ==<br />
When you extend TaxProviderBase class you need to implement the abstract methods and properties defined in this class. Some of the properties and methods are for information purposes only and are easy to implement. For example '''Name''' and '''Version'''.<br />
<br />
The important methods to implement are '''Calculate''', '''Commit''' and '''Cancel'''.<br />
<br />
=== Calculate ===<br />
This method takes a basket object as input. From there, you can get the billing and shipping addresses as well as line items. What you need to do is determine the tax to charge - then add line items to the basket (BasketItem class) for each line item. The method returns the total tax that was added to the basket. <br />
<br />
=== Commit ===<br />
This method takes an order object as input and commits any taxes that were charged. This may not be required by your integration. Some providers may need to know what taxes were actually charged in order to produce accurate reports on tax liability. <br />
<br />
=== Cancel ===<br />
This method takes a basket object as input. When called, it cancels any tax charges currently in progress. Your integration may or may not require this. Some providers may use this to reset the calculations for a particular order in progress.<br />
<br />
== Deployment ==<br />
=== 7.0.3 and higher ===<br />
Once your class is compiled, place it into the bin folder of the AbleCommerce installation. Then log into the merchant admin and go to Configure -> Taxes -> Third Party Providers. If your provider is properly installed, it should show on this screen with an option to activate it for your store.<br />
=== 7.0.2 and lower ===<br />
In these versions, there is no graphic interface for registering a third party tax provider. In order to connect your provider you must add a record to the database in the '''ac_TaxGateways''' table:<br />
<br/>''TaxGatewayId'' = auto number ID<br />
<br/>''StoreId'' = ID of your store, probably 1<br />
<br/>''Name'' = Name of your gateway<br />
<br/>''ClassId'' = .NET Class ID used to create an instance of your gateway. The class ID should follow the format of class name, assembly. For example: ''MyNamespace.SampleProvider, SampleProvider.dll''.<br />
<br/>''ConfigData'' = If you need to provide configuration data it can be stored here in a url encoded string. For example, key1=value&key2=value. The values in the field will be accessible in your integration by using the GetConfigData() method. If you are producing an integration that will not be distributed to others, it would be simpler to hardcode any needed configuration in your provider implementation.<br />
== Resources ==<br />
* [http://forums.ablecommerce.com/viewtopic.php?f=42&t=5935 Community Forums Discussion]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Integrating_A_Tax_ProviderIntegrating A Tax Provider2009-09-02T15:38:47Z<p>Loganr: /* Implementing Required Methods */</p>
<hr />
<div>== Sample Provider ==<br />
To integrate a tax provider with Ablecommerce 7 you must implement '''CommerceBuilder.Taxes.Providers.ITaxProvider''' interface. This interface defines how tax providers interact with Ablecommerce. This should be done by extending the TaxProviderBase class. Below is a sample code to get you started. All you need to do is create a new windows class library solution, paste this code into a new class, and set a reference to the CommerceBuilder.DLL file. Once you have the solution set up, you must implement the properties and methods for your specific provider.<br />
<br />
<source lang="csharp"><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using CommerceBuilder.Common;<br />
using CommerceBuilder.Orders;<br />
using CommerceBuilder.Taxes.Providers;<br />
<br />
namespace SampleTaxProvider<br />
{<br />
public class TaxProvider : TaxProviderBase<br />
{<br />
#region Properties<br />
/// <summary><br />
/// The name of the tax provider implementation<br />
/// </summary><br />
public override string Name<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// The version of the tax provider implementation<br />
/// </summary><br />
public override string Version<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// Is the tax provider activated or not<br />
/// </summary><br />
public override bool Activated<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
#endregion<br />
<br />
/// <summary><br />
/// Initialize the tax provider with the given configuration data. Called by AC at the time of initialization.<br />
/// </summary><br />
/// <param name="taxGatewayId">The tax gateway id</param><br />
/// <param name="configurationData">Configuration data in the form of name value paris</param><br />
public override void Initialize(int taxGatewayId, Dictionary<string, string> configurationData)<br />
{<br />
base.Initialize(taxGatewayId, configurationData);<br />
}<br />
<br />
/// <summary><br />
/// Calculate the taxes using this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket to calculate tax for</param><br />
/// <returns>Total tax calculated</returns><br />
public override LSDecimal Calculate(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Cancel the taxes by this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket for which to cancel the taxes</param><br />
public override void Cancel(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Commit the taxes by this provider for the given order<br />
/// </summary><br />
/// <param name="order">The order for which to commit the taxes</param><br />
public override void Commit(Order order)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
}<br />
}<br />
</source><br />
<br />
== Method Overview ==<br />
When you extend TaxProviderBase class you need to implement the abstract methods and properties defined in this class. Some of the properties and methods are for information purposes only and are easy to implement. For example '''Name''' and '''Version'''.<br />
<br />
The important methods to implement are '''Calculate''', '''Commit''' and '''Cancel'''.<br />
<br />
=== Calculate ===<br />
This method takes a basket object as input. From there, you can get the billing and shipping addresses as well as line items. What you need to do is determine the tax to charge - then add line items to the basket (BasketItem class) for each line item. The method returns the total tax that was added to the basket. <br />
<br />
=== Commit ===<br />
This method takes an order object as input and commits any taxes that were charged. This may not be required by your integration. Some providers may need to know what taxes were actually charged in order to produce accurate reports on tax liability. <br />
<br />
=== Cancel ===<br />
This method takes a basket object as input. When called, it cancels any tax charges currently in progress. Your integration may or may not require this. Some providers may use this to reset the calculations for a particular order in progress.<br />
<br />
== Deployment ==<br />
Once your class is implemented and compiled, you need to register it with the store. Since we did not include our tax providers, there is no web based interface to do this yet. The simplest choice, if available, is to add a record to the database in the '''ac_TaxGateways''' table:<br />
<br/>''TaxGatewayId'' = auto number ID<br />
<br/>''StoreId'' = ID of your store, probably 1<br />
<br/>''Name'' = Name of your gateway<br />
<br/>''ClassId'' = .NET Class ID used to create an instance of your gateway. For examples, you can look in ac_PaymentGateways (assuming you have a gateway configured).<br />
<br/>''ConfigData'' = If you need to provide configuration data it can be stored here in a url encoded string. For example, key1=value&key2=value. The values in the field will be accessible in your integration by using the GetConfigData() method. If you are producing an integration only for yourselves, you don't need to worry about this as any configuration should be hard coded instead.<br />
<br />
== Resources ==<br />
* [http://forums.ablecommerce.com/viewtopic.php?f=42&t=5935 Community Forums Discussion]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Integrating_A_Tax_ProviderIntegrating A Tax Provider2009-09-02T15:37:05Z<p>Loganr: /* Sample Provider */</p>
<hr />
<div>== Sample Provider ==<br />
To integrate a tax provider with Ablecommerce 7 you must implement '''CommerceBuilder.Taxes.Providers.ITaxProvider''' interface. This interface defines how tax providers interact with Ablecommerce. This should be done by extending the TaxProviderBase class. Below is a sample code to get you started. All you need to do is create a new windows class library solution, paste this code into a new class, and set a reference to the CommerceBuilder.DLL file. Once you have the solution set up, you must implement the properties and methods for your specific provider.<br />
<br />
<source lang="csharp"><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using CommerceBuilder.Common;<br />
using CommerceBuilder.Orders;<br />
using CommerceBuilder.Taxes.Providers;<br />
<br />
namespace SampleTaxProvider<br />
{<br />
public class TaxProvider : TaxProviderBase<br />
{<br />
#region Properties<br />
/// <summary><br />
/// The name of the tax provider implementation<br />
/// </summary><br />
public override string Name<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// The version of the tax provider implementation<br />
/// </summary><br />
public override string Version<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// Is the tax provider activated or not<br />
/// </summary><br />
public override bool Activated<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
#endregion<br />
<br />
/// <summary><br />
/// Initialize the tax provider with the given configuration data. Called by AC at the time of initialization.<br />
/// </summary><br />
/// <param name="taxGatewayId">The tax gateway id</param><br />
/// <param name="configurationData">Configuration data in the form of name value paris</param><br />
public override void Initialize(int taxGatewayId, Dictionary<string, string> configurationData)<br />
{<br />
base.Initialize(taxGatewayId, configurationData);<br />
}<br />
<br />
/// <summary><br />
/// Calculate the taxes using this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket to calculate tax for</param><br />
/// <returns>Total tax calculated</returns><br />
public override LSDecimal Calculate(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Cancel the taxes by this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket for which to cancel the taxes</param><br />
public override void Cancel(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Commit the taxes by this provider for the given order<br />
/// </summary><br />
/// <param name="order">The order for which to commit the taxes</param><br />
public override void Commit(Order order)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
}<br />
}<br />
</source><br />
<br />
== Implementing Required Methods ==<br />
When you extend TaxProviderBase class you need to implement the abstract methods and properties defined in this class. Some of the properties and methods are for information purposes only and are easy to implement. For example '''Name''' and '''Version'''.<br />
<br />
The important methods to implement are '''Calculate''', '''Commit''' and '''Cancel'''.<br />
<br />
=== Calculate ===<br />
This method takes a basket object as input. From there, you can get the billing and shipping addresses as well as line items. What you need to do is determine the tax to charge - then add line items to the basket (BasketItem class) for each line item. The method returns the total tax that was added to the basket. <br />
<br />
=== Commit ===<br />
This method takes an order object as input and commits any taxes that were charged. This may not be required by your integration. Some providers may need to know what taxes were actually charged in order to produce accurate reports on tax liability. <br />
<br />
=== Cancel ===<br />
This method takes a basket object as input. When called, it cancels any tax charges currently in progress. Your integration may or may not require this. Some providers may use this to reset the calculations for a particular order in progress.<br />
<br />
<br />
== Deployment ==<br />
Once your class is implemented and compiled, you need to register it with the store. Since we did not include our tax providers, there is no web based interface to do this yet. The simplest choice, if available, is to add a record to the database in the '''ac_TaxGateways''' table:<br />
<br/>''TaxGatewayId'' = auto number ID<br />
<br/>''StoreId'' = ID of your store, probably 1<br />
<br/>''Name'' = Name of your gateway<br />
<br/>''ClassId'' = .NET Class ID used to create an instance of your gateway. For examples, you can look in ac_PaymentGateways (assuming you have a gateway configured).<br />
<br/>''ConfigData'' = If you need to provide configuration data it can be stored here in a url encoded string. For example, key1=value&key2=value. The values in the field will be accessible in your integration by using the GetConfigData() method. If you are producing an integration only for yourselves, you don't need to worry about this as any configuration should be hard coded instead.<br />
<br />
== Resources ==<br />
* [http://forums.ablecommerce.com/viewtopic.php?f=42&t=5935 Community Forums Discussion]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Integrating_A_Tax_ProviderIntegrating A Tax Provider2009-09-02T15:35:54Z<p>Loganr: replace code tag with source tag</p>
<hr />
<div>== Sample Provider ==<br />
To integrate a tax provider with Ablecommerce 7 you must implement '''CommerceBuilder.Taxes.Providers.ITaxProvider''' interface. This interface defines how tax providers interact with Ablecommerce. This should be done by extending the TaxProviderBase class. Below is a sample code to get you started.<br />
<br />
<source lang="csharp"><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using CommerceBuilder.Common;<br />
using CommerceBuilder.Orders;<br />
using CommerceBuilder.Taxes.Providers;<br />
<br />
namespace SampleTaxProvider<br />
{<br />
public class TaxProvider : TaxProviderBase<br />
{<br />
#region Properties<br />
/// <summary><br />
/// The name of the tax provider implementation<br />
/// </summary><br />
public override string Name<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// The version of the tax provider implementation<br />
/// </summary><br />
public override string Version<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// Is the tax provider activated or not<br />
/// </summary><br />
public override bool Activated<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
#endregion<br />
<br />
/// <summary><br />
/// Initialize the tax provider with the given configuration data. Called by AC at the time of initialization.<br />
/// </summary><br />
/// <param name="taxGatewayId">The tax gateway id</param><br />
/// <param name="configurationData">Configuration data in the form of name value paris</param><br />
public override void Initialize(int taxGatewayId, Dictionary<string, string> configurationData)<br />
{<br />
base.Initialize(taxGatewayId, configurationData);<br />
}<br />
<br />
/// <summary><br />
/// Calculate the taxes using this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket to calculate tax for</param><br />
/// <returns>Total tax calculated</returns><br />
public override LSDecimal Calculate(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Cancel the taxes by this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket for which to cancel the taxes</param><br />
public override void Cancel(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Commit the taxes by this provider for the given order<br />
/// </summary><br />
/// <param name="order">The order for which to commit the taxes</param><br />
public override void Commit(Order order)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
}<br />
}<br />
</source><br />
<br />
== Implementing Required Methods ==<br />
When you extend TaxProviderBase class you need to implement the abstract methods and properties defined in this class. Some of the properties and methods are for information purposes only and are easy to implement. For example '''Name''' and '''Version'''.<br />
<br />
The important methods to implement are '''Calculate''', '''Commit''' and '''Cancel'''.<br />
<br />
=== Calculate ===<br />
This method takes a basket object as input. From there, you can get the billing and shipping addresses as well as line items. What you need to do is determine the tax to charge - then add line items to the basket (BasketItem class) for each line item. The method returns the total tax that was added to the basket. <br />
<br />
=== Commit ===<br />
This method takes an order object as input and commits any taxes that were charged. This may not be required by your integration. Some providers may need to know what taxes were actually charged in order to produce accurate reports on tax liability. <br />
<br />
=== Cancel ===<br />
This method takes a basket object as input. When called, it cancels any tax charges currently in progress. Your integration may or may not require this. Some providers may use this to reset the calculations for a particular order in progress.<br />
<br />
<br />
== Deployment ==<br />
Once your class is implemented and compiled, you need to register it with the store. Since we did not include our tax providers, there is no web based interface to do this yet. The simplest choice, if available, is to add a record to the database in the '''ac_TaxGateways''' table:<br />
<br/>''TaxGatewayId'' = auto number ID<br />
<br/>''StoreId'' = ID of your store, probably 1<br />
<br/>''Name'' = Name of your gateway<br />
<br/>''ClassId'' = .NET Class ID used to create an instance of your gateway. For examples, you can look in ac_PaymentGateways (assuming you have a gateway configured).<br />
<br/>''ConfigData'' = If you need to provide configuration data it can be stored here in a url encoded string. For example, key1=value&key2=value. The values in the field will be accessible in your integration by using the GetConfigData() method. If you are producing an integration only for yourselves, you don't need to worry about this as any configuration should be hard coded instead.<br />
<br />
== Resources ==<br />
* [http://forums.ablecommerce.com/viewtopic.php?f=42&t=5935 Community Forums Discussion]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Integrating_A_Tax_ProviderIntegrating A Tax Provider2009-09-02T15:34:33Z<p>Loganr: remove definitions for itaxprovider and taxproviderbase, replace with a skeleton code class suitable for customer extension</p>
<hr />
<div>== Sample Provider ==<br />
To integrate a tax provider with Ablecommerce 7 you must implement '''CommerceBuilder.Taxes.Providers.ITaxProvider''' interface. This interface defines how tax providers interact with Ablecommerce. This should be done by extending the TaxProviderBase class. Below is a sample code to get you started.<br />
<br />
<code lang="csharp"><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using CommerceBuilder.Common;<br />
using CommerceBuilder.Orders;<br />
using CommerceBuilder.Taxes.Providers;<br />
<br />
namespace SampleTaxProvider<br />
{<br />
public class TaxProvider : TaxProviderBase<br />
{<br />
#region Properties<br />
/// <summary><br />
/// The name of the tax provider implementation<br />
/// </summary><br />
public override string Name<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// The version of the tax provider implementation<br />
/// </summary><br />
public override string Version<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
<br />
/// <summary><br />
/// Is the tax provider activated or not<br />
/// </summary><br />
public override bool Activated<br />
{<br />
get { throw new Exception("The method or operation is not implemented."); }<br />
}<br />
#endregion<br />
<br />
/// <summary><br />
/// Initialize the tax provider with the given configuration data. Called by AC at the time of initialization.<br />
/// </summary><br />
/// <param name="taxGatewayId">The tax gateway id</param><br />
/// <param name="configurationData">Configuration data in the form of name value paris</param><br />
public override void Initialize(int taxGatewayId, Dictionary<string, string> configurationData)<br />
{<br />
base.Initialize(taxGatewayId, configurationData);<br />
}<br />
<br />
/// <summary><br />
/// Calculate the taxes using this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket to calculate tax for</param><br />
/// <returns>Total tax calculated</returns><br />
public override LSDecimal Calculate(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Cancel the taxes by this provider for the given basket<br />
/// </summary><br />
/// <param name="basket">The basket for which to cancel the taxes</param><br />
public override void Cancel(Basket basket)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
/// <summary><br />
/// Commit the taxes by this provider for the given order<br />
/// </summary><br />
/// <param name="order">The order for which to commit the taxes</param><br />
public override void Commit(Order order)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
}<br />
}<br />
</code><br />
<br />
== Implementing Required Methods ==<br />
When you extend TaxProviderBase class you need to implement the abstract methods and properties defined in this class. Some of the properties and methods are for information purposes only and are easy to implement. For example '''Name''' and '''Version'''.<br />
<br />
The important methods to implement are '''Calculate''', '''Commit''' and '''Cancel'''.<br />
<br />
=== Calculate ===<br />
This method takes a basket object as input. From there, you can get the billing and shipping addresses as well as line items. What you need to do is determine the tax to charge - then add line items to the basket (BasketItem class) for each line item. The method returns the total tax that was added to the basket. <br />
<br />
=== Commit ===<br />
This method takes an order object as input and commits any taxes that were charged. This may not be required by your integration. Some providers may need to know what taxes were actually charged in order to produce accurate reports on tax liability. <br />
<br />
=== Cancel ===<br />
This method takes a basket object as input. When called, it cancels any tax charges currently in progress. Your integration may or may not require this. Some providers may use this to reset the calculations for a particular order in progress.<br />
<br />
<br />
== Deployment ==<br />
Once your class is implemented and compiled, you need to register it with the store. Since we did not include our tax providers, there is no web based interface to do this yet. The simplest choice, if available, is to add a record to the database in the '''ac_TaxGateways''' table:<br />
<br/>''TaxGatewayId'' = auto number ID<br />
<br/>''StoreId'' = ID of your store, probably 1<br />
<br/>''Name'' = Name of your gateway<br />
<br/>''ClassId'' = .NET Class ID used to create an instance of your gateway. For examples, you can look in ac_PaymentGateways (assuming you have a gateway configured).<br />
<br/>''ConfigData'' = If you need to provide configuration data it can be stored here in a url encoded string. For example, key1=value&key2=value. The values in the field will be accessible in your integration by using the GetConfigData() method. If you are producing an integration only for yourselves, you don't need to worry about this as any configuration should be hard coded instead.<br />
<br />
== Resources ==<br />
* [http://forums.ablecommerce.com/viewtopic.php?f=42&t=5935 Community Forums Discussion]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Merchant_User_GuideMerchant User Guide2009-08-27T15:49:01Z<p>Loganr: Add manage subscriptions link</p>
<hr />
<div>The official merchant user guide is published at http://help.ablecommerce.com. The information here may be provided by the community and should be considered supplemental.<br />
<br />
== Installation ==<br />
* [[Setting the Machine Key]]<br />
* [[Database Schema Upgrade]]<br />
<br />
== Manage ==<br />
* [[Manage Subscriptions]]<br />
<br />
== Configure -> Regions ==<br />
* [[Postal Code Filter Pattern Matching]]<br />
<br />
== Configure -> Email ==<br />
* [[Email Templates]]<br />
<br />
== Help ==<br />
* [[Error Log]]<br />
* [[Merchant Password Recovery]]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:44:35Z<p>Loganr: note on why to change</p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field. The changes are intended to make the database use more efficient storage mechanisms and have better performance overall.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br /><br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
# Create a folder named "Install" in the AbleCommerce installation location<br />
# Place the files for the upgrade schema script<br />
# Manually access the upgrade script (<nowiki>http://your_url/Install/UpgradeSchema.aspx</nowiki>)<br />
# MAKE A BACKUP OF YOUR DATABASE<br />
# Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Backup ==<br />
This upgrade involves major alteration to the structures of your tables. Use SQL Management Studio to make a full backup of your database prior to executing the schema upgrade. If you do not make a backup, you will have no way to recover in the event of an unexpected problem. It is NOT an optional step.<br />
<br />
== Script Locations ==<br />
[http://bugs.ablecommerce.com/attachment.cgi?id=2256 Upgrade Script for AC703]<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.<br />
<br />
== External References ==<br />
[http://bugs.ablecommerce.com/show_bug.cgi?id=7924 Bug 7924: Database Schema Upgrade Script should recognize and adjust to SQL versions]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:42:43Z<p>Loganr: more backup warning</p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br /><br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
# Create a folder named "Install" in the AbleCommerce installation location<br />
# Place the files for the upgrade schema script<br />
# Manually access the upgrade script (<nowiki>http://your_url/Install/UpgradeSchema.aspx</nowiki>)<br />
# MAKE A BACKUP OF YOUR DATABASE<br />
# Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Backup ==<br />
This upgrade involves major alteration to the structures of your tables. Use SQL Management Studio to make a full backup of your database prior to executing the schema upgrade. If you do not make a backup, you will have no way to recover in the event of an unexpected problem. It is NOT an optional step.<br />
<br />
== Script Locations ==<br />
[http://bugs.ablecommerce.com/attachment.cgi?id=2256 Upgrade Script for AC703]<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.<br />
<br />
== External References ==<br />
[http://bugs.ablecommerce.com/show_bug.cgi?id=7924 Bug 7924: Database Schema Upgrade Script should recognize and adjust to SQL versions]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:39:16Z<p>Loganr: add to merchant user guide category</p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br /><br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
# Create a folder named "Install" in the AbleCommerce installation location<br />
# Place the files for the upgrade schema script<br />
# Manually access the upgrade script (<nowiki>http://your_url/Install/UpgradeSchema.aspx</nowiki>)<br />
# MAKE A BACKUP OF YOUR DATABASE<br />
# Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Script Locations ==<br />
[http://bugs.ablecommerce.com/attachment.cgi?id=2256 Upgrade Script for AC703]<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.<br />
<br />
== External References ==<br />
[http://bugs.ablecommerce.com/show_bug.cgi?id=7924 Bug 7924: Database Schema Upgrade Script should recognize and adjust to SQL versions]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:38:12Z<p>Loganr: add link to bug</p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br /><br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
# Create a folder named "Install" in the AbleCommerce installation location<br />
# Place the files for the upgrade schema script<br />
# Manually access the upgrade script (<nowiki>http://your_url/Install/UpgradeSchema.aspx</nowiki>)<br />
# MAKE A BACKUP OF YOUR DATABASE<br />
# Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Script Locations ==<br />
[http://bugs.ablecommerce.com/attachment.cgi?id=2256 Upgrade Script for AC703]<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.<br />
<br />
== External References ==<br />
[http://bugs.ablecommerce.com/show_bug.cgi?id=7924 Bug 7924: Database Schema Upgrade Script should recognize and adjust to SQL versions]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:35:40Z<p>Loganr: </p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
# Create a folder named "Install" in the AbleCommerce installation location<br />
# Place the files for the upgrade schema script<br />
# Manually access the upgrade script (<nowiki>http://yoururl/Install/UpgradeSchema.aspx</nowiki>)<br />
# MAKE A BACKUP OF YOUR DATABASE<br />
# Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Script Locations ==<br />
Upgrade Script for AC703: http://bugs.ablecommerce.com/attachment.cgi?id=2256<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.</div>Loganrhttp://wiki.ablecommerce.com/index.php/Database_Schema_UpgradeDatabase Schema Upgrade2009-08-18T18:34:35Z<p>Loganr: initial content, upgrade schema steps</p>
<hr />
<div>If you originally install AbleCommerce using SQL Server 2000 and later upgrade your database platform to SQL Server 2005 or later, you may need to upgrade your database schema. This upgrade is to convert database structures that take advantage of newer features in SQL Server, such as the nvarchar(max) field.<br />
<br />
Schema upgrade scripts are only available for AC7.0.3 and later. To see whether you require a schema upgrade, go to the Help -> About page in your merchant menu. In the version listing, the version of SQL Server and the version of the AC schema are listed:<br />
<br />
<blockquote>MSSQL v2005<br />
AC SCHEMA v2000</blockquote><br />
<br />
This would be an example of an installation that should proceed with the schema upgrade. Note that SQL Server is 2005, while the schema remains at 2000 level. To bring AC SCHEMA up to the 2005 level, follow the steps below:<br />
<br />
1) Create a folder named "Install" in the AbleCommerce installation location<br />
2) Place the files for the upgrade schema script<br />
3) Manually access the upgrade script (<pre>http://yoururl/Install/UpgradeSchema.aspx</pre>)<br />
4) MAKE A BACKUP OF YOUR DATABASE<br />
5) Confirm the backup and submit the request to upgrade the schema<br />
<br />
== Script Locations ==<br />
Upgrade Script for AC703: http://bugs.ablecommerce.com/attachment.cgi?id=2256<br />
<br />
Upgrade scripts are also included with the full distribution in the "Install" folder.</div>Loganrhttp://wiki.ablecommerce.com/index.php/Merchant_User_GuideMerchant User Guide2009-08-18T18:20:36Z<p>Loganr: Document database schema upgrade</p>
<hr />
<div>The official merchant user guide is published at http://help.ablecommerce.com. The information here may be provided by the community and should be considered supplemental.<br />
<br />
== Installation ==<br />
* [[Setting the Machine Key]]<br />
* [[Database Schema Upgrade]]<br />
<br />
== Configure -> Regions ==<br />
* [[Postal Code Filter Pattern Matching]]<br />
<br />
== Configure -> Email ==<br />
* [[Email Templates]]<br />
<br />
== Help ==<br />
* [[Error Log]]<br />
* [[Merchant Password Recovery]]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Setting_the_Machine_KeySetting the Machine Key2009-08-18T14:09:35Z<p>Loganr: add to merchant user guide category</p>
<hr />
<div>Sometimes when using ASP.NET enabled website you may get the following error<br />
<br />
'''Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.'''<br />
<br />
There are several ways to get around this problem:<br />
<br />
* Host your site on a server that never restarts or recycles! Obviously, this is impossible!<br />
<br />
* Disable ViewstateMac by putting this '''enableViewStateMac="false"''' in your web.config. This approach is not 100% secure.<br />
<br />
* Configure ASP.NET to not use Auto-Generated Key but rather a '''predefined key'''. This is the preferred method.<br />
<br />
The last option, using predefined key, is the most secure and suggested method to use. There is a free Machine Key generator tool available at the following link<br />
<br />
http://aspnetresources.com/tools/keycreator.aspx<br />
<br />
In order to generate the key using this tool leave the defaults in place; validation key length 64, encryption key length 24, type sha1. Then click Generate to create a random machine key for you and copy the result.<br />
<br />
Now open the web.config file from your site. Find around line which shows<br />
'''<system.web>''' And paste in the '''<machineKey ... />''' on the next line. <br />
Save the web.config file.<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Setting_the_Machine_KeySetting the Machine Key2009-08-18T14:08:22Z<p>Loganr: How to solve Validation of View State MAC failed problem moved to Setting the Machine Key: Setting the machine key solves a range of problems, including but not limited to ViewState MAC validation errors.</p>
<hr />
<div>Sometimes when using ASP.NET enabled website you may get the following error<br />
<br />
'''Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.'''<br />
<br />
There are several ways to get around this problem:<br />
<br />
* Host your site on a server that never restarts or recycles! Obviously, this is impossible!<br />
<br />
* Disable ViewstateMac by putting this '''enableViewStateMac="false"''' in your web.config. This approach is not 100% secure.<br />
<br />
* Configure ASP.NET to not use Auto-Generated Key but rather a '''predefined key'''. This is the preferred method.<br />
<br />
The last option, using predefined key, is the most secure and suggested method to use. There is a free Machine Key generator tool available at the following link<br />
<br />
http://aspnetresources.com/tools/keycreator.aspx<br />
<br />
In order to generate the key using this tool leave the defaults in place; validation key length 64, encryption key length 24, type sha1. Then click Generate to create a random machine key for you and copy the result.<br />
<br />
Now open the web.config file from your site. Find around line which shows<br />
'''<system.web>''' And paste in the '''<machineKey ... />''' on the next line. <br />
Save the web.config file.</div>Loganrhttp://wiki.ablecommerce.com/index.php/How_to_solve_Validation_of_View_State_MAC_failed_problemHow to solve Validation of View State MAC failed problem2009-08-18T14:08:22Z<p>Loganr: How to solve Validation of View State MAC failed problem moved to Setting the Machine Key: Setting the machine key solves a range of problems, including but not limited to ViewState MAC validation errors.</p>
<hr />
<div>#REDIRECT [[Setting the Machine Key]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Merchant_User_GuideMerchant User Guide2009-08-18T14:07:07Z<p>Loganr: Adding a page for machine key</p>
<hr />
<div>The official merchant user guide is published at http://help.ablecommerce.com. The information here may be provided by the community and should be considered supplemental.<br />
<br />
== Installation ==<br />
* [[Setting the Machine Key]]<br />
<br />
== Configure -> Regions ==<br />
* [[Postal Code Filter Pattern Matching]]<br />
<br />
== Configure -> Email ==<br />
* [[Email Templates]]<br />
<br />
== Help ==<br />
* [[Error Log]]<br />
* [[Merchant Password Recovery]]<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:39:42Z<p>Loganr: </p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. By using special script and formatting codes, templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
<pre><br />
Current exchange rates for currencies:<br />
<br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* ... *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre><br />
<br />
== Licensing ==<br />
NVelocity is distributed under the Apache License, version 1.1. AbleCommerce links to a modified version of the Castle fork of NVelocity. The modification is made from Castle's 5837 SVN revision, and is limited to adding the AllowPartiallyTrustedCallers attribute to the library. This allows the portions of the library used by AbleCommerce to work in partially trusted ASPNET environments. Our modified version of the NVelocity source code is available for download from our ftp site at ftp://ftp.ablecommerce.com/thirdparty.<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:38:54Z<p>Loganr: Add licensing details</p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. The source originates from the project fork maintained by the [http://www.castleproject.org/others/nvelocity/index.html Castle project].<br />
<br />
By using special script and formatting codes, NVelocity templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
<pre><br />
Current exchange rates for currencies:<br />
<br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* ... *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre><br />
<br />
== Licensing ==<br />
NVelocity is distributed under the Apache License, version 1.1. AbleCommerce links to a modified version of the Castle fork of NVelocity. The modification is made from Castle's 5837 SVN revision, and is limited to adding the AllowPartiallyTrustedCallers attribute to the library. This allows the portions of the library used by AbleCommerce to work in partially trusted ASPNET environments. Our modified version of the NVelocity source code is available for download from our ftp site at ftp://ftp.ablecommerce.com/thirdparty.<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:21:40Z<p>Loganr: add to merchant user guide category</p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. The source originates from the project fork maintained by the [http://www.castleproject.org/others/nvelocity/index.html Castle project].<br />
<br />
By using special script and formatting codes, NVelocity templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
<pre><br />
Current exchange rates for currencies:<br />
<br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* ... *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre><br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/Email_TemplatesEmail Templates2009-07-24T21:06:35Z<p>Loganr: add to merchant user guide category</p>
<hr />
<div>AbleCommerce email templates makes for a flexible and simple way for merchants to customize the messages generated by the store.<br />
<br />
The email system makes use of [[NVelocity]], allowing you to create messages with dynamic content. For example you may wish to include a customers name or an order amount. Different categories of emails have support for various [[NVelocity Email Variables|variables]] that you can use within your template.<br />
<br />
[[Category:Merchant User Guide]]</div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:05:36Z<p>Loganr: /* Looping */</p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. The source originates from the project fork maintained by the [http://www.castleproject.org/others/nvelocity/index.html Castle project].<br />
<br />
By using special script and formatting codes, NVelocity templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
<pre><br />
Current exchange rates for currencies:<br />
<br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* ... *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre></div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:05:13Z<p>Loganr: /* Including Comments */</p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. The source originates from the project fork maintained by the [http://www.castleproject.org/others/nvelocity/index.html Castle project].<br />
<br />
By using special script and formatting codes, NVelocity templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
Current exchange rates for currencies:<br />
<br />
<pre><br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* ... *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre></div>Loganrhttp://wiki.ablecommerce.com/index.php/NVelocityNVelocity2009-07-24T21:04:46Z<p>Loganr: </p>
<hr />
<div>NVelocity is an open source templating engine employed by AbleCommerce to accomplish certain features - most notably the [[Email Templates|email template]] system. The source originates from the project fork maintained by the [http://www.castleproject.org/others/nvelocity/index.html Castle project].<br />
<br />
By using special script and formatting codes, NVelocity templates can be processed to include dynamic content. Below is an overview of some of the most basic syntax for editing email templates.<br />
<br />
== Variable Substitution ==<br />
<br />
Variables are indicated by a dollar sign, and may be enclosed in curly braces. Variables can appear anywhere within the template. <br />
<br />
Standard Syntax: $variable_name<br />
<br />
<pre>Hello $user.PrimaryAddress.FirstName!</pre><br />
<br />
Explicit Syntax: ${variable_name}<br />
<br />
<pre>Hello ${user.PrimaryAddress.FirstName}!</pre><br />
<br />
Standard syntax cannot be used if your variable is part of a larger string where the variable name would not be clearly defined. Below shows an example of incorrect use of the standard syntax, where explicit syntax must be used instead:<br />
<br />
Incorrect with Standard syntax:<br />
<br />
<pre>some_text$variable_namesome_more_text</pre><br />
<br />
Correct with Explicit syntax:<br />
<br />
<pre>some_text${variable_name}some_more_text</pre><br />
<br />
When you reference variables you are accessing the object through the .NET framework. You can use traditional .NET syntax to access properties and methods. A common example might be to provide string formats:<br />
<br />
<pre>$user.LastLoginDate.ToString("mm-ddd-yyyy")</pre><br />
<br />
== nVelocity Scripting ==<br />
<br />
With the nVelocity scripting language you can implement conditional logic and looping to create dynamic output. Any line that begins with a # pound sign is interpreted as a line of script.<br />
<br />
===Conditional Statements===<br />
<br />
You can employ conditional logic in your email templates with the if-end statement. For example:<br />
<br />
<pre><br />
#if($user.IsAnonymous)<br />
<br />
You can register now to get the great benefits of membership!<br />
<br />
#else<br />
<br />
Welcome back $User.Username!<br />
<br />
#end<br />
</pre><br />
<br />
===Looping===<br />
<br />
You can loop over collections of items with the foreach-end statement. For example:<br />
<br />
Current exchange rates for currencies:<br />
<br />
<pre><br />
<table><br />
<br />
<tr><th>Currency</th><th>Rate</th></tr><br />
<br />
#foreach($currency in $store.Currencies)<br />
<br />
<tr><td>$currency.Name</td><td>$currency.ExchangeRate</td></tr><br />
<br />
#end<br />
<br />
</table><br />
</pre><br />
<br />
===Advanced Looping===<br />
<br />
The foreach statement supports additional features to enable things like alternating rows, headers, and footers.<br />
<br />
<pre><br />
#foreach($i in $items)<br />
<br />
#each<br />
<br />
text which appears for each item<br />
<br />
#before<br />
<br />
text which appears before each item<br />
<br />
#after<br />
<br />
text which appears after each item<br />
<br />
#between<br />
<br />
text which appears between each two items<br />
<br />
#odd<br />
<br />
text which appears for every other item, including the first<br />
<br />
#even<br />
<br />
text which appears for every other item, starting with the second<br />
<br />
#nodata<br />
<br />
Content rendered if $items evaluated to null or empty<br />
<br />
#beforeall<br />
<br />
text which appears before the loop, only if there are items matching condition<br />
<br />
#afterall<br />
<br />
text which appears after the loop, only of there are items matching condition<br />
<br />
#end<br />
</pre><br />
<br />
===Set Statement===<br />
<br />
You can create new nVelocity variables using the set statement.<br />
<br />
<pre><br />
#set ($counter = 1)<br />
<br />
Currencies provided by $Store.Name:<br /><br />
<br />
#foreach($currency in $Store.Currencies)<br />
<br />
$counter. $currency.Name<br /><br />
<br />
#set ($counter = $counter + 1)<br />
<br />
#end<br />
<br />
<br /><br />
<br />
All transactions are conducted in $store.PrimaryCurrency.Name.<br />
</pre><br />
<br />
===Including Comments===<br />
<br />
You can include comments in your nVelocity script. Single line comments are created by starting a line with a ## double pound sign.<br />
<br />
<pre><br />
## single line comment will not be output<br />
</pre><br />
<br />
Multi line comments can also be included, by using the #* &ldots; *# syntax:<br />
<br />
<pre><br />
#* This is a<br />
<br />
comment that spans<br />
<br />
multiple lines and will<br />
<br />
not be displayed<br />
<br />
*#<br />
</pre></div>Loganr