Posts

How to add script tag or source code in hybris WCMS component ?

Requirement : To enable google structure data for Organization and WebSite search I want to add the script (application/ld+json) on Hybris homepage using WCMS component. Problem : I have chosen the paragraph component and added it to the one of available WCMS slot. But not able to add a script in the editor, as XSS filter remove script while saving to DB. Workaround : Disable XSS filter for while using  xss.filter.enable= false  (from hac), save the script (editor > select source > past your script) and then agian enable the xss filter. Structure data application/ld+json: <script type='application/ld+json'>  {   "@context": "http://www.schema.org",   "@type": "Organization",   "name": "MyCompnay USA, Inc.",   "url": "https://www.MyCompnayusa.com/",     "logo": "http://www.MyCompnayusa.com/web/media/system/layout/images/logo.gif",

How to create catalog aware ItemType in Hybris?

Scenario Create an Item type which can have two versions(stage/online) like the product type. In simple word, it should be catalog aware. Solution We can declare any Item type as catalog aware using in *-items.xml < itemtype code = "MyConfiguratorSetting" extends = "GenericItem" autocreate = "true" generate = "true" > < deployment table = "ConfiguratorSettings" typecode = "1301" /> < 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 - prope

Limit the result rows in flexible search

Sometimes, we want to limit the no. of rows in results while we testing the flexible search query from the HAC. Flexible search query supports most of the SQL clauses. So we can use LIMIT or TOP in your query but it's database specific. it might not work with Oracle. e.g SELECT * FROM {Product} LIMIT 100 or SELECT TOP 100 * FROM {Product} For Oracle SELECT * FROM {Product} WHERE rownum <= 100 Though API final FlexibleSearchQuery query = new FlexibleSearchQuery("SELECT * FROM {Product}"); query.setCount(100);