Modify Simple Search in Hybris cockpit - sap-commerce-cloud

I'm trying to modify the simple search behaviour for the promotions. I want to search only on the 'name' field.
I did this:
<context type="PromotionSourceRule" component="simple-search">
<yss:simple-search xmlns:yss="http://www.hybris.com/cockpitng/config/simplesearch">
<yss:field name="name"/>
</yss:simple-search>
</context>
but the problem is that the field 'name' is localized and my simple search now is searching only for the english language.
I have also german and dutch localization and I would to search also in these languages.
Any idea?

You can't use simple-search for localized fields.
You have to configure your language, see com.hybris.cockpitng.editor.localized.LocalizedSimpleEditor and use advanced-search widget.
LocalizedSimpleEditor
Description
A drop-down list version of the Localized Editor applied in the Advanced Search widget.
Type
Reference to any type which must be provided in the following format LocalizedSimple( ), for example:
LocalizedSimple(java.lang.String)
LocalizedSimple(java.lang.Integer)
LocalizedSimple(Reference(Product))
Example :
<as:field editor="com.hybris.cockpitng.editor.localized(com.hybris.cockpitng.editor.defaulttext)" .../>
Advanced search widget example
<context type="Product" component="advanced-search">
<as:advanced-search xmlns:as="http://www.hybris.com/cockpitng/config/advancedsearch" connection-operator="AND">
<as:field-list disable-attributes-comparator="false" disable-subtypes-checkbox="false">
<as:field name="code" operator="equals" selected="true"/>
<as:field name="approvalStatus" operator="equals" selected="false"/>
<as:field editor="com.hybris.cockpitng.editor.defaultlong" name="pk" operator="less" selected="true" sortable="false"/>
<as:field name="modifiedtime" operator="greaterOrEquals" selected="true"/>
</as:field-list>
<as:sort-field name="code" asc="false" />
</as:advanced-search>

Related

How to display default text when translation is missing using jhiTranslate

in JHipster application I want to display a default text within a html element when a translation is missing.
I use angular ngFor directive to display elements in an array, some of which have a translation and some of which are inserted by a user, and therefore have no translation in i18n json. I couldn't find any documentation that explained how to use jhiTranslate
I was thinking about syntax like this
<div jhiTranslate="example.1">Default Text</div>
and if this particular translation was missing a "Default Text" would be shown. for now it shows "translation-not-found[example.1]".
Is there a way to achieve this using jhiTranslate?

Display rtl for the whole page for multilanguage using JSF

I built web site using JSF, support multi-language(German and English).
I just set the internationalization values for each language in properties to be use in xhtml. Now I added Arabic language and create lang_ar.properties for Arabic values. It works fine, but the direction is still displayed in the wrong place. Since Arabic is RTL, so when change to Arabic the its should change the direction of the whole content of the page to RTL.
I searched a lot for the solution but I didn't find what I am looking for.
If I use html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ar" dir="rtl">
It will change the direction of the page even if I use German or English. I don't want to use separate page for Arabic content I want use the same pages which take the value from properties files just like English and German, but I need to change the direction when use arabic properties.
If I use the following:
<h:inputText ... dir="#{view.locale.language eq 'ar' ? 'rtl' : 'ltr'}" />
This will works just for the plain text entered in the input field not to the input field itself. So the input field will stay ltr but the text inside will be rtl.
Can any one help me?

How to Get and Output Field Choices in a Custom SharePoint List DispForm Page?

I'm working on a custom Display Form for a SharePoint list. Is there a way to get the field choices for a field that has multiple choices? That is, I can print out the chosen value with something like:
<xsl:value-of select="#Migration_x0020_Status" />
But, I want to print out all the choices, including the one that was chosen. The closest I've come is to use the FormField element from the EditForm page like the following:
<SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="Edit" FieldName="Migration_x0020_Status" />
However, that prints out SELECT and OPTION elements. I want to get the underlying choices and print out my own stuff (eg: with UL and LI elements). How can I do this?
i would suggest to use object model to create a custom webpart for the same. if thats not the CHOICE I would like to suggest a slight change in your architecture to include lookup column and then in your xslt datasource add the master list data source as well and then work on xslt to show it the way you want

RenderPattern headache with WSS 3.0 Document Library

I'm trying to define the DisplayPattern of a custom field to do as follow. It's a simple text field used in document libraries, but i want the text entered to be displayed as a link to the document in the list view.
<URL Cmd="Display"> gives me the display form, but I want the link to actually download/open the document...
I can't for the life of me figure this one out...
Thanks for your help!
The answer lied in <LookupColumn Name="FileLeafRef" /> used along with <ListUrlDir />...

Is it possible to format a NumberField in a page layout?

I'm developing a SharePoint publishing site and setting up its content types and page layouts. I need to display the value for a Year field with type Number. The markup currently is:
<SharePointWebControls:NumberField FieldName="Year" runat="server" id="Year" />
The problem with the default behaviour is that it shows each number with a comma, e.g. "2,009" instead of "2009". Is there a way I can set some sort of String.Format syntax on the field to make it display correctly?
I tried creating a new rendering template which looks like this:
<SharePoint:RenderingTemplate ID="YearNumberField" runat="server">
<Template>
<SharePoint:FormField ID="TextField" runat="server"/>
</Template>
</SharePoint:RenderingTemplate>
... but there doesn't appear to be any 'Format' property on the FormField object.
Thanks for any help.
Update:
I tried wrapping the SharePoint:FormField tag inside SharePoint:FormattedString. Unfortunately the field was not formatted, same results as this question.
The issue is that the rendering template must use FormField. This always renders the value in the format: 1,989 . To resolve this the rendered text needs to be trapped and altered to get the desired output. Here are two approaches to resolving this:
1. Write a custom control inherited from NumberField
The RenderFieldForDisplay and RenderFieldForInput methods can be overridden to provide the desired output. Additional properties can be added to the control to describe additional behaviour.
Pros: No changes to rendering templates required.
2. Write a custom control for use in the rendering template
A control that (for example) uses regular expressions to alter text can wrap around the FormField control.
<SharePoint:RenderingTemplate ID="YearField" runat="server">
<Template>
<RX:RegexManipulatorControl runat="server"
Mode="Replace"
Expression=","
Replacement="">
<SharePoint:FormField runat="server"/>
</RX:RegexManipulatorControl>
</Template>
</SharePoint:RenderingTemplate>
Pros: Generic solution can be used for any type of field.
from Just Another SharePoint Blog
Open the list view in SharePoint
Designer.
Right click on the data view web part.
(the list)
Select Convert to XSLT Data View
Click on the number field you would
like to format
A > will appear showing Data Field,
Format As
Click on the link below Format As -
Number formatting options
Under Options deselect Use 1000
separator
Click OK
Save your changes and hit F12 to
preview

Resources