Posts

Showing posts with the label SAP Hybris

How to add custom Sort logic for Sort By in Hybris?

Sometimes you may be required to have custom sorting logic for Sort By options in your category or products listing page. In this post, I will explain to you all the required steps. All you need is to define custom SortProvider. I'm taking the example of sort by size. Note:  This post is based on Hybris version  V6.0 ,  facetSort(code)  is deprecated in  SolrIndexedProperty  type so it might be removed from the latest release. Define your SortProvider( sizeAttributeSortProvider ) bean First, you need to define comparator class ( SizeAttributeComparator ) and bean definition for the same. Now declare sortProvider( sizeAttributeSortProvider ) bean as below which point to OOTB class ( DefaultFacetSortProvider ). <bean id="sizeAttributeSortProvider" class="de.hybris.platform.solrfacetsearch.config.impl.DefaultFacetSortProvider"> <property name="comparator" ref="sizeFacetAttributeComparator"/> </bean> <b

How to setup user account on linux systems for Hybris?

Why you should avoid running applications as root I've often come across posts on forums or other websites where you see people joking in such a manner about running/logging in as root as if it's something awful and everyone ought to know about it. However, there isn't much that a search reveals on the matter. It may be widely known to Linux experts, but I really don't know why. I remember always running as root when I first tried Linux years ago (Redhat and Mandrake) and don't remember running into any problems because of that. There are actually some distros that have a bright red background with alert signs all over it as wallpaper for the root user (SuSe?). I still use the "Administrator" account for regular use on my Windows installation and haven't ever run into any problems there either.  [source] How to create a User Account on Linux systems for Hybris Setup? Open a shell prompt. If you are not logged in as root, type the command

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

SAP Hybris Installation and Deployment Architecture - [Part2]

If you not gone through Part1 , then please read it first. Centralized logging Hybris OOTB there is  centralized_logging  recipes, which can be used if you have  Docker  base setup. Anyway, you can set up your own  ELK Stack  (Elasticsearch-Logstash-Kibana), which is a good combination as Log Management Solution (Open Source). You can use Redis for the large enterprise solution to decouple the Log Server & Log Shipper. Tools: Logstash: As a log shipper and a log indexer Redis: As a broker – used as a queuing system ElasticSearch: As a log indexer – store and index logs Kibana: As a front-end viewer – a nice UI with useful extra features Install & configured  above stack to get consolidated logs from all application servers. Advanced Application Monitoring SAP Hybris Commerce Advanced Application Monitoring is a tool for analyzing network traffic within the Hybris system. Advanced Application Monitoring is vital for administrating and monitoring the he

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