Press One Button, But Initiate Two Commands

I was wondering, is it possible to initiate two commands with one button? Let me clearify that:

I want to to make a page with some text, a field for the coupon code and a button that automatically adds a predefined product to the shopping cart along with a coupon code automatically applied to the price. I have tried something with the code below, but without success.

	
	
	
	
Promotion code

Thank you in advance,

Allan

I would do this on the backend when the form is processed. I.e. put the product you want in the cart and then apply the coupon and return the user to wherever you want them to be.

Thanks for your reply tbirnseth. I will give it a try this way.

I have a similar problem. I want to show a dashboard on home page when a user logs in. Is there any way to pass two result_ids and update them both with different contents?

Resultids are comma separated. You can press as many as you want.

Well, My problem is, how can I decide which content goes to which?

Would need more info on what you have and what you want to do in order to discuss.

Let's say, I have two divs in home page. I want to update one with the previous orders of the user and second with his profile when he logs in. When he logs out, it should show static content. This can be easily achieved by reload / redirect. I wanted to know if there is a way to do it using ceAjax.

Let's say, I have two divs in home page. I want to update one with the previous orders of the user and second with his profile when he logs in. When he logs out, it should show static content. This can be easily achieved by reload / redirect. I wanted to know if there is a way to do it using ceAjax.

Hello!

There is a redirect after login and logout, do you really need ajax? Anyway, you can return the variable used in these blocks in your controller and specify block IDs in the result_ids parameter.There is no need to specify which data goes to which block because blocks use certain variables that should be updated.

As alternative with result_ids you can use the following code after ajax request is completed

Tygh::$app['view']->display('PATH_TO_TEMPLATE1');
Tygh::$app['view']->display('PATH_TO_TEMPLATE2');
exit;

I'd just use standard html blocks with smarty support and let the block carry the logic on what to display depending on whether the user is logged in or not. Each would be conditional upon {$auth.user_id != 0} for a logged in user.