FEATURE REQUEST: Message Template Expressions

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 năm cách đây
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 năm cách đây
Hi Bruce,

Thanks a lot for suggestion. This work item already exists
9 năm cách đây
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 năm cách đây
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 năm cách đây
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 năm cách đây
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 năm cách đây
Any update on this for 3.60 and 3.70?
7 năm cách đây
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 năm cách đây
Great feature
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.