Jump to content

Show Message based on previous selected item


eagleman
 Share

Recommended Posts

Hi,

you should sent to the template your two messages (to a JavaScript array), and using JavaScript display the one which is needed, according to the selected Radio button/option.

I hope that I could help.
Have a nice day, Leo.

  • Confused 1

Share this post


Link to post
Share on other sites

Hi @eagleman,
something like this:

<script>
var my_date_aray = [];{/literal}
	{foreach from=$orders item=order}
		my_date_aray["{$order.details.reference}"] = "{$order.details.order_date}";		
	{/foreach}
	{literal}
</script>	


After this you can use the value by referring the array with the order reference as key, taken from the selected radiobutton.

Have a nice day, Leo.

Share this post


Link to post
Share on other sites

Hi @Prestachamps

 

I can seed now the orders in log with date, but i do not how to use the value by referring the array with the order reference as key, taken from the selected radiobutton.

 image.png.5efe4368b240b10de961f17261e6ab08.png

 

Regards

image.png

Share this post


Link to post
Share on other sites

Hi @eagleman,

try debugging the variable with console.log() to see if there are correct keys in the variable:


    {foreach from=$orders item=order}
        my_date_aray["{$order.details.reference}"] = "{$order.details.order_date}";    
    {/foreach}
     {literal}
     console.log(my_date_aray);

     alert("the order = "+     my_date_aray);

and then in the json assignment you should use the corresponding key assignment :


     "html":"date  " +  my_date_aray["{/literal}{$order.details.reference}{/literal}"]

Hope I can help,

Have a nice day, Leo.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More