different images/languages ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 Jahre weitere
Hi,

how can i do this test in the file "ProductTemplate.Simple.cshtml":

if (language = english){
                           <img src=image1 />

} else if (language = french){
                        
                           <img src=image2 />
6 Jahre weitere
Bivolini wrote:
Hi,

how can i do this test in the file "ProductTemplate.Simple.cshtml":

if (language = english){
                           <img src=image1 />

} else if (language = french){
                        
                           <img src=image2 />



You can try ==>\


@{

var workContext = Nop.Core.Infrastructure.EngineContext.Current.Resolve<Nop.Core.IWorkContext>();
  // you have to know language entity Id, say English=1
    if (workContext.WorkingLanguage.Id == 1)
    {
         <img src=image1 />
    }
// do others
}


Note: You can compare with Name Property too i.e. workContext.WorkingLanguage.Name=="Name"
6 Jahre weitere
Thank you sohel, it works good
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.