NVelocity commands for order items

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

NVelocity commands for order items

Post by AbleMods » Thu Jul 31, 2008 11:00 am

Hey I'm trying to add the order item CostofGoods and an Extended CostofGoods to an email template for a client. Does anyone have any idea what nVelocity script commands I need to use?

$orderItem.CostofGoods doesn't seem work. Plus, I don't know how to do math - it looks like I could do {$orderItem.CostofGoods * $orderItem.Quantity} but that no workie.

Thoughts?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: NVelocity commands for order items

Post by jmestep » Thu Jul 31, 2008 11:37 am

Maybe that is defined in the variables that Able uses for nVelocity and you need to define a new variable?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: NVelocity commands for order items

Post by AbleMods » Thu Jul 31, 2008 3:46 pm

I don't understand - what Able variables?

I thought all the nVelocity variables started with a $ or something. I really don't know, haven't worked much with them and I don't know of any documentation beyond what we had 7 months ago.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: NVelocity commands for order items

Post by jmestep » Thu Jul 31, 2008 8:01 pm

I thought I had read in the first help docs that came out with Able that you could define variables if you needed additional ones. Maybe I imagined it. I've done some searching on nVelocity lately and I can't even find out if there is an "or". Documentation is pretty scarce or I don't know what to Google on.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: NVelocity commands for order items

Post by AbleMods » Thu Jul 31, 2008 9:32 pm

Yeah the best I could find was a basic standard, but nothing about what Able has implemented specific to the Able data classes. That's what I need - there's gotta be a way, I just don't know the syntax.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: NVelocity commands for order items

Post by Naveed » Fri Aug 01, 2008 12:14 am

Available Variables

The variables that are available to you depend on the page being viewed. You will always have access to the “Store” and “User” variables. If the scriptlet is part of a page that is viewing a category, you will also have access to the “Category” variable. The same applies to “Product”, “Webpage”, and “Link”.

A sample of the more commonly accessed properties is given below.



$Store.Name

$Store.StoreUrl

$User.IsAnonymous

$User.Name

$User.PrimaryAddress.FirstName

$User.PrimaryAddress.LastName

$Product.Name

$Product.Price

$Product.Weight

$Category.Name



These “variables” are actually the CommerceBuilder objects being used by the ASP.NET scripts. You can access any property of these objects through nVelocity. View the CommerceBuilder developer reference for properties beyond those described above.
You can find more about the NVelocity and customizing the pages at:
http://help.ablecommerce.com/mergedProj ... _pages.htm

You can not access an order item directly but by using the $Order variable and looping through it Order Items. something like:

Code: Select all

#foreach($i in $Order.OrderItems)
 code to process the order item
#end

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: NVelocity commands for order items

Post by Naveed » Fri Aug 01, 2008 12:15 am


User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: NVelocity commands for order items

Post by AbleMods » Fri Aug 01, 2008 7:25 am

Naveed wrote:You can not access an order item directly but by using the $Order variable and looping through it Order Items. something like:

Code: Select all

#foreach($i in $Order.OrderItems)
 code to process the order item
#end
Thank you for the information. However this does not appear accurate.

For example, the Vendor Notification Email Template does not use a #foreach to loop through the various order items. $Order.OrderItem is embedded within a table HTML tag and no looping commands are present. Yet the template appears to render multiple line items.

As a programmer, I am aware of the various data classes and their actual names. However non-programmers would not have this knowledge nor would they have the skills to tie the API help file class names to the nVelocity equivalents. A complete and plain-english nVelocity reference would be very helpful to everyone.

AC7 is final now - the days of trial-and-error to learn the specifics should be over.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: NVelocity commands for order items

Post by Naveed » Fri Aug 01, 2008 8:07 am

SolunarServices wrote:
Naveed wrote:You can not access an order item directly but by using the $Order variable and looping through it Order Items. something like:

Code: Select all

#foreach($i in $Order.OrderItems)
 code to process the order item
#end
Thank you for the information. However this does not appear accurate.

For example, the Vendor Notification Email Template does not use a #foreach to loop through the various order items. $Order.OrderItem is embedded within a table HTML tag and no looping commands are present. Yet the template appears to render multiple line items.
Please check again the Vendor Notification Email template, it is using the foreach loop to loop the order items:
It is using the following statement:
#foreach( $orderItem in $order.Items )

You can access the orderItems collection contained by the order using $Order.Items, Sorry for my previous post in which I mentioned as $Order.OrderItems which is not correct, but that was only for example.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: NVelocity commands for order items

Post by AbleMods » Fri Aug 01, 2008 8:49 am

Aha! This was a correction made between RC3 and final. My main site is still running RC3 :(

In looking at my 2nd site running AC7 final, the template shows the loop command correctly. I'll do my testing there and see what I can come up, thanks for the info.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply