5 Replies Latest reply on Apr 14, 2017 12:57 PM by Georgeo-Oracle

    OCC Element in widgets

    ItsNotGoku

      Hello.

      About Commerce Cloud:

      Oracle Commerce Cloud Service - Fragment a Widget into Elements

       

      I'm starting with this, I made some stuff. Now I'm looking for a way to make a widget as more generic as possible.

       

      I thought Element could be what I'm looking for. So I came with some questions, maybe newbie questions but I didn't found in docs.

       

      Is there a way to add admin config in elements?

      edit: After made my own element work, I found there is a Image element that opens up alot of options. Is something like that I want to do.

       

      there is nothing in docs about setting this configs. And trying to keep a widget file tree like for configs, the element get installed with warning about the location of config/ and my config does nothing....

       

       

      thx.

        • 1. Re: OCC Element in widgets
          ItsNotGoku

          I would appreciate some Oracle team's reply since there is nothing about it in docs and as more as I get more doubts come with...

           

          Checking Oracle widgets code I found the config I was looking for. But it's a lot different from widget configs.

          {

            "inline" : false,

            "configOptions": ["textBox", "wrapperTag", "fontPicker", "preview"],

            "availableToAllWidgets": true,

            "translations" : [

              {

                "language" : "en",

                "title" : "Element Teste2",

                "description" : "Description in English"

              }

              ]

          }

           

          How will I access those values in my template? How can I create my own values instead of taking predefined one? How many more and what are the others predefined types?

           

          Looking at the element image predefined by oracle, and how its template is made:

           

          <a data-bind="attr: {href: config.image.link}" href="http://google.com">

                <img data-bind="attr: {src: config.image.src, alt: config.image.altText, title: config.image.titleText}, style: {borderWidth: config.border.borderWidth + 'px', borderColor: config.border.borderColor, borderStyle: 'solid', paddingTop: config.padding.paddingTop + 'px', paddingBottom: config.padding.paddingBottom + 'px', paddingLeft: config.padding.paddingLeft + 'px', paddingRight: config.padding.paddingRight + 'px'}" src="/file/v4949461608987104275/products/30311_ULT.jpg" alt="alt" title="titulo" style="border-width: 0px; border-color: rgb(0, 0, 0); border-style: solid; padding: 0px;">

          </a>

           

          It's clear we are missing a lot of information here.

           

          Or developers should't be doing what I'm trying to do?

          I think that is the most powerful and import thing in element.

          If I can't define my own config values it's almost useless to break a widget into elements.

          And I would like to know if it's not possible to do what I'm trying. So I can stop wasting my time.

           

          Also let me know if I'm at the wrong place. Since no one replied anything.

           

          I will appreciate any answer.

          thanks

          • 2. Re: OCC Element in widgets
            ItsNotGoku

            I got a bit more... I was able to find where is image config, it creates a $lementConfig.... So I had to create a function to extract the correct values, since Oracle generates a random id that I can't access...

             

            So, this is still the wrong way and element needs better documentation, or it really can't be used right now like I wanted...

            Also the interaction with this config and template was not like expected.

            I inserted 2 images in the same element. And in my template I made a foreach in config... But what happened was the whole template was executed 2 times. Once for each image of the same element...

             

            I think the right behavior should be 1 template execution no matter how many elements I had insert... Also the configs should have a better way to be access if it hasn't.

             

            For now I can't try more. Maybe later I will have time for more tryings.

            I still appreciate any clues.

            thx.

            • 3. Re: OCC Element in widgets
              2933950

              I'm also trying to configure elements, but the documentation in version 17.1 for elements is very limited and does not explain clearly how to set up stand alone global elements.

               

              I have seen example code you can download form the OCC admin interface, you can see global elements with has a property called "configOptions" in the element.json. However if you look this up in the 17.1 docs it mentions nothing about this. Nor does it mention about configuring global elements.

               

              Your question was created in late December and i'm surprised why Oracle guys are taking so long (4 months) to update the docs on how to create elements.

               

              Really frustrating

              Thanks

              • 4. Re: OCC Element in widgets
                2933950

                The docs i was looking at are these: http://docs.oracle.com/cloud/latest/commercecs_gs/WIDGE/WIDGE.pdf .

                 

                Hopefully they would update the element section.

                • 5. Re: OCC Element in widgets
                  Georgeo-Oracle

                  The OTN forums are not monitored actively by Oracle engineers and were originally created for the Oracle Commerce On-Premise product. Commerce Cloud has several other forums that are more actively monitored:

                   

                  Oracle Commerce Cloud Group  (Partners only)

                  https://cloudcustomerconnect.oracle.com/resources/7f8654d874/summary (Customers and Partners)

                   

                  If you have any questions or concerns about the documentation, you should open a service request with Support to ensure that you get your question answered.

                   

                  George