NewReturnRequest.CustomerNotification email template (%ReturnRequest.Product.Name% Localization token not working)

1 week ago
Hello there,

I would notify a possible bug, the product name in return request email template not working correctly and show the prodcut name only in english (Standard lang).

The effected email template: NewReturnRequest.CustomerNotification
The effected Token name: %ReturnRequest.Product.Name%
The store languages: English, Arabic >> Arabic token for the product name not working.
The store nop version: 4.30
1 week ago
To me, it seems that the possible bug is that the MessageTokenProvider does not resolve a localized product name:

            var product = _productService.GetProductById(orderItem.ProductId);
            tokens.Add(new Token("ReturnRequest.Product.Name", product.Name));

whereas other services (e.g. PDFService) would lookup the localized product name
                //product name
                var name = await _localizationService.GetLocalizedAsync(product, x => x.Name, lang.Id);

As a test, check that your product does have a Name value on the first tab, and try again.
1 week ago
(or for that matter, in other Add...Tokens methods in MessageTokenProvider.cs ;)

        public virtual void AddProductTokens(IList<Token> tokens, Product product, int languageId)
            tokens.Add(new Token("Product.ID", product.Id));
            tokens.Add(new Token("Product.Name", _localizationService.GetLocalized(product, x => x.Name, languageId)));

It seems as if the same AddReturnRequestTokens is used by both CustomerNotification and StoreOwnerNotification.  It probably needs additional (and maybe optional) LanguageId param/
1 week ago
Thanks a lot! Here is a work item