Open Closed

Multiple Email Template Per Customer base on default template #4480


User avatar
0
tahseelit1 created

I have requirement to use the current Text Template Management Module but each customer are allowed to modified the existing temple.

ex. Default Template: Email Sending

Merchant1 -> Template: EmailSending -> Content: {{code}} {{link}} "with their own logo and designed" Merchant2 -> Template: EmailSending -> Content: {{code}} {{link}} {{name}} "with their own logo and designed"

If merchant1 login to the admin portal he/she will allowed to view/edit their own email template.

Please let me know if this kind of requirement is possible?.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings

  • ABP Framework version: vX.X.X
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The Text Template is tenant-isolated, and each tenant can customize the template.

  • User Avatar
    0
    tahseelit1 created

    we are not using multitenant the requirement is to allow merchant to (modified or create) their own email template and those template is accessible only for them base on their username and password. they have their own dashboard , menu and access right one of their rights is to create their own email template.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Ok, I think the merchant is a user right? you need to custom the text template module.

    • Override the EfCoreTextTemplateContentRepository to change the GetAsync and FindAsync methods.

    For example:

    [ExposeServices(typeof(IEfCoreTextTemplateContentRepository))]
    public class MyEfCoreTextTemplateContentRepository : EfCoreTextTemplateContentRepository
    {
        public override async Task<TextTemplateContent> GetAsync(
            string name,
            string cultureName = null,
            CancellationToken cancellationToken = default)
        {
            // You need to care if the user is logged in or not
            var userId = currentUser.GetId();
            return await GetAsync(x => x.Name == name && x.CultureName == cultureName && x.CreatorId == userId, cancellationToken: GetCancellationToken(cancellationToken));
        }
        //......
    }
    
    • The text template module uses Cache for performance, you can disable the cache.
    Configure<TextTemplateManagementOptions>(options =>
    {
        options.MinimumCacheDuration = TimeSpan.Zero; // use zero to avoid caching
    });
    
  • User Avatar
    0
    tahseelit1 created

    perfect! this is what i need thank you.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19