FEATURE REQUEST: Message Template Expressions

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 Jahre weitere
We need the ability to have expressions as part of the message template engine (useful for pluralization or conditional message parts). For example:

You have %FriendRequestCount% new friend %(FrienedRequestCount > 1 ? "requests" : "request")% at %Store.Name%

You have %FriendBirthdayCount% %(FriendBirthdayCount > 1 ? "friends" : "friend")% with %(FriendBirthdayCount > 1 ? "birthdays" : "a birthday")% this week

We found %SuggestedProductCount% %(SuggestedProductCount > 1 ? "products" : "product")% for you at %Store.Name%

Thanks!
9 Jahre weitere
Hi Bruce,

Thanks a lot for suggestion. This work item already exists
9 Jahre weitere
a.m. wrote:
Hi Bruce,

Thanks a lot for suggestion. This work item already exists


Thanks. I voted for it and will follow it.
9 Jahre weitere
Hi,

I just created a Plugin for nopCommerce 3.40 which adds full Razor support to all Default Message Templates.
Get it for free at https://github.com/BeniGemperle/nopCommerce-RazorMessageService.

Regards,
Benjamin
9 Jahre weitere
Thanks Benjamin. What is the Model? Is it different for every message template? Or, does it just contain the tokens as properties? Furthermore, what about custom templates (e.g. mobSocial's FriendRequestNotification message template)?
9 Jahre weitere
Bruce, please see the documentation at https://github.com/BeniGemperle/nopCommerce-RazorMessageService.

Feel free to create a Fork with your implementation of custom templates.

Regards,
Benjamin
8 Jahre weitere
Any update on this for 3.60 and 3.70?
7 Jahre weitere
We have added the ability to use conditional expressions in message templates. To do this, use the token
%if (your conditions) ... endif%
.
For example, use conditional statement
%if (%Order.Shippable%) Shipping Method: %Order.ShippingMethod% endif%
for display shipping information only for shippable orders.

You can see full changes in commits for this work item.
7 Jahre weitere
Great feature
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.