Posts

Showing posts with the label hybris

How to add or update Sort by Options in the Hybris?

Case1: Update/remove existing Sort by option If you are looking for update/remove existing Sort by option then you can do it by simply through hmc/backoffice/impex. Go to back-office  SolrIndexedType  and open your Indexed type Go to Solr Sorts tab: Here you can see the list of Sort By option which you can update/delete Case2: Add a custom Sort by option without custom sort logic In case if you want to add new custom Sort by option without any custom sorting logic then you can do it without changing any code. Let's assume I want a new sort by option based on  isPromotedProduct  (boolean) of the Product type. Just  follow the below steps... 1) Define SolrIndexedProperty You need to have SolrIndexedProperty for your attribute and you need to do Solr indexing to reflect its value in the Solr server. Here, I am assuming you know this part very well or you may already have SolrIndexedProperty defined. INSERT_UPDATE SolrIndexedProperty ; solrIndexedType(identifier)[un

[yjavac] 1. ERROR cannot be resolved to a type in Hybris?

Extensions can have dependencies on one another. While working with Hybris you come across a scenario, where you want to import a class from the different extension. The build only works if the required extension is available. Ensure the below steps to works it smoothly. Dependencies to Non-Platform(not located in  /platform/ext ) Extension The required extension should be there in  localextensions.xml Add the required extension in  extensioninfo.xml  (e.g  <requires-extension name="hmc"/> ) of the dependent extension In your eclipse(IDE), add required extension in  build path  of the dependent extension to resolve IDE dependecy. Note:  Adding required extension in IDE build path won't resolve extension dependency of your platform. It only resolved by  extensioninfo.xml Rebuild the system ( ant clean all ) Dependencies to Platform Extension By default, all extensions have the dependency on Platform extension(located at  /platform/ext ). There

How to change fromEmail Address of an email in Hybris?

If you want to reset or change  from emailAddress  for Hybris email, you can do that using Impex. You need to find emailPage for your email. then you can set or change  fromEmail  and  fromName  like below. # Email Pages UPDATE EmailPage ; $contentCV[unique=true] ; uid[unique=true] ; fromEmail[lang=$lang] ; fromName[lang=$lang] ; ; CustomerRegistrationEmail ; "helpdesk@gmail.com" ; "Customer Services Team" ; ; DeliverySentEmail ; "contact@gmail.com" ; "Customer Support Team" ; ; ForgottenPasswordEmail ; "test@gmail.com" ; "Customer Services Team"

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 support multiple toAddress CC BCC and attachments in hybris email?

Scenario We want to send email to multiple addresses, also want to support the email attachments. Unfortunately, it's not happening in OOTB action. Background Hybris OOTB  EmailService  which is responsible to send email is supporting every field like attachments, BCC, etc. But  EmailGenerationService  is not populating those fields into  EmailMessageModel . So good news is we only need to override generation service to feed all require data to  EmailMessageModel Solution We have to define our custom attributes in BusinessProcess itemType to stores the values and access it in the later process. Also, we have to override generate method of  DefaultEmailGenerationService  which responsible to generate  EmailMessageModel . Let's see it step by step. 1) Define custom attribute in BusinessProcessModel To do so, you have to define attributes like below in your  *-items.xml  file. Now build your server( ant clean all ), which will generate  BusinessProcessModel