How to create a custom Widget with custom conditions Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to render widgets in product and category description in Magento 2?Magento 2 add custom product attribute validation from install scriptMagento 2 Add new field to Magento_User admin formMagento 2 Widget Condition on edit not displayAdd custom template to existing widget (product_list)Custom product attribute to properly display in custom widget Magento 2magento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Alt title images in category pageCustom Widget with 2 conditions

How to align text above triangle figure

How to find out what spells would be useless to a blind NPC spellcaster?

What's the purpose of writing one's academic biography in the third person?

What is the meaning of the new sigil in Game of Thrones Season 8 intro?

What causes the vertical darker bands in my photo?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Fundamental Solution of the Pell Equation

When were vectors invented?

How to answer "Have you ever been terminated?"

Why is "Consequences inflicted." not a sentence?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Why are there no cargo aircraft with "flying wing" design?

What's the meaning of 間時肆拾貳 at a car parking sign

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Seeking colloquialism for “just because”

Storing hydrofluoric acid before the invention of plastics

Is it true that "carbohydrates are of no use for the basal metabolic need"?

What is known about the Ubaid lizard-people figurines?

What is the logic behind the Maharil's explanation of why we don't say שעשה ניסים on Pesach?

Why light coming from distant stars is not discreet?

Should I discuss the type of campaign with my players?

Dating a Former Employee

What does the "x" in "x86" represent?

What is Wonderstone and are there any references to it pre-1982?



How to create a custom Widget with custom conditions



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to render widgets in product and category description in Magento 2?Magento 2 add custom product attribute validation from install scriptMagento 2 Add new field to Magento_User admin formMagento 2 Widget Condition on edit not displayAdd custom template to existing widget (product_list)Custom product attribute to properly display in custom widget Magento 2magento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Alt title images in category pageCustom Widget with 2 conditions



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I need to create a custom widget using custom conditions to show a product list in the home page. I have to show the option to add multiple inputs in the widget form to set conditions that I need.



When Group Id = 1, show Category Product 5.



I need the string Widget in the content like:



widget type="MyModuleBlockWidget" category_by_group="3=15,4=81,0=31" title="Title of widget" 


The value 3=15 in the category_by_group field means that if Customer Group is 3, the category id will be 15, but I have to type the Group Id and the Category Id and separate them manually with comma.



I have this XML file:




My/Module/etc/widget.xml




<widget class="MyModuleBlockWidget" id="custom_products">
<label>Product Carousel</label>
<description>Carousel of product based on a category.</description>
<parameters>
<parameter name="title" sort_order="0" xsi:type="text" visible="true">
<label>Widget Title</label>
</parameter>
<parameter name="category_by_group" xsi:type="text" visible="true">
<label translate="true">Categories by customer groups</label>
</parameter>
</parameters>
</widget>




Is there a way to add multiple inputs dynamically?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    0















    I need to create a custom widget using custom conditions to show a product list in the home page. I have to show the option to add multiple inputs in the widget form to set conditions that I need.



    When Group Id = 1, show Category Product 5.



    I need the string Widget in the content like:



    widget type="MyModuleBlockWidget" category_by_group="3=15,4=81,0=31" title="Title of widget" 


    The value 3=15 in the category_by_group field means that if Customer Group is 3, the category id will be 15, but I have to type the Group Id and the Category Id and separate them manually with comma.



    I have this XML file:




    My/Module/etc/widget.xml




    <widget class="MyModuleBlockWidget" id="custom_products">
    <label>Product Carousel</label>
    <description>Carousel of product based on a category.</description>
    <parameters>
    <parameter name="title" sort_order="0" xsi:type="text" visible="true">
    <label>Widget Title</label>
    </parameter>
    <parameter name="category_by_group" xsi:type="text" visible="true">
    <label translate="true">Categories by customer groups</label>
    </parameter>
    </parameters>
    </widget>




    Is there a way to add multiple inputs dynamically?










    share|improve this question
















    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      0












      0








      0








      I need to create a custom widget using custom conditions to show a product list in the home page. I have to show the option to add multiple inputs in the widget form to set conditions that I need.



      When Group Id = 1, show Category Product 5.



      I need the string Widget in the content like:



      widget type="MyModuleBlockWidget" category_by_group="3=15,4=81,0=31" title="Title of widget" 


      The value 3=15 in the category_by_group field means that if Customer Group is 3, the category id will be 15, but I have to type the Group Id and the Category Id and separate them manually with comma.



      I have this XML file:




      My/Module/etc/widget.xml




      <widget class="MyModuleBlockWidget" id="custom_products">
      <label>Product Carousel</label>
      <description>Carousel of product based on a category.</description>
      <parameters>
      <parameter name="title" sort_order="0" xsi:type="text" visible="true">
      <label>Widget Title</label>
      </parameter>
      <parameter name="category_by_group" xsi:type="text" visible="true">
      <label translate="true">Categories by customer groups</label>
      </parameter>
      </parameters>
      </widget>




      Is there a way to add multiple inputs dynamically?










      share|improve this question
















      I need to create a custom widget using custom conditions to show a product list in the home page. I have to show the option to add multiple inputs in the widget form to set conditions that I need.



      When Group Id = 1, show Category Product 5.



      I need the string Widget in the content like:



      widget type="MyModuleBlockWidget" category_by_group="3=15,4=81,0=31" title="Title of widget" 


      The value 3=15 in the category_by_group field means that if Customer Group is 3, the category id will be 15, but I have to type the Group Id and the Category Id and separate them manually with comma.



      I have this XML file:




      My/Module/etc/widget.xml




      <widget class="MyModuleBlockWidget" id="custom_products">
      <label>Product Carousel</label>
      <description>Carousel of product based on a category.</description>
      <parameters>
      <parameter name="title" sort_order="0" xsi:type="text" visible="true">
      <label>Widget Title</label>
      </parameter>
      <parameter name="category_by_group" xsi:type="text" visible="true">
      <label translate="true">Categories by customer groups</label>
      </parameter>
      </parameters>
      </widget>




      Is there a way to add multiple inputs dynamically?







      magento2 blocks adminhtml widgets custom-block






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 9 '18 at 4:51









      Chintan Kaneriya

      373214




      373214










      asked Aug 8 '18 at 16:27









      Andres Rojas OrozcoAndres Rojas Orozco

      170111




      170111





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Instead to pass following string from widget.



          • category_by_group="3=15,4=81,0=31"

          just create one Custom Variables in admin path is:



          • system -> Custom Variables

          And add "3=15,4=81,0=31" in Variable under Plain Value option & retrieve this custom_variable in block class.



          You can update it in admin in future instead to update it in widget call.



          Let me know if you still have any issue in it.






          share|improve this answer
































            0














            Add the below to widget.xml it will provide you with an interface so you can easily define the conditions of products to appear in your widget



            <parameter name="products" xsi:type="conditions" visible="true" required="true" sort_order="145" class="MagentoCatalogWidgetBlockProductWidgetConditions">
            <label translate="true">Products</label>
            </parameter>


            There are other parameters you can pass in, check out Magento/CatalogWidget/etc/widget.xml for more information



            Then your class MyModuleBlockWidget should ideally extend MagentoCatalogWidgetBlockProductWidget as it will contain the methods required to build the collection of products.



            If you get stuck displaying the collection on the front end, check out Magento_CatalogWidget::product/widget/content/grid.phtml



            And finally, I'd recommend adding the below to your module.xml (if it isn't already there)



            <sequence>
            <module name="Magento_CatalogWidget"/>
            </sequence>





            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f237703%2fhow-to-create-a-custom-widget-with-custom-conditions%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Instead to pass following string from widget.



              • category_by_group="3=15,4=81,0=31"

              just create one Custom Variables in admin path is:



              • system -> Custom Variables

              And add "3=15,4=81,0=31" in Variable under Plain Value option & retrieve this custom_variable in block class.



              You can update it in admin in future instead to update it in widget call.



              Let me know if you still have any issue in it.






              share|improve this answer





























                0














                Instead to pass following string from widget.



                • category_by_group="3=15,4=81,0=31"

                just create one Custom Variables in admin path is:



                • system -> Custom Variables

                And add "3=15,4=81,0=31" in Variable under Plain Value option & retrieve this custom_variable in block class.



                You can update it in admin in future instead to update it in widget call.



                Let me know if you still have any issue in it.






                share|improve this answer



























                  0












                  0








                  0







                  Instead to pass following string from widget.



                  • category_by_group="3=15,4=81,0=31"

                  just create one Custom Variables in admin path is:



                  • system -> Custom Variables

                  And add "3=15,4=81,0=31" in Variable under Plain Value option & retrieve this custom_variable in block class.



                  You can update it in admin in future instead to update it in widget call.



                  Let me know if you still have any issue in it.






                  share|improve this answer















                  Instead to pass following string from widget.



                  • category_by_group="3=15,4=81,0=31"

                  just create one Custom Variables in admin path is:



                  • system -> Custom Variables

                  And add "3=15,4=81,0=31" in Variable under Plain Value option & retrieve this custom_variable in block class.



                  You can update it in admin in future instead to update it in widget call.



                  Let me know if you still have any issue in it.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 10 '18 at 8:09

























                  answered Aug 10 '18 at 6:46









                  Hassan Ali ShahzadHassan Ali Shahzad

                  734317




                  734317























                      0














                      Add the below to widget.xml it will provide you with an interface so you can easily define the conditions of products to appear in your widget



                      <parameter name="products" xsi:type="conditions" visible="true" required="true" sort_order="145" class="MagentoCatalogWidgetBlockProductWidgetConditions">
                      <label translate="true">Products</label>
                      </parameter>


                      There are other parameters you can pass in, check out Magento/CatalogWidget/etc/widget.xml for more information



                      Then your class MyModuleBlockWidget should ideally extend MagentoCatalogWidgetBlockProductWidget as it will contain the methods required to build the collection of products.



                      If you get stuck displaying the collection on the front end, check out Magento_CatalogWidget::product/widget/content/grid.phtml



                      And finally, I'd recommend adding the below to your module.xml (if it isn't already there)



                      <sequence>
                      <module name="Magento_CatalogWidget"/>
                      </sequence>





                      share|improve this answer



























                        0














                        Add the below to widget.xml it will provide you with an interface so you can easily define the conditions of products to appear in your widget



                        <parameter name="products" xsi:type="conditions" visible="true" required="true" sort_order="145" class="MagentoCatalogWidgetBlockProductWidgetConditions">
                        <label translate="true">Products</label>
                        </parameter>


                        There are other parameters you can pass in, check out Magento/CatalogWidget/etc/widget.xml for more information



                        Then your class MyModuleBlockWidget should ideally extend MagentoCatalogWidgetBlockProductWidget as it will contain the methods required to build the collection of products.



                        If you get stuck displaying the collection on the front end, check out Magento_CatalogWidget::product/widget/content/grid.phtml



                        And finally, I'd recommend adding the below to your module.xml (if it isn't already there)



                        <sequence>
                        <module name="Magento_CatalogWidget"/>
                        </sequence>





                        share|improve this answer

























                          0












                          0








                          0







                          Add the below to widget.xml it will provide you with an interface so you can easily define the conditions of products to appear in your widget



                          <parameter name="products" xsi:type="conditions" visible="true" required="true" sort_order="145" class="MagentoCatalogWidgetBlockProductWidgetConditions">
                          <label translate="true">Products</label>
                          </parameter>


                          There are other parameters you can pass in, check out Magento/CatalogWidget/etc/widget.xml for more information



                          Then your class MyModuleBlockWidget should ideally extend MagentoCatalogWidgetBlockProductWidget as it will contain the methods required to build the collection of products.



                          If you get stuck displaying the collection on the front end, check out Magento_CatalogWidget::product/widget/content/grid.phtml



                          And finally, I'd recommend adding the below to your module.xml (if it isn't already there)



                          <sequence>
                          <module name="Magento_CatalogWidget"/>
                          </sequence>





                          share|improve this answer













                          Add the below to widget.xml it will provide you with an interface so you can easily define the conditions of products to appear in your widget



                          <parameter name="products" xsi:type="conditions" visible="true" required="true" sort_order="145" class="MagentoCatalogWidgetBlockProductWidgetConditions">
                          <label translate="true">Products</label>
                          </parameter>


                          There are other parameters you can pass in, check out Magento/CatalogWidget/etc/widget.xml for more information



                          Then your class MyModuleBlockWidget should ideally extend MagentoCatalogWidgetBlockProductWidget as it will contain the methods required to build the collection of products.



                          If you get stuck displaying the collection on the front end, check out Magento_CatalogWidget::product/widget/content/grid.phtml



                          And finally, I'd recommend adding the below to your module.xml (if it isn't already there)



                          <sequence>
                          <module name="Magento_CatalogWidget"/>
                          </sequence>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 15 at 16:02









                          Dan NorrisDan Norris

                          25919




                          25919



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f237703%2fhow-to-create-a-custom-widget-with-custom-conditions%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                              Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?