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.
NVelocity and Components of a kit
-
- Lieutenant (LT)
- Posts: 77
- Joined: Mon Apr 19, 2010 4:52 pm
Re: NVelocity and Components of a kit
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
-
- Lieutenant (LT)
- Posts: 77
- Joined: Mon Apr 19, 2010 4:52 pm
Re: NVelocity and Components of a kit
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.
$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.
Re: NVelocity and Components of a kit
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.
-
- Lieutenant (LT)
- Posts: 77
- Joined: Mon Apr 19, 2010 4:52 pm
Re: NVelocity and Components of a kit
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;
This way the email shows Kit Masters and non-kit related products left aligned and the component parts of the kits are bullets.
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