Backoffice Customization

What is Backoffice Framework?

Backoffice Framework is new SAP Hybris Backoffice Framework designed to facilitate the creation of business tools and user interfaces in an easy and consistent way. It is shipped with SAP Hybris Commerce in the backoffice extension. It makes it possible to create a variety of components that can be reused later on in all kinds of applications. These components are standalone and deployable widgets can be easily modified without touching the code base.

In this tutorial, we will show you, how to create a custom widget using the Backoffice Framework. Our custom widget will have one input and one submit button. Suppose we enter some input and press the button, If the entered value is an integer then one pop up appears and it contains a message that Input value is an integer otherwise it will display an error that entered input is not an integer.

Steps to create a custom widget

  1. Create a custom  backoffice extension

  2. Create a widget definition

  3. Creating a widget view

  4. Create a service for widget/Use existing service for a widget

  5. Create a controller for the widget

  6. Build and start the server

  7. Deploy the widget

1. Create a custom  backoffice extension

Here we will create one custom backoffice extension named hybrisdiary using the BackOffice template extension. In this custom backoffice extension (hybrisdiary) we can create our custom widgets. To create custom backoffice extension(hybrisdiary) follow the following steps:-

  1. Open the command prompt and navigate to  <%HYBRIS_HOME_DIR%>/hybris/bin/platform directory and run the setantenv.bat file as shown in below image.setantenv.bat
  2. Now run ant extgen command.ant extgen
    Extgen prompts you to specify values for the technical aspects of an extension. Extgen comes with default values for all these technical aspects.
    These default values are defined in the project.properties file in the extgen directory. The default value is displayed in brackets ([ and ])
  3. Now we enter ybackoffice as shown in below image.ybackoffice
  4. Now enter extension name hybrisdiary as shown in below image.
    hybrisdiary custom backoffice name
  5. Now enter the package name(de.hybris.hybridiary) as shown in below  image
    package name
  6. If you want to register  SASS support for your extension then press enter otherwise type false and then press enter. Here we are using default value so we will press enter.
  7. If you want to create sample widget then press enter otherwise type false and then press enter. Here we are creating sample widget so will press enter.
  8. If you want to create a sample style sheet then type true and then press enter. If you do not want to create a sample style sheet then simply press enter.
    SASS extension sample widget sample style sheet
  9. Navigate to <%HYBRIS_HOME_DIR%>/config and open local.properties file and specify the following entry and save it.
    backoffice.sass.enabled=true
  10. Now run ant sasscompile from the platform.
    ant sasscompile
  11. Now we will add our custom backoffice extension(hybrisdiary) to localextensions.xml
    localextensions.xml
  12. Now we will do ant clean all.
    ant clean all

If the build successful then your custom backoffice extension successfully generated. If you are using eclipse then import your custom backoffice extension in to eclipse.

2. Create a widget definition

To create a widget definition, we must keep in mind that widget-definition id must be unique. If your widget-definition id matches with existing widget-definition id then your new widget will not appear on the list of widgets in the choose widget wizard. Now do the following steps to create the widget definition:-

  1. Navigate to hybrisdiary->backoffice->Resources->widgets and create a new folder called as mycustominput
    mycustominput folder location
  2. Now create a definition.xml file inside the newly created folder(mycustominput).
  3. Now add the following lines of code to the file(definition.xml).

    definition.xml
    definition.xml

3.Creating a widget view

The view of our widget will be defined in the ZUL file and the name of the file must match with last part of the widget ID as defined in the definition.xml file. The last part of widget ID is mycustominput so the view file name will be mycustominput.zul. In mycustominput.zul file, we will define all frontend component. To check whether the entered input is an integer or not we need one textbox for input and one button to submit. So we will define one textbox and one button in mycustominput.zul file. Now follow the following steps to create the widget view:-

  1. Now create a mycustominput.zul file inside the mycustominput folder.
  2. Now add the following lines of code to the mycustominput.zul file.
    mycustominput.zul
    mycustominput.zul

     

4.Create a service for widget/ Use existing service for a widget

For our example, we need some service to do some action. Either we can create our custom service to do some logic or we can use existing services. In our example, we will create a custom service that will check that the entered input is an integer or not. To create a service for our custom widget, we need to follow the following steps:-

  1. Navigate to hybrisdiary->src folder and create MyCustomInputService.java file in de.hybris.hybrisdiary.mycustominput package.
  2. Add the following lines of code to the MyCustomInputService.java file.

    MyCustomInputService.java file
    MyCustomInputService.java
  3. Navigate to hybrisdiary->resources and open hybrisdiary-backoffice-spring.xml file and define the bean for MyCustomInputService as shown in below image.
    mycustominputservice bean
    mycustominputservice bean

     

5. Create a controller for the widget

Here we have not defined any action for submit button so when we click on the button nothing will happen. To do some action we need to define a controller for the widget. To create a controller for the custom widget we need to follow the following steps:-

  1. Navigate to hybrisdiary->backoffice/src and create MyCustomInputController.java in de.hybris.hybrisdiary.widgets.mycustominput package.
  2. Add the following lines of code to the file.

    MyCustomInputController
    MyCustomInputController.java
  3. Navigate to hybrisdiary->backoffice->Resouces->widgets->mycustominput and open definition.xml file and we add a controller class to this file as shown in the image.

    definition.xml
    definition.xml

6.Build and start the server

Now we will build the system by running ant clean all and we start the server by running the hybrisserver.bat file.

7.Deploy the widget

Now we will deploy our custom widget. To deploy the custom widget do the following steps:-

  1. Open the internet browser.
  2. Enter https://localhost:9002/backoffice  in the browser’s address bar.
  3. Enter your credentials and log in.
    backoffice login
  4. Press F4 to enter into Application Orchestrator mode and click on the symbol(+ symbol inside an orange circle) to add the new widget as shown in below image.
    Application Orchestrator mode
    Application Orchestrator mode

    The choose widget appears, which contain all the available widgets and choose My Custom Input widget. You can easily learn the process of adding a widget to backoffice by observing the image.
    add widget process

  5. Now press F4 to enter into normal mode and you will see the newly added widget in backoffice.
    new widget in backoffice
  6. Now we enter 54 in the input box and which is an integer and we press the submit button. Now message box will appear which show us that “input value is an integer“.
    working widget

Navigation management in SAP Hybris Commerce

Navigation management through impex

When we create a website based on an existing content catalog, a default navigation structure is created for our content catalog. If we create a website based on a new content catalog, we must build navigation structure for our new content catalog. So we will learn here how to create navigation nodes using impexes.

Create new navigation node using impex

To explain this we will create one new custom navigation node in apparel storefront. In apparel storefront, there are 5 navigation nodes as shown in the image and we will add another navigation node at the end of navigation nodes.

Apparel Store
Apparel Storefront

Steps to create a new navigation node

Step-1

Create a new CMSNavigationNode. Like created in below image.

CMSNavigationNode

Step-2

Create a new CMSNavigationEntry for CMSNavigationNode. Like created in below image.

CMSNavigationEntry

Step-3

Create a new CMSLinkComponent. Like created in below image.

CMSLinkComponent

Step-4

In this step, we do localization of CMSNavigationNode and CMSLinkComponent as shown in the image

Localiztion

The complete impex will look like this.

create_navigation_node
new_navigation_node.impex

Here we assume that your server has started already. Now run the above impex(new_navigation_node.impex) in HAC(Hybris Administration Console) and synchronize the content catalog(apparel-ukContentCatalog).

Now access the apparel storefront and you can clearly observe newly created navigation node. In below image, you can see new custom navigation node.

Apparel store with new node
Apparel store with new navigation node

Create Children nodes of Custom navigation nodes

Now we will create children of above-created navigation node. To create children of above-created navigation node, we need to follow the following steps

Step-1

Create a new CMSNavigationNode. Like created in below image.

ChildrenCMSNavigationNode

Custom Brands Nav Node is a child of Custom Nav Node and Custom Brands Nav Node is the parent of bitbyte Link and hybrisdiary Link.

Navigation tree structure

Step-2

Create a new CMSNavigationEntry for children nodes. Like created in below image.

CMSNavigationEntry For Children

Step-3

Create a new CMSLinkComponent. Like created in below image.

CMSLinkComponentForChildren

Step-4

In this step, we do localization of CMSNavigationNode and CMSLinkComponent as shown in the image.

Children's localization

The complete impex will look like this.

Complete impex for children node
new_navigation_children_node.impex

Here we assume that your server has started already. Now run the above impex(new_navigation_children_node.impex) in HAC(Hybris Administration Console) and synchronize the content catalog(apparel-ukContentCatalog).

Now access the apparel storefront and Hover on custom navigation node and you can clearly observe newly created children(HYBRISDIARY and BITBYTE) of custom navigation node. In the below image you can observe.

Apparel store with Childrens
Apparel store with new navigation node and with its children

Commerce Quotes in SAP Hybris Commerce

Commerce Quotes

Commerce quotes enable buyers to create the quote and negotiate the final price of an order using the storefront. The quote can be negotiated by both parties(user and seller) until an agreement is reached, at which point the buyer checks out the quote and places an order.

Who can Create quotes?

  1. Buyers create quotes using their session cart, and then submit the quote requests to their sales representative. Buyers can only request quotes if the cart value is more than a defined amount ( default value is 25000 but this can be configured). The sales representative then adjust the quote and makes a vendor quote for negotiation. Both roles have the flexibility to modify the quote during the negotiation process, they can add, remove and comments. The quote is sent back and forth until both parties agree to the terms.buyerquote                          Diagram:- The quote process when a buyer initiates a quote
  2. A sales representative can also create quotes for their buyers using ASM(Assisted Service Module). A quote created or modified by the sales representative must be approved by the vendor if the amount is above defined threshold ( default value is 75000), at which point it becomes a legally binding vendor quote. If the buyer agrees with the terms, vendor quote is then converted to an order, which must be approved by the buying organization.salesrepresentative

Diagram: quote process when a sales representative initiates a quote

Quote Negotiation Process

There are three user roles that are involved in the quote negotiation process.

  1. Buyer:- The buyer submits quote requests to the sales representative, and then decides to accept or reject the vendor quotes submitted by the sales representative
  2. Sales Representative:- The sales representative receives the buyer’s quote request and modifies it to make an attractive vendor quote. The sales representative can also create a quote on buyer’s behalf.
  3. Seller Approver:- The seller approver must approve any vendor quotes submitted by the sales representative that exceeds the vendor’s authorization threshold.

Quote Status in quote negotiation process

Each user role can review the status of the quote to see where in the negotiation process it is. The quote status that appears in the storefront depends on the role that is viewing the quote. Any changes made to a quote by one role are not visible to any other role until the quote is submitted for the next step in the process.

  1. Quote Status for buyer:- During the negotiation process, these are the quote status visible to the buyer
  • Draft:-Quote created by the buyer but not submitted to a sales representative. The buyer can edit, submit or cancel the quote.
  • Submitted:-Quote sent to the sales representative. The buyer can’t edit or cancel the quote and must wait to get a vendor quote from the sales representative.
  • Ordered: –A vendor quote that was accepted and ordered.
  • Cancelled:-Quote cancelled by the buyer.
  • Vendor Quote:-The legally binding vendor quote from a sales representative. The buyer can

a) accept the vendor quote and check out the order.

b) cancel the vendor quote

c) reject the quote and continue negotiation

d) modify the vendor quote, which also rejects the vendor quote and continue the negotiation.

2. Quote Status for Sales Representative:-These are the quote statuses are visible to sales representative during the negotiation process.

  • Draft:-Quote that the sales representative created or modified, but has not submitted by the vendor quote yet. A sales representative can either edit the draft quote or submit a vendor quote.
  • Requested:-Quote that has been submitted by the buyer or that has been rejected by the seller approver. A sales representative can either edit it or submit a vendor quote.
  • Submitted: –A legally binding quote submitted by the sales representative. Sales representative can’t make any modifications.
  • Cancelled:-Quote cancelled by the buyer. Sales representative can’t make any modifications.

3. Quote Status for Seller Approver:- The quote status indicates which vendor quote the approver must act on

  • Pending: –A vendor quote submitted by the sales representative that exceeds the vendor approval threshold. This is the only status that the seller approver can act on.
  • Rejected: –A vendor quote that was rejected by the seller approver.
  • Approved: –A vendor quote that was approved automatically because it did not exceed the vendor’s threshold.
  • Cancelled:-A vendor quote or quote that was cancelled by the buyer.

Enable Commerce Quote in Storefront

Commerce quote is implemented in the powertools storefront by default. But here we will enable commerce quote in Apparel storefront.

Commerce quote is enabled by a switch to set to true in the project.properties file of the apparelstore.

Navigate to <%HOME _DIR%>/config and open the local.properties file and add properties to enable quote and restart the server

enablecommercequotesinapprelstore

Change the quote threshold

Buyers can only request quotes if the value of their cart is more than a certain value and that certain value is called as quote threshold. The default quote threshold value is 25000. We can modify this by following two ways

  1. Modifying project.propertiesTo change the default quote threshold value navigate to <%HYBRIS _DIR%>/config and open the local.properties file and add the following property and restart the server.

updatedquotethreshold

  1. Using the HAC(Hybris Administration Console)To change the minimum quote amount threshold using HAC
    1. log in to HAC
    2. Navigate to Platform->Configuration
    3. In the search field, enter quote.request.initiation.threshold quotethreshold
    4. Enter the required threshold amount in the value field.
    5. Click Apply all.

Change the seller approver threshold

Vendor quote that exceeds a vendor’s authorization threshold must be approved, otherwise, they are automatically approved. We can modify the seller approver threshold by following two ways

1. Using HAC(Hybris Administration Console)

To change the authorization threshold using HAC

  • log into HAC
  • Navigate to Platform->Configuration
  • In the search field, enter commerceservices.quote.seller.auto.approval.thresholdupdatesellerthreshold
  • Enter the required threshold amount in the value field.
  • Click Apply all.

2. Change in local.properties

To change the authorization threshold navigate to <%HYBRIS _DIR%>/config and open the local.properties file, add the following property and restart the server

autosellerapprovalthreshold

Steps involved in achieving quote negotiation process in Apparel storefront

Create and Submit quote:-

we added items to cart and our total cart value is more than quote threshold value so we request a quote by clicking on request a quote button in the cart page as below:

requestquote

In this scenario, we are assuming that buyer is already logged in the storefront. Now we are redirected to quote draft page and here we will modify the quote name and add a quote description and after that, we will click on submit quote button.submitquote

Making a Vendor Quote:-

To work on a quote for a customer, sales representative log into ASM(Assisted Service Module) and start a session for the customer. Sales representative use the quotes listing page to see if there are any quote requests that need their attention. The quote listing page is accessed by navigating to my-account->my-quotes. The listing displays all quotes that have been submitted by the buyer. As you can see in below image

quotelisting

Clicking the quote name(Vinay Sharma quote request) in the listing loads the details page for that quote.

quotedetails

Sales representative clicks on edit quote button.

Now click on the discount link below sub-total and it will open discount model. Here sales rep will enter the discount related data. In our case, we are providing 5% discount. You can observe in below images

discountlink

discount

Clicking submits quote creates a legally binding vendor quote that the buyer can accept. Our quote is below the threshold, so it is automatically approved.

Now Buyers can view all their quotes by navigating to my-accounts->my-quotes

vendorquote

In our scenario, we are assuming that user happy with the vendor’s quote so he accepts and checkout.

acceptingaquote

New features in SAP Hybris Commerce 6.6

New features in SAP Hybris Commerce 6.6

The SAP Hybris Commerce release 6.6 includes key enhancements, focus on Enabling Consent and Personal Data Management. The following features are included in SAP Hybris Commerce 6.6 :-

  • GDPR(General Data Protection Regulation)
  • SAP Hybris Customer Experience Enhancements
  • Enhancement to Search and Navigation
  • SAP Hybris Product Content Management
  • SAP Integrations

GDPR(General Data Protection Regulation)

SAP Hybris Commerce 6.6 includes key enhancements to enable organizations to implement processes to be compliant with the GDPR. These capabilities include consent management, security, encryption, reporting, and data management. The new GDPR feature include:-

  1. Consent Management

    Consent management offers better transparency and customer engagement by allowing users to grant consent for their personal data to be captured and processed.

  2. Personal Data Reporting

    Personal Data Reporting allows the reporting of personal customer data that is captured, to be generated and provided to customers.

  3. Customer Account Closure

    Customer Account Closure allows customers to close their website accounts at any time using self service.

  4. Personal Customer Data Annotation Framework

    Personal Customer Data Annotation Framework allows the easy configuration of personal customer data so it can be flagged and used for Personal Data Reporting.

  5. Personal Customer Data Retention/Erasure Framework

    Personal Customer Data Retention/Erasure Framework provides the ability to retain or delete a customer’s personal data based on legal/configurable retention periods.

  6. Generic Audit

    Generic Audit stores all personal customer data changes. It allows the storage every change made to all instances of given data type. You can enable what data items get audited at the properties level with type-level granularity.

 Advantages

  • Enable compliance of General Data Protection Regulation.
  • Minimize business disruption.
  • Earn customer trust and confidence.

SAP Hybris Customer Experience Enhancements

  1. SmartEdit for Customer Experience

    SmartEdit for SAP Hybris Customer Experience provides an easy and intuitive way to edit and manage your website across all touch points from a single interface. The following features and framework enhancements have been introduced to SmartEdit in SAP Hybris Commerce 6.6

    • Cloning Components
    • Moving Pages to trash
    • Converting shared slots to non-shared slots
    • Framework improvements, such as a new build system and management of nested components.
  1. Personalization

    SmartEdit for SAP Hybris Customer Experience provides an easy and intuitive way to edit and manage your website across all touch points from a single interface. The following features and framework enhancements have been introduced to SmartEdit in SAP Hybris Commerce 6.6

    • Cloning Components
    • Moving Pages to trash
    • Converting shared slots to non-shared slots
    • Framework improvements, such as a new build system and management of nested components.

Advantages

  • Increase flexibility of personalization.
  • Enhance customer experience.
  • Drive sales and increase conversion.

Enhancement to Search and Navigation

Search and Navigation capabilities allow you to configure how your customers browse through category navigation and search for products based on keywords or facets. The following features are new in SAP Hybris Commerce 6.6

  1. Enhanced search experience with Personalization

    You can easily apply personalized search settings by applying Search Profiles for selected Target Group on the top of the search Profiles that had been already activated in the Activation Set. To provide even more targeted experience, you can activate Search Profiles for different Target Groups and they will be all combined together if the user qualifies for more than one Target Group.

  2. Improved Solr Security

    The SAP Hybris Commerce 6.6 comes with support to encrypt communications to and from Solr, and between Solr nodes, using SSL. SAP Hybris Commerce 6.6 also offers support for authentication and authorization using the security framework of Solr.

  3. Solr Upgrade to 7.1

    In this release they have upgraded to the new Solr major version 7.1 to keep up with Solr enhancements.

Advantages

  • Offer personalization experience for product search.
  • Drive sales and increase conversion.

SAP Hybris Product Content Management

With the SAP Hybris Commerce 6.6 release they have introduced a new Microsoft Excel Import/Export Feature and enhanced the collaboration Center with the Workflow Visualization feature.

  1. Microsoft Excel Import/Export

    SAP Hybris Commerce 6.6 would allow you to fulfill two scenarios

    • Export selected products and perform a mass editing through the spreadsheet and then re-import them again.
    • Download an empty Excel sheet that is pre-populated with all the attributes defined in your system, and import new products using the this Excel template.

    This new feature of Product Content Management(PCM) will make the life of product content managers a whole lot easier.

  2.  The Workflow Visualization

    The Workflow Visualization allows you to visually see the workflow. With the SAP Hybris Commerce 6.6 release they have also introduced a feature that allow you to clone a product. This serves as a base for an extended feature where you will be able to clone a product multiple times.

Advantages

  • Enhance usability.
  • Increase flexibility of the tool.
  • Enable higher productivity.

SAP Integrations

SAP Integrations provides a framework for connecting the omni-commerce capabilities of SAP Hybris Commerce with other SAP products. The release note cover the following

  1. SAP Back-End Integration: SAP S/4HANA and SAP ERP

    The following feature are in the new release:-

    • Allows the cancellation of return orders.
    • Fixed the issue regarding the modification of refund amount by customer support agent using Backoffice. The modified refund amount is now reflected in the back end.
    • Data Privacy Management.
  1. SAP CPQ for Product Configuration

    SAP CPQ for product configuration provides access to a comprehensive solution to manage personalized and customizable products in and with SAP Hybris Commerce. The following feature are new in the release:-

    • Enhancements for product configuration rules.
    • Switch for option price.
  1. SAP Product Configuration Integration

    The SAP Product Configuration integration provides access to a comprehensive solution to manage personalized and customizable products in and with SAP Hybris Commerce Cloud. The following feature are new in this release:-

    • Support of multilevel products.
    • Conflict handling.
    • Reconfiguration for product configuration rules.
    • Switch for option price.
  1. SAP Hybris Marketing Integration

    SAP Hybris Marketing integration allows you to offer your customers personalized interactions and shopping in an online store. The following feature are new in this release:-

    • Data privacy Management.
    • Campaign restriction in SmartEdit.
  1. SAP Hybris Cloud for Customer Integration

    The SAP Hybris Cloud for Customer integration with SAP Hybris Commerce 6.6 includes quote replication developments. The following feature are new in this release:-

    • Sales quote replication from SAP Hybris Commerce to SAP Hybris Cloud for Customer.
    • Update the commerce quote from SAP Hybris Cloud for Customer with the price and discounts.
    • Convert quote to sales order and replicate to SAP ERP or SAP S/4HANA.
  1. SAP Digital Payment Integration

    SAP Hybris Commerce integration with SAP Digital Payments enables a B2C customer to register a credit card, fetch the card details and authorize the payment during the item checkout process. The following features are new in this release:-

    • Digital payments integration is avaialble with B2B scenario as well.
    • The existing credit card can be removed from the My Accounts -> Payment Details ->page.
    • If an order is returned, then the payment done using credit card will be reversed.
    • The configurations are now made available in the Backoffice Administration Cockpit.

Advantages

  • Advanced campaign management capabilities.
  • Additional integration scenarios.
  • More end-to-end processes.
  • Better customer experience.

AddOn Concept

AddOn Concept

AddOns are built on top of the existing SAP Hybris Commerce to extend the functionality of the SAP Hybris Commerce Accelerator. AddOns are a type of extension that allow you to add front end files(such JSP, HTML, CSS and JavaScript files, as well as images) from within your own AddOn, Instead of modifying the storefront-end files directly.

Using AddOns, you can extend the functionality of Hybris Commerce Accelerator without editing the core code base. The core code base in this context means Hybris Platform, and all additional extension delivered with Hybris Commerce Accelerator. An AddOn is a regular extension that may or may not provided additional front-end components to Hybris Commerce Accelerator.

Advantages of AddOn Concept

  1. AddOn file kept separate from the rest of the front-end files.
  2. When you upgrade the Accelerator, it will not overwrite your files.
  3. You can easily remove your AddOns without refactoring the code of your whole extension.

Creating AddOns

To create your custom AddOn follow the following steps:

1.Open the command prompt and

navigate to the <%HYBRIS_HOME_DIR%>hybris/bin/platform directory.

navigatetoplatform

2.Now run the setantenv.bat file. Do not close the command prompt.

setantenv

3.Run the following command to create your custom AddOn

ant extgen -Dinput.template=yaddon -Dinput.name=myaddon -Dinput.package=com.myapp

Before running above command you can observe that inside hybris/bin/custom folder only single extension(bitbyte)

before creation of addon

Now Run the following command from platform

create addon

After running the above command you can see your custom AddOn inside hybris/bin/custom folder.

hybris diary addon

4.Configure localextension.xml file

Add your custom extension (AddOn) to <%HYBRIS_HOME_DIR%>/hybris/config/localextensions.xml

localextenstion.xml
localextensions.xml

now rebuild the Hybris system by running ant clean all .

ant clean all

Installing an AddOn for specific storefront

The addoninstall tool allow you to configure an AddOn for a specific storefront. It also adds the AddOn to the extensioninfo.xml file of the storefront, and generates the relevant project.properties file for the AddOn.

Now follow the following steps to install AddOn

  1. Before running ant addoninstall command ensure that addonsupport extension is listed in localextensions.xml file.
addonsupport extension in localextension.xml
localextensions.xml

Also ensure that the AddOn and storefront extension that you want to install are listed in localextensions.xml file.

2.Now run the following command to install the AddOn

ant addoninstall -Daddonnames="addonname" -DaddonStorefront.<storefrontTemplateName>="StoreFront"

addoninstall

3. When addoninstall has finished running successfully, rebuild the Hybris system by running ant clean all .

Uninstalling an AddOn for a specific storefront

The addonuninstall tool can be used to remove an AddOn from the storefront.

Now run the following command to uninstall the AddOn

ant addonuninstall -Daddonnames="addonname" -DaddonStorefront.<storefrontTemplateName>="StoreFront"

addonuninstall

When addonuninstall has finished running successfully, rebuild the Hybris system by running ant clean all .

 

Flexible Search Caching with TTL

images

 

Flexible queries are already cached in hybris commerce which provide good performance in most of projects. Generally, hybris regions cache performs well when system has more read of data than writes. Frequent changes to data (products, images, master data etc.) will result in invalidation of cached entities, types and flexible queries on all nodes forcing system to fetch data from database as cache has been invalidated. Projects having very frequent changes in database can suffer from high performance degradation due to frequent invalidations.

In this post we will be discussing an option to stop invalidation of query for specified amount of time irrespective of change in items in database, this feature is called TTL – Tme To Live. The value of TTL is defined in session context which enforces query to live at least for this duration. Implementation of TTL can significantly improve performance in applications which have frequent changes in database.

Below are steps to executed to implement TTL in a project:

  1. Create an aspect class as below – this class is picking configurable properties: a flag and duration of TTL (in seconds) from configuration file and sets in session context:

1

  1. Define spring bean:

2

  1. Add AOP configuration for specific methods to enable TTL caching:

3

Please note this feature should be tuned as per your use case.  Applications with less writes than reads can have adverse affect on performance. Downside of this configuration is that cached queries will not pick changes immediately on storefront for the defined time so there need to be ballance between performace gain vs data accuracy.  Overall this is a very good option to finetune the performance of hybris applications.

Try it and enjoy improved performance!

 

Extgen

Extgen

SAP Hybris commerce ships with an extension generator tool called extgen, which is short for extension generator. Using extgen tool, you can create new extension based on extension templates. With the extgen tool, you can create one new extension using one template extension. From a technical perspective, any extension can be used as a template extension. The extgen tool is fairly basic in that it simply replaces the tokens configured in properties file.

SAP Hybris Commerce installation

Before running the extgen tool, you need to download the latest version of SAP Hybris Commerce.

Once you have downloaded SAP Hybris Commerce, extract the Hybris Commerce ZIP file.

1.Open a command prompt.

cmd

2.Navigate to the %HYBRIS_HOME_DIR%/installer directory.

navigate

3. Invoke the installer with the b2c_acc recipe by entering the following command.

installer

Steps to create an extension using extgen

1.Navigate to the %HYBRIS_HOME_DIR%/hybris/bin/platform directory

platform

2. Now run setantenv.bat file. Do not close the command prompt.

setantenv

3.Now run

extgen

Extgen prompts you to specify values for the technical aspects of an extension. Extgen comes with default values for all these technical aspects.

These default values are defined in the project.properties file in the extgen directory. The default value is displayed in brackets ([ and ])

Choose a template for generation

Press enter to use the default value. Here default value is [yempty] and we press enter.

template

Choose the name of extension

Here we specify the name of the extension is hybrisdiary.

extensionname

Choose the package name

We can choose default package name for our extension but we specify the name of the package is org.bitbyte .

 package

Now observe that new extension(hybrisdiary) has been created inside hybris/bin/custom folder.

 custom

Configure localextension.xml file

Add your extension to your X:\%HYBRIS_HOME_DIR%\hybris\config/localextensions.xml. After the creation of extensions using extgen, make sure to update the localextensions.xml file as below

localextension

localextension.xml file