on 06-18-2014 10:59 AM
Hi,
I've got a B2B client that have the concept of a 'product range'. This is a list of products that a customer is allowed to view on the site. Each customer is also assigned to one warehouse so the customer can only purchase products that are in their assigned warehouse. The product range is usually a subset of the products available in the customers assigned warehouse.
I'm looking for the best way to introduce the concept of a product range into hybris.
The initial thought is to have an attribute (a list) on the product model that holds all customer range ID's that are allowed to view the product. I could then have a relation from the range to the product model and set a CMS restriction. The range could be a new model (maybe extending user group) or it could just be a relationship between the existing B2BUserGroup and the product (making use of the list of rangeID's stored against each product).
I can't find anything in hybris that matches this kind of functionality. Are there any great concerns over this method?
Thanks Craig
dont you just hate the inability to add much content to comments.
My comment Craig is to warn :
Be cautious of this. If too many users get updated thats a lot of solr re-indexing.
It might be more optimal to add users to kind of product/ catalog visibility groups and then just export the groups that are visible per product (assuming a user not belonging to a group see's all products).
Heres some items.xml to fuel some thought on the matter.
<collectiontypes>
<collectiontype elementtype="CategoryVisibilityGroup"
code="CategoryVisibilityGroupCollection" type="set" />
</collectiontypes>
<relations>
<relation localized="false"
code="Principal2CategoryVisibilityGroupRelation" autocreate="true"
generate="true">
<deployment table="princ2catVisRel" typecode="26002" />
<sourceElement type="Principal" cardinality="many"
qualifier="principals" collectiontype="set" />
<targetElement type="CategoryVisibilityGroup"
cardinality="many" qualifier="categoryVisibilityGroups"
collectiontype="set" />
</relation>
<relation localized="false"
code="CategoryVisibilityGroup2CategoryRelation" autocreate="true"
generate="true">
<deployment table="catVis2catRel" typecode="26003" />
<sourceElement type="CategoryVisibilityGroup"
cardinality="many" qualifier="categoryVisibilityGroups"
collectiontype="set" />
<targetElement type="Category" cardinality="many"
qualifier="restrictedCategories" collectiontype="set" />
</relation>
</relations>
<itemtypes>
<itemtype code="CategoryVisibilityGroup" autocreate="true"
generate="true" jaloclass="com.hybris.catalogsecurity.jalo.CategoryVisibilityGroup">
<description>
Defines category restrictions
</description>
<deployment table="CatVisGrp" typecode="26004" />
<custom-properties>
<property name="catalogItemType">
<value>java.lang.Boolean.TRUE</value>
</property>
<property name="catalogVersionAttributeQualifier">
<value>"catalogVersion"</value>
</property>
<property name="uniqueKeyAttributeQualifier">
<value>"code"</value>
</property>
</custom-properties>
<attributes>
<attribute qualifier="code" type="java.lang.String">
<modifiers optional="false" write="true" unique="false" />
<persistence type="property" />
</attribute>
<attribute qualifier="catalogVersion" autocreate="true"
generate="true" type="CatalogVersion">
<persistence type="property" />
<modifiers optional="false" />
</attribute>
<attribute type="localized:java.lang.String" qualifier="name">
<persistence type="property" />
<modifiers optional="true" />
</attribute>
<attribute type="localized:java.lang.String" qualifier="description">
<persistence type="property">
<columntype database="oracle">
<value>varchar2(4000)</value>
</columntype>
<columntype database="mysql">
<value>text</value>
</columntype>
<columntype database="sqlserver">
<value>nvarchar(max)</value>
</columntype>
<columntype database="hsqldb">
<value>LONGVARCHAR</value>
</columntype>
<columntype>
<value>varchar</value>
</columntype>
</persistence>
<modifiers optional="true" />
</attribute>
</attributes>
<indexes>
<index name="versionIDX" unique="false">
<key attribute="catalogVersion" />
</index>
<index name="codeVersionIDX" unique="false">
<key attribute="code" />
<key attribute="catalogVersion" />
</index>
<index name="mediaCatalogVersionIdx" unique="false">
<key attribute="catalogVersion" />
</index>
</indexes>
</itemtype>
<itemtype code="CMSCategoryVisibilityRestriction" extends="AbstractRestriction"
autocreate="true" generate="true"
jaloclass="com.hybris.catalogsecurity.jalo.restrictions.CMSCategoryVisibilityRestriction">
<attributes>
<attribute qualifier="superiorCategoryGroup" type="CategoryVisibilityGroup">
<description>Category visibility group which defines visibility for all available categories</description>
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
<itemtype code="Principal" autocreate="false" generate="false">
<attributes>
<attribute qualifier="allCategoryVisibilityGroups" type="CategoryVisibilityGroupCollection">
<modifiers write="false" />
<persistence type="dynamic" attributeHandler="categoryVisibilityGroupsProvider" />
</attribute>
</attributes>
</itemtype>
</itemtypes>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The inverse would be true, the user would see no products if they are not associated to a range. Range changes should only happen once per day at the most so there shouldn't be a re-indexing issue.
Where would you say is the best place to store the range informatiom (i.e. the list of who can see what)? I think it either has to go on the product model or I create a separate type for this.
Hi Craig. Have you found a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Probably going to create a relationship between the user and the product and store a list of user ID's that are allowed to view the product. A SOLR search restriction can then be used to make sure the correct customer sees the correct product. I do no like this solution but I haven't come up with anything better yet.
Hello Craig,
On the consultancy shop, I had to restrict the Solr search using a custom property (country). I remember we used AbstractFreeTextQueryBuilder to filter based on our needs and add it to the defaultCommerceSearchTextPopulator bean.
Right now I am working on showcase to add a component / page that will enable b2b admins to restrict categories for specific B2Bunits. Feel free to come to me and ask me on those matters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
hybris platform offers a powerful way of personalizing the contents of your storefront by using the Advanced Personalization Module, including the functionality you aim to implement. Please check the following links to see if this helps you in this issue:
I hope this answers your question.
Best regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a "kind of" solution for your problem in the hybris wiki: https://wiki.hybris.com/pages/viewpage.action?pageId=141793493
This solution uses an already existing SearchRestriction called "Frontend_RestrictedCategory" which restritcts the visibility of a Category.
The thing is that this solution won't work! 😞 Since the category listing is provided by Solr this products will be still found via full text search. Additionally even the category would be empty since the Solr indexer runs as "anonymous" customer so these "restriced" categories won't even be indexed.
Long story short: There is no reason not to use a SearchRestriction here but keep in mind that you have to tweak the Solr integration somehow to fit your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.