we are trying to setup a new design for recommendations. everything works fine appart from language split.
goal: display different attributes based on page language
setup: in the target call we added a new parameter "language" that can be used in the design
problem: everything works fine and the mbox parameter gets populated correctly. however, we are not able to create any if-then-else clause based on this mbox parameter. whatever we tried, it failed.
what it might look like is something like this:
---
#if( \${mbox.language} == "en" )
## layout for en here
#else
## other layout here
#end
---
question: anybody has a working example of an "if-then-else" using a mbox parameter?
thanks for any help!
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
After a long time and help from Customer Care here is the final solution.
return mbox.param("myParameter");
it's just a short version, you can improve this by adding error handling (check if exists or fetch from profile instead).#set($e=$profile.get("user.my_script_variable"))
#if($e== 'my_desired_value')
TRUE
#end
#if($e!= 'my_desired_value')
FALSE
#end
it is just a simple example to give you an idea about the structure and coding..hope that helps
Views
Replies
Total Likes
Don't have an exact answer to the right code to use in design, but can't you use your language mbox parameter as filtering condition in audience and qualify different users based on the language to different design experiences (you will have to setup Recommendations as an offer in XT activity).
Hi @kchaitanya thanks for the reply.
the idea for audiences is what we use currently (but means we have to maintain a lot of designs just with a small change). And this only works if the difference in the design is solely based on the mbox parameter.
but think of a design where you want to add something based on mbox parameter AND product attribute. as an example, display a batch (sign) for a special offer if the user has a certain membership status AND the product is allowed to be a special offer... this would mean we need a way to do the if-statement in the design.
I still hope somebody has an example ...
We do not use the else statement, rather we use multiple #if #end statements. We have a profile script that sets user.month based on current month when request is made and then we read that month in the design to alter the response:
#set($mboxCat = "M-\${user.month}-\${user.year}-" + "$criteria.title")
Hi @Eric_Vidana
thanks for the reply. with your solution are you able to do an if-clause?
whatever I tried, I was not able to do an if-clause like this:
#if ( $mboxCat == "M-02-2003-test")
can you provide an example on how to use your variable in an if-statement?
thanks!
After a long time and help from Customer Care here is the final solution.
return mbox.param("myParameter");
it's just a short version, you can improve this by adding error handling (check if exists or fetch from profile instead).#set($e=$profile.get("user.my_script_variable"))
#if($e== 'my_desired_value')
TRUE
#end
#if($e!= 'my_desired_value')
FALSE
#end
it is just a simple example to give you an idea about the structure and coding..hope that helps
Views
Replies
Total Likes
Hey!
I found this post while investigating possible solutions because I was facing the same challenge.
I found out, that (maybe in the meantime) it became possible to simply access box-parameters within the design simply via
${mbox.myparameter}
which is kind of nice!
The "Parameter to ProfileScript to user profile" felt a little detour-like.
This seems to be a more straightforward solution and works fine for me.
Maybe this helps someone in need...
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies