on ‎2019 Aug 05 7:40 AM
Hi,
I'm trying to integrate the product recommendations into the SAP Commerce system and need some help.
Some basic informations before:
For the synchronization of products we use the product codes, we got from our customers external service, a 18-digit unique number. This process works fine, product codes in SAP Marketing Cloud and Commerce are equal (as far as i can see them on the product view in the Marketing Cloud).
What I have done till now:
1. I followed the instructions of setting up the recommendation component like Configuring Recommandation Components
The Problem: After installing the addOn and following the configuration steps to our custom storefront extension, there was no data of recommended products.
So I startet to analyze the source code of the sapymktrecommendation extensions and found the
com.hybris.ymkt.recommendation.services.RecommendationService. This service is basically used to request recommendations from SAP Marketing Cloud system.
2. I wrote a custom test controller using the RecommendationService to get recommendations.
I created a RecommendationContext with the data I got from Marketing Cloud (Recommandation View) and the created component of step 1.
The request method I wrote
@RequestMapping(value = "prod", method = RequestMethod.GET)
public ResponseEntity<String> testProductRecos() {
final RecommendationContext context = new RecommendationContext();
context.setLeadingProductId(null);
context.setScenarioId("SAP_TOP_SELLER_HOME_PAGE");
context.setIncludeCart(true);
context.setIncludeRecent(true);
context.setLeadingItemDSType("SAP_HYBRIS_PRODUCT");
context.setLeadingItemType("G");
context.setCartItemDSType("SAP_HYBRIS_PRODUCT");
final List<ProductRecommendationData> productRecommendations = recommendationService
.getProductRecommendation(context);
final String productCodes = productRecommendations.stream.map(ProductRecommendationData::getProductCode)
.collect(Collectors.joining(", "));
return new ResponseEntity<String>(productCodes, HttpStatus.I_AM_A_TEAPOT);
}
As response I got a list of for me unidentifiable hexadecimal codes, e.g.:
6104013083D752AA16003BFA5CF0E45B, 7FF0003083D752AA16003BFA5CF0E45B, 6BDC003083D752AA16003BFA5CF0E45B, 980B013083D752AA16003BFA5CF0E45B, 238C0020FDE7F0C016003BFA9DADCD04, FD380C009B58078D16003BFA0129F0D1, 2FB70470051D9DB316003BFA61D0ED58
I tried different parameters in the context creation, but the results were everytime the same.
So my questions are:
I hope, I collected all necessary data for my problem.
Thanks in advance & best regards
Torsten Mittag
Request clarification before answering.
Hi Torsten Mittag,
You have to define a Recommendation model type with a right source (product Origin ID) from where the products should be retrieved.
e.g SAP Commerce product - if you are getting the product from SAPCommerece.
Use the app : Recommendation model type to define a new source (Recommendation Type:)
Regards,
Sandeep Kulkarni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandeep Kulkarni,
thanks.
This solved the problem, now I get the correct product codes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 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.