多元文化中的Sitecore空字段 [英] Sitecore empty field in multi culture

查看:98
本文介绍了多元文化中的Sitecore空字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的情况的简要理解,

Here is a brief understanding of my scenario,

  1. 使用2个未版本控制的字段SportAnimal
  2. 创建模板
  3. 基于此模板以2种语言(英语和英语)创建商品阿拉伯语
  4. 对于英语版本,在两个字段中都填写我是英语"
  5. 对于Arabian,请将Animal字段留空,然后将Sport->设置为Arabian value
  1. Create a template with 2 unversioned fields Sport and Animal
  2. Create an item based on this template in 2 languages English & Arabic
  3. For English language version fill both fields with "I am English"
  4. For Arabian, leave Animal field empty, and Sport -> set Arabian value

结果:

当请求带有Contextlanguage = Arabian的页面时,Animal字段将显示I am English,而Sport将具有Arabian value.

When one requests a page with Context, language = Arabian, Animal field would show I am English, whereas Sport would have Arabian value.

您好,尼古拉·米蒂科夫(Nikolay Mitikov), 我有两个未标记为未版本化的字段,如上图所示.您其余的理解是100%正确的.我也没有实现任何自定义逻辑或没有使用任何扩展程序,可能会对此造成麻烦. 对于阿拉伯和英语文化,我只是使用sc_lang querystring或URL中的"ar"使用不同的URL,而这仅设置了上下文语言. 下面是我的语言切换器简单代码:

Hi Nikolay Mitikov, I have two field where unversioned is not marked as shown in above image. rest of you understanding is 100% correct. also i have not implemented any custom logic or have not used any extension that could trouble this. for arabic and english culture i am just using different url by sc_lang querystring or "ar" in url which sets context language that's all. below is my language switcher simple code:

public string ItemEnglishURL
{
    get
    {
        return string.Concat(Helper.GetItemUrlByCulture(Sitecore.Context.Item, "en"), CurrentQueryString);
    }
}

public string ItemArabicURL
{
    get
    {
        return string.Concat(Helper.GetItemUrlByCulture(Sitecore.Context.Item, "ar"), CurrentQueryString);
    }
}

public static string GetItemUrlByCulture(Item item, string culture)
{
    string itemUrl = string.Empty;
    if (item != null)
    {
        using (new Sitecore.Globalization.LanguageSwitcher(culture))
        {
            itemUrl = LinkManager.GetItemUrl(item, new UrlOptions() { LanguageEmbedding = LanguageEmbedding.Always });
        }
    }
    return itemUrl;
}

仅提供一种解释,基本上在我通过渲染时在相同的解决方案/场景中

Just one more explanation, basically in same solution/scenario when i am rendering through

           <li runat="server" id="navAncharLi"> 
              <a runat="server" id="navAnchar">
                 <sc:Text ID="TextTitle" Field="Title" runat="server" Item="<%# Item %>" DisableWebEditing="true" />
                 <strong runat="server" id="TagSubTitle">
                  <sc:Text ID="TextSubTitle" Field="SubTitle" runat="server" Item="<%# Item %>" DisableWebEditing="true" /> 
                  </strong> </a>
               <em runat="server" id="navAncharHead"></em>
            </li>



,但是当我使用函数从后面的代码进行渲染时,则不会产生问题&完美运行,如下面的代码所示:



but when i am using a function to render from code behind then it's not creating issue & working perfect like shown in below code:

                    <li runat="server" id="navAncharLi">
                        <a runat="server" id="navAnchar">
                          <%# GetFieldValue(Item,"Title") %>                                   
                            <strong runat="server" id="TagSubTitle">
                                 <%# GetFieldValue(Item,"SubTitle") %>                                        
                            </strong>                                    
                        </a>
                        <em runat="server" id="navAncharHead"></em>
                    </li>


public string GetFieldValue(Item itemObj, string fieldName)
    {
        return itemObj.Fields[fieldName].Value;
    }

但这似乎不是一个好的解决方案:)

But it's not seems to be good solution :)

推荐答案

感谢大家, 最终,在分析了Sitecore支持后,得出的结论是这是因为WFFM错误已在新版本中得到解决.

Thanks to everyone, finally after analyzing Sitecore support have come to an conclusion that it's because of WFFM bug which is resolved in new release.

Sitecore支持的答复如下

reply of Sitecore support is below

我已经调查了文件,看来这可能是由于 WFFM模块中的以下错误:

I have investigated files and it seems the can be caused by the following bug in the WFFM module: https://sdn.sitecore.net/SDN5/Products/Web%20Forms%20for%20Marketers/Web%20Forms%20for%20Marketers%202,-d-,4/Release%20Notes/Release%20History.aspx An issue with incorrectly copied values in Title field while working with different content languages has been fixed (426013) The issue was fixed in the Web Forms for Marketers 2.4 rev. 150619 module version. Try to comment out the following processor in the Sitecore.Forms.Mvc.config:

     <renderField>
         <processor type="Sitecore.Forms.Mvc.Pipelines.Fields.AddFallbackValue,
 Sitecore.Forms.Mvc"
             patch:before="*[@type='Sitecore.Pipelines.RenderField.AddBeforeAndAfterValues,
 Sitecore.Kernel']" />
       </renderField>

请让我知道这是否有帮助

Please let me know whether this helps

以上解决方案对我有效& sitecore支持人员也证实了这一点.

above solution worked for me & sitecore support also confirmed that.

您可以对此处理器发表评论,而不会给您带来任何副作用 解决方案.或者,您可以将WFFM模块升级到Web 营销人员表格2.4版本150619版本: https://sdn.sitecore.net/Products/Web%20Forms%20for%20Marketers/Web%20Forms%20for%20Marketers%202,-d-,4/Module_Upgrades.aspx

You can comment this processor without any side effects for your solution. Alternatively, you can upgrade your WFFM module to the Web Forms for Marketers 2.4 rev. 150619 version: https://sdn.sitecore.net/Products/Web%20Forms%20for%20Marketers/Web%20Forms%20for%20Marketers%202,-d-,4/Module_Upgrades.aspx

这篇关于多元文化中的Sitecore空字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆