cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create Nested Component in smartedit . hybris 6.6

0 Likes
1,832

Hi All, I want to create Nested Component in smartedit but i created something regarding nested component.I am able to add ,delete many component,but i am not able to edit componenet. I have searched in wiki help document but they are not provide procedure to how to create nested component in smart edit. here is my datamodel for nested component :

     <collectiontype code="ComponentLists" elementtype="SimpleCMSComponent" generate="true" autocreate="true" type="list"></collectiontype>
 </collectiontypes>
 
     <itemtype code="MasterComponent"
               autocreate="true"
               generate="true"
               extends="SimpleCMSComponent"
               jaloclass="de.medienwerft.mwminerals.jalo.MasterComponent">
         <attributes>

             <attribute qualifier="headline" type="localized:java.lang.String">
                 <persistence type="property"/>
             </attribute>

             <attribute qualifier="currentComponent" type="ComponentLists">
                 <persistence type="property"></persistence>
             </attribute>
         </attributes>
     </itemtype>

Please anyone can suggest to me how to do it. below is screen shot which i created nested componenet.![alt text][1]

Thanks in advance. Your help would be much appreciation. [1]: /storage/temp/10482-screen-shot-2018-03-05-at-155232.png

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hello Omkar,

Nested components in SmartEdit are supported through the CmsItemDropdown widget. Here's how that widget works:

  • To edit a component you can just click on one of the selected ones, and that should open a "nested" generic editor. There you can edit that component.

  • To create a new component you can search for it via its name. If the component is not found, the widget will show a "Create" button. When you click it a generic editor is displayed to create the new "nested" component. I attached some images to show you how this works.

Having said that, from the screenshot that you uploaded, I'm starting to think that maybe your attribute was not matched to the CmsItemDropdown. If your widget is not working as I described before, can you confirm that the cmsStructureType returned by the structure API for your 'components' attribute is CmsItemDropdown (you can check the REST call to the types API in your browser when you open the generic editor, e.g., https://127.0.0.1:9002/cmswebservices/v1/types?code=MiniCartComponent&mode=DEFAULT)? It should be similar to this:

 ..., {
          "cmsStructureType" : "CMSItemDropdown",
          "collection" : false,
          "editable" : true,
          "i18nKey" : "type.minicartcomponent.lightboxbannercomponent.name",
          "idAttribute" : "uuid",
          "labelAttributes" : [ "name", "uid" ],
          "localized" : false,
          "paged" : true,
          "params" : {
             "typeCode" : "SimpleBannerComponent"
          },
          "qualifier" : "lightboxBannerComponent",
          "required" : false,
          "subTypes" : {
             "SimpleBannerComponent" : "type.simplebannercomponent.name"
          }
 }...,

Another suggestion is for you to compare your component with the MiniCartComponent; there the Lightbox Banner component is nested, so it can give you an idea of how things work. Finally, this functionality was introduced in version 6.6. From the title, I think that's the version you have, but it's always better to double check.

Hope this helps. Otherwise, let us know.

Edit: You don't need to create the CmsItemDropdown widget. The generic editor should create it automatically for you. To do so, it queries the CMS Structure API; for any attribute with "cmsStructureType" of type "CMSItemDropdown" then the generic editor shows the widget that provides nested components functionality. By default, the structure API does so for any attribute that derives from CmsItem. What I'd like to confirm is whether the structure API is matching your attribute to type "CMSItemDropdown".

Here's a couple of links that might help understand how structure API fits with the generic editor: - https://help.hybris.com/6.6.0/hcd/6df3821e400945c58e95233ae1a062b3.html - https://help.hybris.com/6.6.0/hcd/11d8bed2d2ff4ba6a20c710e0206c412.html

0 Likes

Thanks Alejandro for your quick response.i will check and i will let you know that if works or not. One things how to create CmsItemDropdown widget in smartedit? can you suggest to me. Thanks in advance

Former Member
0 Likes

Hello Omkar,

I added an "edit" to the response above. Hope that helps. Also, left some links that might be useful.

Best regards.

Answers (0)