Hybris Tutorial – CMS Allow Drag, Drop, Move and Clone Component | Unit 7

0 Comments

In this post, we will learn how to drag and drop and clone the Youtube component which created in unit 3.

Contents:

  1. Allow component is available in Add Component “+ Component” section.
  2. Allow component is able to drag and drop into the body content page.
  3. Move and Clone component based on the existing component.

Let’s go.

1)Allow components are available in Add Component “+ Component” section.

INSERT_UPDATE ComponentTypeGroups2ComponentType; source(code)[unique=true]; target(code)[unique=true]
; wide ; YoutubeVideoComponent
; narrow ; YoutubeVideoComponent

Wide and Narrow are common pre-defined group in Hybris platform. They allow us drag, drop, edit, delete component in cms page.

Reference: https://help.sap.com/docs/SAP_COMMERCE/2a797fed80934746adc68fb1bbe23dd0/6c036ecad0de4e269fb50f2a41de1271.html?version=2105 (7. You must now extend the Component Type Group.)

2) Allow component is able to drag and drop into the body content page.

$contentCatalog=apparel-ukContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]
  
INSERT_UPDATE ContentSlotName ; name[unique=true]      ; template(uid,$contentCV)[unique=true][default='ContactPageTemplate'] ; validComponentTypes(code) ; compTypeGroup(code)
                              ; youtubeVideo               ;                                                                     ;                           ; wide 
 

We also can limit or restrict components can or drop to specific slot (position) on page. Please watch the video for more detail.

3) Move and Clone component based on the existing component.

To move the existing component, just click on the “drag and drop” icon at top left of component, then move the desired position.

Move and drap and drop component

There are 2 ways to clone component.

  • We can search in the saved component area in the “+ component” section. -> check on “clone on drop” > drag and drop the component to the desired place.
  • Clone directly on the existing component by click on “***” more option at top right of component.

That’s all for this post. Please give me a heart up and share this post if it is useful. Your action is free but it is a huge motivation for me to create more and more posts.

In the next post, we will learn about cronjob. The cronjob will help us run scheduled tasks behind the system. Hope to see you then.

Happy coding.!!! <3



<<< CMS Create Content Slot for Page

Cronjob | Task Schedule | Export Order Data to CSV >>>



Leave a Reply

Your email address will not be published. Required fields are marked *