Developer forum

Forum » Ecommerce - Standard features » OrderContext
Adrian Ursu
Reply

Hi guys,

I am a bit confused by the approach when working with OrderContexts.

I have noticed that outside of the ShoppingCart module, I can access an OrderContext Loop, which is pretty fine for displaying a minicart.

In the ShoppingCart on the other hand, the OrderContext loop is available only in the OrderLines Loop.

I would have expected it to be available outside of the OrderLines loop.

We have a situation wehre we need to assign an OrderContext to a user dynamically. Which seems pretty fine from the AddToCart perspective but it seems complicated to list just that specific cart.

Am I missing something?

Thanks,
Adrian


Replies

 
Merethe Vrå Andersen
Reply

Hi,

The OrderContexts can be used to have different cards on the same website. The Context loop is available in Products loop in the Product catalog and in the order lines loop in Shopping cart in order to be available to add products to different context carts.

In shopping cart - outside the order lines loop - you only have details (e.g. Context ID and name) about the specific cart that is setup as context cart.

http://manual.dynamicweb-cms.com/Default.aspx?ID=7616

I'm not sure what your wanted setup is with user and context cart.

If a user is logged in, he get his own content in the specific context cards. E.g. if a user is logged in and has added productA to "Daily cart" (ContextID 1) and productB to "Monthly cart (ContextID 2), then only productA is visible in Daily cart and only productB is visible in Monthly cart.

Kind regards,
Merethe

 
Adrian Ursu
Reply

Hi Merethe,

I understand how it works.

My need is to filter the cart content based on the Order context.
For example, a user adds products to a specific Order Context.

When the user goes to the Cart Page, I have to list the cart for that order context only.

Outside of the cart page I can use the OrderContext Loop, verifiy the Order Context that is available for the current user and then loop through the Orderlines.

In the Cart Page, using TemplateTags(), I could find the Order Context loop only inside the OrderLine Loop (a separate OrderContext loop fr each OrderLine) and not before the OrderLine Loop.

I might be wrong or there might be version related.

My assumption was that I should have something like this (ignore tag definitions, just trying to prove a point):

@foreach(LoopItem context in GetLoop("OrderContext")){

   if(context.GetString("OrderContextID") = "ORDERCONTEXT1"){

      foreach (LoopItem orderline in context.GetLoop("OrderLines")){

           <!--List orderline content-->

      }

  }

}

Is this how it is supposed to work?

 

Thanks,
Adrian

 

 

You must be logged in to post in the forum