Try our conversational search powered by Generative AI!

Ability to relate lineitems in a cart and keep relations in a purchase order

Vote:
 

Hello all

I have a requirement to be able to link a line item to another line item.  For this example imagine line item A = Washing machine and line Item B is a warranty for said line item A.

I have managed to do this using a custom metafield but when it comes to creating the publish order I need to mirror the relationships within the PO as the out of the box SaveToPurchaseOrder does not look at custom metafields.

Q:  Is there anything out of the box, which I can use within the cart object to link these line items in a parent->child hirarchy and, which will be copied over to the purchase order when its created?

Thanks

#151964
Aug 11, 2016 10:25
Vote:
 

Where have you added the custom metafields?

I would assume it was on LineItem but i think that would follow with you to the purchase order.

#152028
Aug 12, 2016 17:58
Vote:
 

Correct, I had to also add the same metafield to the purchase order. and then go through some tree re-creation algorithm to create the hirarchy.  Imagine the trunk is the cart, the main braches are the immediate lineItems, then the smaller branches off them are the child lineItems.  Looping round the cart this way allows me to re-create the hirarchy in the purchase order. (Edit here: Way to match is to match the Code and the quantity(of the parent), link the child in the PO and then record the child is linked, so as not to link again)

I cannot believe EPiServer has nothing out of the box to faciliate child line items related to a parent?  If it does not its missing things like adding services, warranties and sub -upsell items, which need to relate to the parent item.

Sorry re-read your reply.  Custom metafields (in my experience, do not get carried over to the purchase order upon out of the box creation. It needs to be set manually when you have got the cart and purchase order available at the same time.

Sorry, so many edits due to spelling

#152037
Edited, Aug 12, 2016 21:16
Vote:
 

I am still not sure you understood my reply.

Have you added metafields to the cart?

There is no carry over of metafields from cart to purchaseorder.

My first take on this would be to add a metafield to lineitem that pointed out it's parent and lineitem metafields i think are carried over.

In general when i add metafields that needs to be available on both cart and purchaseorder i recommend to add them to the orderform if you don't have more than one orderform.

#152111
Aug 17, 2016 8:53
Vote:
 

Sorry Erik, I might not have come across very well.

To get this working, I have done exactly what you have said.  There is a metafield on the cart and on the purchase order, which has the link to the parent.  When the purchase order is created using the 'out of the box' methods I then have to look at the cart and make the relations within the purchase order.

My question is if Episerver has anything standardised to do this so I do not have to do it manually after the purchase order creation?

Thanks

#152112
Aug 17, 2016 9:56
Vote:
 

Waranties can be managed in another way
Consider warranty as a variant and add it to your purchase orders when required as free item.

/K

#152113
Aug 17, 2016 10:17
Vote:
 

There is nothing built-in to have relations between LineItems, metafields is the only way.

The standard way is to have metafields on OrderForm and/or LineItem and not on ShoppingCart+PurchaseOrder.

#152118
Aug 17, 2016 11:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.