Posts

Showing posts with the label hac

Delete Hybris Products having duplicate name from HAC

How to delete duplicate product using the flexible search in Hybris? Open  HAC > console > scripting languages Now you can run the below  groovy script 1. Groovy script to get the list of pks to be removed import de.hybris.platform.servicelayer.search.FlexibleSearchQuery; flexibleSearchService = spring.getBean("flexibleSearchService") modelService = spring.getBean("modelService") def findProductWithSameName() { query = """ select MIN({p.pk}) as pks from {Product! as p JOIN CatalogVersion as CV on {p.catalogversion}={CV:PK} and {CV:version} = 'Online' JOIN Catalog as C on {CV:catalog}={C:PK} and {C:id}='myProductCatalog' } group by {p:name} having count(*) > 1"""; flexibleSearchService.search(query).result; } findProductWithSameName().each { println it.code; //modelService.remove(it); } 2. Test Remove script import de.hybris.platform.servicelayer.search.FlexibleS

How to prevent the system initialization in the Hybris HAC?

Lock the system initialization: You can avoid accidental initialization or update the system by locking those options from HAC. Now when we really want to perform this operation we can unlock it and use the functionality. To lock the system for initialization and update add the unlocking ( system.unlocking.disabled=true ) properties to your  local.properties  file and rebuild your system. Unlock the system initialization: Let's you want to perform an update system from HAC but that option is locked. Don't worry, you can easily unlock it without restarting the system and perform an operation. Set system.unlocking.disabled to false (HAC>configuration) Go to  /hac/platform/init , Click on Unlock. Wiki reference Block/Redirect URL from the webserver: In case, your business stakeholder wants to block initialization and update system from HAC. The idea here is to change its request mapping. If you have a web server in place for admin console, You can blo