how to configure OOTB "inStockFlag" and "reviewAvgRating" index property as facets - sap-commerce-cloud

Please help to achieve this. I added these two properties from non facets index property to facet index property in solr.implex file. Run the full indexer ,
added customer review for some of the products and approved the status as well in spite of that these two properties are not showing as facets in storefront.
Please guide me step by step how can I achieve this. I have already wasted 2.5 days to achieve the same.
I am using hybris 6.4

First, run the below Impex form the HAC. Don't forget to change apparel-ukProductType with your Indexed type.
$solrIndexedType=apparel-ukProductType
# Facet properties
INSERT_UPDATE SolrIndexedProperty ; solrIndexedType(identifier)[unique=true] ; name[unique=true] ; type(code) ; sortableType(code) ; currency[default=false] ; localized[default=false] ; multiValue[default=false] ; useForSpellchecking[default=false] ; useForAutocomplete[default=false] ; fieldValueProvider ; valueProviderParameters[map-delimiter=|] ; ftsPhraseQuery[default=false] ; ftsPhraseQueryBoost ; ftsQuery[default=false] ; ftsQueryBoost ; ftsFuzzyQuery[default=false] ; ftsFuzzyQueryBoost ; ftsWildcardQuery[default=false] ; ftsWildcardQueryType(code)[default=POSTFIX] ; ftsWildcardQueryBoost ; ftsWildcardQueryMinTermLength ; facetType(code) ; facetSort(code) ; priority ; visible ; facet[default=true]
; $solrIndexedType ; reviewAvgRating ; double ; ; ; TRUE ; ; ; ; productReviewAverageRatingValueProvider ; ; ; ; ; ; ; ; ; ; ; ; MultiSelectOr ; Custom ; 10000 ; true ;
; $solrIndexedType ; inStockFlag ; boolean ; ; ; ; ; ; ; productInStockFlagValueProvider ; ; ; ; ; ; ; ; ; ; ; ; MultiSelectOr ; Custom ; 10000 ; true ;
You can do the same changes from backoffice/hmc.
Go to System > Facet Search > Indexed Type > select your type from list > Find the inStockFlag under Properties filed > scroll to end (right) to edit inStockFlag properties > In popup go to facet setting tab > Mark Facet to true and edit other fields.
Lastly, run the full indexer.

Related

Roles restricting access to import Hot folder throuh impex backoffice hybris

I need an impex that will prohibit the import of data into the hot folder for users of a specific group.
In other i need those buttons to be muted.
image
Appreciate your inputs.
I've tried something like this, but i'm not sure what to write in a gap.
`
$START_USERRIGHTS; ; ; ; ; ; ; ; ;
Type ; UID ; MemberOfGroups ; Password ; Target ; read ; change ; create ;
remove ; change_perm
Role ; ReadGroup ;
;;;; HotFolderMediabatch ;+;-;-;-;
$END_USERRIGHTS`

No read access for Product in backoffice with new usergroup

I created a new usergroup but i'm trying to view the product node and i dont have permisions for read and write that.
I tried to add permissions using this but is not working.
$START_USERRIGHTS; ; ; ; ; ; ; ; ;
Type ; UID ; MemberOfGroups ; Password ; Target ; read ; change ; create ; remove ; change_perm
UserGroup ; xxxxxxxxxxxRole ; ; ; ; ; ; ; ;
; ; ; ; Category ; + ; + ; + ; + ;
; ; ; ; Product ; + ; + ; + ; + ;
; ; ; ; BaseStore ; + ; + ; + ; + ;
; ; ; ; CronJob ; + ; + ; + ; + ;
; ; ; ; Job ; + ; + ; + ; + ;
$END_USERRIGHTS; ; ; ; ;
Simple UserGroup is not respected by backoffice ,to support this create new backoffice role.
A BackofficeRole is an extension of UserGroup that is meant to be used for restricting access in Backoffice (i.e. UI configuration context defines an dimension called principal which actually work exactly on BackofficeRoles). It also introduces an attribute called authorities which extends restriction possibilities (i.e. widget access may be restricted only to specified authorities) - user may use only one role at the moment, but different roles may have same authorities.
You cannot use simple UserGroup then - it will not be respected by Backoffice.
Below you may find examples of restriction capabilities:
<context type="Product" component="myComponent" principal="user1">
...
</context>
<context type="Product" component="myComponent" principal="backofficeRole1">
...
</context>
<widget id="someWidget" widgetDefinitionId="com.hybris.someWidget"
access="backofficeRole1" />
<widget id="someWidget" widgetDefinitionId="com.hybris.someWidget"
access="authority1" />
The new usergroup newUserGroup should be given a read access (or even a write access if required) to the productCatalogVersion in which the members of that group will be able to view (read) the products details of that catalog version (Staged or Online, etc ..)
Here is an example of impex to give newUserGroup read access and write access to XYZ_ProductCatalog
INSERT_UPDATE CatalogVersion; catalog(id)[unique = true]; version[unique = true]; readPrincipals(uid)[mode = append]; writePrincipals(uid)[mode = append]
; XYZ_ProductCatalog ; Staged ; newUserGroupUID ; newUserGroupUID
; XYZ_ProductCatalog ; Online ; newUserGroupUID ; newUserGroupUID
You may modify the above impex to suit your use case.

How to configure customer specific pricing in SAP Hybris through impex?

I want to show the different price for a product to different customer groups in the Hybris.
How to achieve this through Impex?
You can create UserPriceGroup and assign it to the price rows and customer/b2bunit
INSERT_UPDATE UserPriceGroup ; code[unique=true] ; name[lang=en]
; group1 ; "Group 1"
; group2 ; "Group 2"
INSERT_UPDATE PriceRow ; product(code, $catalogVersionStaged)[unique=true] ; currency(isocode)[unique=true] ; price ; net[unique=true,default=false] ; ug(code)[allownull=true] ; unit(code)[default=pieces]
; PRODUCT-1 ; CAD ; 90.00 ; false ; group1 ;
; PRODUCT-1 ; CAD ; 100.00 ; false ; group2 ;
UPDATE Customer ; uid[unique=true] ; Europe1PriceFactory_UPG(code)
; cus1 ; group1
; cus2 ; group2
find the detailed answer here

Hybris faceted search

I have a requirement whereby I have to implement a faceted search,where a user is taken through some questions and suggested a list of products on Hybris.Any approach to help me get started?
Solr supports facet search on its own. Hybris leverages this via the solr configuration. You can manage this through the impex file. There are a lot of fields on SolrIndexedProperty, but I think these are the ones required to control facet search - facet=true, facetType, and facetSort.
INSERT_UPDATE SolrIndexedProperty ; ... facet[default = true] ; facetType(code) ; facetSort(code) ; ...
; ... ; MultiSelectOr ; Alpha ; ...
Here's the full impex statement, in case I missed something.
INSERT_UPDATE SolrIndexedProperty ; solrIndexedType(identifier)[unique = true] ; name[unique = true] ; type(code) ; isAlpha[default = false] ; isNumeric[default = false] ; isAlphaNumeric[default = false] ; sortableType(code) ; currency[default = false] ; localized[default = false] ; multiValue[default = false] ; facet[default = true] ; facetType(code) ; facetSort(code) ; priority ; visible ; useForSpellchecking[default = false] ; useForAutocomplete[default = false] ; fieldValueProvider ; valueProviderParameter ; facetDisplayNameProvider ; customFacetSortProvider ; topValuesProvider ; rangeSets(name) ; displayName ; includeInResponse [default=true]
; yourProductType ; colorFacet ; string ; true ; ; ; ; ; ; ; ; MultiSelectOr ; Alpha ; 7500 ; true ; ; ; colorValueProvider ; ; ; facetNameSortProviderAscending ; defaultTopValuesProvider ; ; "Color" ;false

Hybris Readonly UserGroup

I need to set up a user group which should have access to everything like the admingroup but with readonly rightsg. I know that there is a way to set the access rights for single types, but is there any method which sets the readonly right to all? Also I need to know if there is a type which allows login rights to specific cockpits. The problem is that some users are allowed to access to productcockpit but not into cmscockpit.
Please see the script below, this script enables read only rights for the product cockpit. Please change the same for other cockpits
# -----------------------------------------------------------------------
#
# Import Access Rights for Product Cockpit
#
$defaultPassword=1234
INSERT_UPDATE UserGroup;UID[unique=true];groups(uid)[mode=append]
;myproductmanagergroup;cockpitgroup,employeegroup
INSERT_UPDATE Employee;UID[unique=true];password[default=$defaultPassword];description;name;groups(uid);sessionLanguage(isocode);sessionCurrency(isocode)
;myproductmanager;;Product manager;My Product Manager; myproductmanagergroup;en;ZAR
UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];writePrincipals(uid);
;apparelProductCatalog;Online;myproductmanagergroup,myproductmanager;
;apparelProductCatalog;Staged;myproductmanagergroup,myproductmanager;
$START_USERRIGHTS;;;;;;;;;
Type;UID;MemberOfGroups;Password;Target;read;change;create;remove;change_perm
UserGroup;myproductmanagergroup;cockpitgroup;;;;;;;
# Access Rights for Products & Catalog;;;;;;;;;
;;;;Product;+;-;-;-;-;
$END_USERRIGHTS;;;;;
#Vikrant I was looking for a way to set readonly on every single Item so that this group can't change anything. My final solution is to set readonly right to the Target Item like this:
$START_USERRIGHTS; ; ; ; ; ; ; ; ;
Type ; UID ; MemberOfGroups ; Password ; Target ; read ; change ; create ; remove ; change_perm
UserGroup ; readonlygroup ; ; ; ; ; ; ; ;
; ; ; ; Item ; + ; - ; - ; -
; ; ; ; ProductReference ; + ; - ; - ; -
$END_USERRIGHTS; ; ; ; ;
I had the same issue, the solution is to create user group, then give it user rights for Item - this will apply for all types. And update catalogs with readPrincipals.
INSERT_UPDATE UserGroup; UID[unique = true] ; locname[lang = en] ; description ; backOfficeLoginDisabled[default = false]
; backofficereadonlygroup ; "Backoffice Read Only Group" ; "User has read only access to the Backoffice" ;
$START_USERRIGHTS;;;;;;;;;
Type;UID;MemberOfGroups;Password;Target;read;change;create;remove;change_perm
UserGroup;backofficereadonlygroup;;;;;;;;
;;;;Item;+;-;-;-;-;
$END_USERRIGHTS;;;;;
UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];readPrincipals(uid);
;Default;Online;backofficereadonlygroup;
;Default;Staged;backofficereadonlygroup;

Resources