NVelocity and Components of a kit

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Thistle3408
Lieutenant (LT)
Lieutenant (LT)
Posts: 77
Joined: Mon Apr 19, 2010 4:52 pm

NVelocity and Components of a kit

Post by Thistle3408 » Tue Oct 12, 2010 4:26 pm

Is there a way in an email template to know if a product is a component of a kit (or maybe the converse, know that a product is the kit master)?

I know we can see a product vs a discount, gift wrap, etc. by using
#if (($orderItem.OrderItemType == "Product"))

But I would like to know if that specific product is either a kit master or a kit component (or neither). The reason is simple...if a Kit Master, do not indent, align left; if a Kit Component, either indent or bullet this item.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: NVelocity and Components of a kit

Post by mazhar » Wed Oct 13, 2010 6:24 am

This could be something like

Code: Select all

#if ($orderItem.Product.KitStatus == "Master")
Kit Master
#elseif($orderItem.Product.KitStatus == "Member")
Kit Member
#elseif($orderItem.Product.KitStatus == "None")
None
#end

Thistle3408
Lieutenant (LT)
Lieutenant (LT)
Posts: 77
Joined: Mon Apr 19, 2010 4:52 pm

Re: NVelocity and Components of a kit

Post by Thistle3408 » Wed Oct 13, 2010 9:19 am

Got a question about this...

$orderItem.Product.KitStatus == "Member"

Is this true when the item is a member of the specific kit that is on this order or is this true when the item is a member of any kit.

In other words we sell ProductX as a separate saleable, shippable item and it is also a product within a component of KitY.

I need to be able to differentiate.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: NVelocity and Components of a kit

Post by mazhar » Wed Oct 13, 2010 10:00 am

It will be true when item is member of any kit. You can check for parent using orderItem.ParentId, For example if you placed an order for kit having one kitted product then you will see two order items for products. One for main kit and second for kitted product. The ParentItemId of kitted orderitem will be set to orderitemid of main order item.

Thistle3408
Lieutenant (LT)
Lieutenant (LT)
Posts: 77
Joined: Mon Apr 19, 2010 4:52 pm

Re: NVelocity and Components of a kit

Post by Thistle3408 » Wed Oct 13, 2010 1:38 pm

I changed the logic around a little, but this works in our email template...note that the variable $NMasterID is set to "" before entering this logic;

Code: Select all

#if ( ($orderItem.ParentItemId == $NMasterID))
<li>$orderItem.Name</li>
#elseif($orderItem.Product.KitStatus == "Master")
#set ($NMasterID = ($orderItem.OrderItemId))
$orderItem.Name
#elseif($orderItem.Product.KitStatus == "None")
$orderItem.Name
#else
$orderItem.Name
#end
This way the email shows Kit Masters and non-kit related products left aligned and the component parts of the kits are bullets.

Post Reply