Some phrases and products for empty text search - sap-commerce-cloud

As a part of empty search in Hybris,we are required to display some phrases and products even when customer does not search anything.
How to go about this scenario?Will we have to make changes in the individual controller methods?

You can return a searchEmpty CMS page whenever searchPageData doesn't contain the data.
Now you can design the searchEmpty CMS page as you want.
Like the page contains phrases and product components to display phrase and products which can be changed/configured though WCMS.
Edit:
As you mentioned in your comment, you want to show static text and products in autosuggestions when the user clicks search box.
Approach 1.
You can render static text and your selected product data in the hidden container with all pages. Now on search-box click event show that data as autosuggestion dropdown.
Approach 2.
On the search-box click event make ajax call(custom mapping) to get the static data content(JSP).

Related

How to make semantic search dropdown to search in hidden content as well?

Is there a way to search from a hidden text as well? I want to search from not only dropdown item text but another hidden text content as well. I know that semantic search dropdown is normally searched in the data-value field as well. But in my case data-value is just an ID. I want to add another field to search as well.

Want to create an column in Dynamic View Panel that displays "Favorites" icon

I am using a Dynamic View Panel and would like to create a "Favorites" column in the view. The underlying view has a "Favorites" multivalue names field that contains all users that have flagged the document as a favorite. What I would like to do is to handle this conversion in a "Customizer" bean where I can compare the current user with the stored vales in the "Favorites" column and see if they are in the list. If they are I would present a "Green Star" icon (not a standard Notes icon) else I would present an empty star icon. I would also like to make the star icon live so if you click on the star it would toggle the favorite value in the database on/off.
How do I implement such a feature?
What are the DominoViewCustomizer methods I need to override? (looking at afterCreateColumn)
How do I get and set the column values? (really lost here)
How do I get the column to display a Notes resource image (my stars) or do I need to store it in a directory on server?
How do I make the star icon clickable?
How do I capture that click event?
Using Domino v9.0.1
If you don't have to use a dynamic view panel here's a way of doing it that will work with a view panel, repeat, or data table...
Use a "favorites" document for each user. Have it contain one multi-value item to store the Note IDs of all the documents the user favorited.
When the user logs on read the contents of the multi-value field into a sessionScope variable. Then in your view column all you need to do is check if the NoteID of the current row is in your sessionScope variable and display the appropriate icon.
For the part when a user clicks on a star you would have an event handler on that column that does a lookup to the user's favorites document (create it if it doesn't exist) and add or remove the NoteID then do a partial refresh on the view.
You can probably still do this with a dynamic view panel but I can't speak to the particulars of it since I don't use it much.

checking if current user is author of the document

I have a formA where I have a field '_author' which is of type Authors/Computed for display with value (#Subset($Updatedby;1)). I display information from formA on viewA. What I want to achieve is that documents that are created by you are only visible to yourself on viewA. I tried the following formula in viewA 'View Selection':
SELECT (form = "formA" & #UserName =_author). Even though I know that these two variables have the same values when I read it from the document's properties, the condition is not satisfied and I do not see a single document. If I delete everything after "&", the view shows all documents.
All is hosted on a server which handles users.
A handy workaround is to create a Page with an embedded view. This view is exactly like your view but has an additional first categorized (!) column with your field _author.
Put into embedded view's property "Show single category" the formula #UserName or #Name([CN]; #UserName) depending on how your categorized column _author is formatted. Show then always the Page instead of the view.
This way you avoid trouble with "Shared, private on first use" views and users see exactly their own documents only.
#UserName works in a special manner in selection formulas in views. In your case the view should be Private on First Use. Read further here: http://www-01.ibm.com/support/docview.wss?uid=swg21089773 .
Be aware that this lead to all sort of issues, e.g. when you update the design of the view users must remove the view manually to get the changes deployed.

Display the responses to the current form inside an embedded view

I am trying to create a new Lotus Notes Database (classic, not using XPages) using the Domino designer which will be used to manage customers and orders.
As orders belong to customers, I implemented orders as responses to customers (this seems to be the only way to create a hierarchy).
Now, the form representing the customer should contain a view displaying all the orders which belong to the customer.
However, I don't know how to implement this view:
First, every embedded view based on a formula (I tried SELECT (Form = "Order")) creates an error message: "Unable to launch at this time".
Second, I have absolutely no idea how to restrict the result to responses to the current Form (in my case: Showing only the orders belonging to the current customer and not all orders in the database).
To embed the view in the 'customer form', open that form, place the cursor on the place you want the embedded view, and from the menu select: Create -> Embedded Element -> View...
Select the view you want to embed, and click 'Ok'.
Now, to show only orders for current customer, you will see in the Objects tree list 'Embedded View' with 2 option, select the second 'Show single category'. There you can specify with formula only the current customer. For example, to show entries only for the current logged user I would put:
#Name([CN]; #UserName)
Hopefully, this info will help solve the problem.

Does comma seperated list in a search box indicate ALL or ANY?

We have a reporting web site and in the search screen most of the fields are comboboxes. We then AND all the fields together to get a filtered list of records. For example if i chose NY in the City dropdown and priority 1 in the priority dropdown and sales in the team dropdown, it would general something that looked like this (pseudo SQL)
Show me all record where City = 'NY' AND Priotity = '1' AND Team = 'Sales'
We now just added tagging to our records so to support searching by tag(s), we added an additional textbox to search by TAG where you can entered a comma seperated list.
Right now this is an autocomplete textbox which supports multiple entries.(similar to the Multiple Cities (local) example on this page.
When we rolled it out people had different expectation on how search would work when you entered multiple items in the text box. Would it:
Do an AND and only return records that had ALL of the tags listed.
Do an OR and return records that has ANY of the tags listed.
It turns out that we rolled out #1 but many people expected #2. Is this just basically preference or is there a default standard here in this example. Our only solution right now is to add a radio button next to the textbox to say ALL or ANY
If your users expect it to work one way then that's the way it should work.
This is a great example of why you should test early and often with actual users.
I'd say it is not basically preference, but expectations based on what users experience in other types of searches. The "OR" was probably expected by your users as use of tagging gets pretty close to being like a search engine searching on any word in a text and most search engines do an "OR" and then order the results according to how many terms (tags) were "hit".
If going all the way supporting AND and OR operators is not feasible right now, then I would indeed offer an "All" versus "Any" radio button and default it to "Any".

Resources