Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Check for currentstep in master template

Check for currentstep in master template

Heine Virenfeldt Kristensen
Heine Virenfeldt Kristensen
Reply

@GetInteger("Ecom:Checkout.CurrentStep.Index") worked before switching to the new viewmodels, So is there a new way to make this check?


Replies

 
Nicolai Pedersen
Reply

That s not available in the view models... And nor are global tags.

What are you trying to achieve? Maybe there is another way,

BR Nicolai

 
Heine Virenfeldt Kristensen
Heine Virenfeldt Kristensen
Reply

Just trying to change header/footer of a website based on the steps during checkout, without using mulitple pages with the cart module.

/Heine

 
Nicolai Pedersen
Reply

Hi Heine

Yes - not a simple one because the viewmodel is executed in a little different order than razor template. So at the time the cartviewmodel is generated the step index is not yet calculated.

So - just very recently, in 9.3.3, the Rendering.Template class got a new method called GetRawValue. That might be your rescue.

So after you have called PageViewmodel.Placeholder(*) where the cart is rendered (you could have several calls to that), you can maybe access the value using this GetRawValue method:

Dynamicweb.Core.Converter.ToInt32(Dynamicweb.Frontend.PageView.Current.Template.GetRawValue("Ecom:Checkout.CurrentStep.Index"))
Dynamicweb.Core.Converter.ToString(Dynamicweb.Frontend.PageView.Current.Template.GetRawValue("Ecom:Checkout.CurrentStep.Name"))
Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Frontend.PageView.Current.Template.GetRawValue("Ecom:Checkout.CurrentStep.IsCheckout"))

BR Nicolai

 

You must be logged in to post in the forum