Developer forum

Forum » Development » Razor cart issue - .JSEncoded() causes value not to show

Razor cart issue - .JSEncoded() causes value not to show

Dmitrij Jazel
Reply

Hi guys,

Not seen anything like this before, maybe you have some suggestions.

1) Have yet another cart module attached to a paragraph, with Json template, with layout set to return application/json.

2) While having products in cart, I check the template in front-end (so this is not json parsed response, this is razor template itself, that generates Json).

3) Using razor, and trying to get this value: 

string ol_name = ol.GetString("Ecom:Order:OrderLine.ProductName.JSEncoded()");

4) Removing .JSEncoded() from line above, kinda fixes the issue, but the point is that I must use "JSEncoded()".

 

Issue:

As mentioned in #4 - if I remove ".JSEncoded()" from the template tag, I am able to get a ProductName correctly. But when I include it, all I get is just blank space.

 

5) Alternevetly, I try using HTML json template for for same paragraph module.

<!--@Ecom:Order:OrderLine.ProductName.JSEncoded()-->

works perfectly.

 

Any suggestions what can cause this?

 

/Dmitrij

 


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Take a look here: http://developer.dynamicweb.com/forum/templates/razor-globalpageview-url-raw-jsencoded%28%29.aspx

Cheers,

Imar

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Ahh.... that explains everything. Appreciate your help Imar! :)

 

You must be logged in to post in the forum