How to search by "locName" (UserGroup.locName) in the attribute "groups" (Customer.groups) - Backoffice - sap-commerce-cloud

I don't understand why the search by locName (UserGroup.locName) in the attribute groups (Customer.groups) in Backoffice doesn't work- please see pictures. The simple-search is working fine and the label also. As I know it is enough to add the attribute in the label in the backoffice config file, what actually it is already done in the platformbackoffice-backoffice-config.xml. Am I wrong?
Backoffice-config.xml:
<context type="UserGroup" component="base" merge-by="type" parent="PrincipalGroup">
<y:base>
<y:labels>
<y:label>(locName?:'')+' ['+uid+']'</y:label>
<y:iconPath>profilePicture?.downloadURL</y:iconPath>
</y:labels>
</y:base>
</context>

Related

Liferay 7.4: How to create a configurable web content article footer?

I need to create a footer in a Liferay-project, that can be modified from the instance. I've been trying various things in my footer-code and instance, but haven't figured out how to do it.
Any content inside the footer can't be touched and in page edit mode, Liferay says "This area is defined by the theme. You can change the theme settings by clicking more in the Page Design Options panel on the sidebar". I didn't get any help from Page Design Options either. Is there a way to do this?
I found the answer after hours of work and searching and want to share it with everyone here. The working solution was found here, in one of the comments.
You need to write some code (I use Freemarker/ftl) and then configure the site pages a bit, but here's how it works:
Put a new setting inside liferay-look-and-feel.xml:
<settings>
<setting key="footer-article-id" value="" configurable="true" type="text"/>
</settings>
This will create a new configurable option in page options, allowing you to input the ID of the web content.
NOTE: <theme> might get underlined red "The content of element type "theme" must match". This still prints everything correctly, but the tags are given in a wrong order. Inside my <theme>, I have <template-extension>, <settings> and <portlet-decorator> in that order, which removes the error.
Assign a variable in init_custom.ftl (cleans up the footer-code):
<#assign footer_article_id = getterUtil.getString(themeDisplay.getThemeSetting("footer-article-id"))/>
And then add this to the footer-code, to create the spot, where the content is visible:
<#liferay_journal["journal-article"]
articleId=footer_article_id
groupId=page_group.groupId
/>
After this, everything should be ready code-wise.
Create a Web Content for your footer. In the creation screen, there's an ID on the panel on the right. Publish your content and grab the ID.
Finally, go to Site Builder --> Pages and click on configuration from the top bar (behind three dots). You should see the input field like in the first picture: That's where you add the ID.
Save the settings and your web content should now be in the footer.
Hope this helps!

How to set List View as default view in Hybris PCM Backoffice

I am a bit new to the Hybris platform. I am working with the Backoffice PCM on Hybris 6.7.
I would like to change the default browser display when using the PCM Backoffice. Currently the default behavior renders Grid View but I would like to use List View instead. I will like to either remove entirely the grid view option (or disable it) and automatically open products in list view instead.
You have to customize the xml to obtain the desired behavior. The best approach is creating a new extension from template ybackoffice to consolidate your changes.
Basically, the original extension have these lines:
<context type="Product" component="pcmbackoffice-assortment-collection-browser" >
<cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
<cb:available-molds default-mold="grid-view">
<cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
<cb:mold spring-bean="gridViewCollectionBrowserMoldStrategy"/>
</cb:available-molds>
</cb:collection-browser>
</context>
Just copy and paste in your new extension in the file <myextension>-backoffice-config.xml and remove the line correspondent to the grid view (for removing the option), eg.:
<context type="Product" component="pcmbackoffice-assortment-collection-browser" >
<cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
<cb:available-molds default-mold="list-view">
<cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
</cb:available-molds>
</cb:collection-browser>
</context>
Do ant clean all, and after HAC update in your extension.
Ps.: You can apply these changes through orchestrator to see the result in live, before create the new extension.

GvNix Using rolesAuthorizedUpdate on InlineEdit datatable, other roles can't see table

I am using GvNix 1.5.1RC4. It's a detail table and I have changing the rolesAuthorizedUpdate and rolesAuthorizedShow. Below is my code:
<table:table data="${...}" create="false" rolesAuthorizedShow="APP_ADMIN,APP_APPROVER,APP_OWNER" rolesAuthorizedUpdate="APP_OWNER" id="...>
The issue is only APP_OWNER can see the table content. All other Roles will see a kind of broken looking table headers and that's it. Looks like the datatable can't even render. Removing the rolesAuthorizedUpdate will fix the issue.
I then tested set update="false". The datatable rendered fine and only the update icon is missing for everyone.
I think you can use sec:authorize as a workaround to your problem:
you add the xmldefinition: xmlns:security="http://www.springframework.org/schema/security"
And then in your view you define the cases:
<security:authorize access="hasAnyRole('ADMIN', 'DEVELOPER')">
<table:table data="${...}" create="true" ...>
</security:authorize>
<security:authorize access="hasAnyRole('USER')">
<table:table data="${...}" create="false" ...>
</security:authorize>
Only the specific tag will be rendered for the defined Role. In this way you can give grants to edit content.

Problem with custom registration fields in an multistore setup in magento

I have 2 sites running on my magento platform.
For site2, I added new fields to the registration page and it works properly.
Now, I noticed that when I try to register in site1, on submit I am shown a validation message that the additional fields I have added for site2 are required.
How do I make sure that the additional fields added for site2, are asked only for site2 and not site1?
I have separate themes for both site1 and site2 and both of them have separate register.phtml files.
In the config.xml file for adding custom registration fields, I have this added:
<customer_account>
<employee_id>
<create>1</create>
<update>1</update>
</employee_id>
<doj>
<create>1</create>
<update>1</update>
</doj>
<mobile_number>
<create>1</create>
<update>1</update>
</mobile_number>
<alternate_mail>
<create>1</create>
<update>1</update>
</alternate_mail>
</customer_account>
which is under <global> tag. I assume Magento is reading this. How do I make sure magento reads this config file for a particular site/store? Thanks.
If you want to see the entire XML tree magento has compiled from all XML configuration files:
header("Content-Type: text/xml");
die(Mage::app()->getConfig()->getNode()->asXML());
Will present you with a single compiled XML of their entire tree, this may help in determining if your changes are being added.
Also be sure and checkout Alan Storms CommerceBug as it has this functionality built-in.
How I solved a similar situation is that I added system configuration options to allow me to set which custom field is enabled all the way down to the store view scope. This means I don't need to have separate phtml for the different stores, but can just use the same.
I've also created custom phtml 'widgets' - modelled on the Magento DOB, Gender and Name widgets. The custom widget block code has a 'isEnabled()' method that checks the config flag. In, say, my checkout/onepage/billing.phtml I can say:
<?php $_mywidget = $this->getLayout()->createBlock('mycompany/customer_widget_mywidget') ?>
<?php if ($_mywidget->isEnabled()): ?>
....
<?php endif ?>
Hope this helps.

Faulty pages created by SiteDefinition

I'm creating some pages using a SiteDefinition, the markup looks something like this:
<File Url="Page.aspx" Name="$Resources:SiteDefinitions,PageName;" Type="GhostableInLibrary">
<Property Name="Title" Value="$Resources:SiteDefinitions,PageTitle;" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx"></Property>
<AllUsersWebPart WebPartZoneID="WebPartZone1" WebPartOrder="1">
-- webpart data here
</AllUsersWebPart>
</File>
The page is created as expected, but it's somewhat faulty. If for instance I click Edit Page and then click Publish (without actually editing anything) I will get this error:
"This Page has been modified since you opened it. You must open the page again."
I will get this error approx. every second time I try an editing action.
If I manually create a page using the same page layout everything works as expected and this error does not show up.
Does anybody have an idea what could be wrong?
I too create a Page using the above method only thing I found missing in your code is that I used to have a title in the PageLayout as
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx, Your title"></Property>
This should not be the cause, but you can try it, Also refer the articles this or this
I think you're right with using PublishingLayoutPage. I came across this article today while searching for this error caused by something else. It describes your same issue although the person in the article was not inheriting from PublishingLayoutPage and had not specified the PublishingPageLayout property. When they fixed this it worked.
This doesn't directly help you, although I did notice in their article that they are specifying the ContentType property. Have you tried specifying this? As you can see your complete code, are there any other differences you see from the article or additional information from the comments?
Okay, I (kinda) got this working now.
The guy who had made the ONET.xml had put a reference to the page layout in the Url attribute of the element.
Like I wrote in a comment earlier I tried making the page layouts inherit from TemplateRedirectionPage. Instead I now made an empty default.aspx file that inherits from TemplateRedirectionPage and changed all my page layout files back to deriving from the PublishingLayoutPage. And then I added the PublishingPageLayout element below every element.
Funny, or oddly, having a refence to the page layout in the Url attribute and not having the PublishingPageLayout element at all is actually valid. It doesn't make sense, because it will produce these faulty pages, but SharePoint actually accepts it and spits out all the pages defined in the ONET.xml
Only thing left now is that since I made the above changes, when I manually create a new page based on a page layout every default webpart (as defined with AllUsersWebPart) is instantiated 5 times. Really don't know where this behaviour is coming from, but at least it's not as serious as not being able to edit/publish my pages :)

Resources