How to call block function in model The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Access block function in modelmagento 2 how to call any block function in phtmlHow to add function in a block,call this function in templateCall a block function in my controllerMagento 2 - How to call Helper function via Blockhow to override private function in model in Magento-2How to override private function in Model (Magento-2)Call block function from helperMagento2 : Call getViewFileUrl() function in block filefunction in block not found

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Match Roman Numerals

Arduino Pro Micro - switch off LEDs

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

What's the point in a preamp?

Did God make two great lights or did He make the great light two?

Make it rain characters

Was credit for the black hole image misattributed?

What can I do if neighbor is blocking my solar panels intentionally?

Searching for a differential characteristic (differential cryptanalysis)

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Change bounding box of math glyphs in LuaTeX

I could not break this equation. Please help me

Create an outline of font

Single author papers against my advisor's will?

How do I add random spotting to the same face in cycles?

Can a 1st-level character have an ability score above 18?

Can a novice safely splice in wire to lengthen 5V charging cable?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Why does the Event Horizon Telescope (EHT) not include telescopes from Africa, Asia or Australia?

Python - Fishing Simulator

How is simplicity better than precision and clarity in prose?

First use of “packing” as in carrying a gun

He got a vote 80% that of Emmanuel Macron’s



How to call block function in model



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Access block function in modelmagento 2 how to call any block function in phtmlHow to add function in a block,call this function in templateCall a block function in my controllerMagento 2 - How to call Helper function via Blockhow to override private function in model in Magento-2How to override private function in Model (Magento-2)Call block function from helperMagento2 : Call getViewFileUrl() function in block filefunction in block not found



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








1















I'm using TemplateMonter_FeaturedProduct ang I'm building an API to build mobile application. This extension let me add specific products to appear in specific block on the storefront. Those products are added from admin panel.



when I debug the code I found that to view products on the storefront it reads a block variable.



that's widget.xml file:



 <parameter name="product_ids" xsi:type="block" visible="true">
<label translate="true">Choose custom products</label>
<block class="TemplateMonsterFeaturedProductBlockAdminhtmlWidgetChooser">
<data>
<item name="button" xsi:type="array">
<item name="open" xsi:type="string" translate="true">Select ...</item>
</item>
</data>
</block>
</parameter>


and that's block function used on .phtml



public function getProductIds()

$productArr = [];
//TODO: temporary hide manual products
$productIdsStr = $this->getData('product_ids');
//$productIdsStr = false;
if($productIdsStr && is_string($productIdsStr))
$productArr = explode(',',$productIdsStr);

return $productArr;



I need to get the result returned from getProductIds function in my API module.



Any solutions?










share|improve this question




























    1















    I'm using TemplateMonter_FeaturedProduct ang I'm building an API to build mobile application. This extension let me add specific products to appear in specific block on the storefront. Those products are added from admin panel.



    when I debug the code I found that to view products on the storefront it reads a block variable.



    that's widget.xml file:



     <parameter name="product_ids" xsi:type="block" visible="true">
    <label translate="true">Choose custom products</label>
    <block class="TemplateMonsterFeaturedProductBlockAdminhtmlWidgetChooser">
    <data>
    <item name="button" xsi:type="array">
    <item name="open" xsi:type="string" translate="true">Select ...</item>
    </item>
    </data>
    </block>
    </parameter>


    and that's block function used on .phtml



    public function getProductIds()

    $productArr = [];
    //TODO: temporary hide manual products
    $productIdsStr = $this->getData('product_ids');
    //$productIdsStr = false;
    if($productIdsStr && is_string($productIdsStr))
    $productArr = explode(',',$productIdsStr);

    return $productArr;



    I need to get the result returned from getProductIds function in my API module.



    Any solutions?










    share|improve this question
























      1












      1








      1








      I'm using TemplateMonter_FeaturedProduct ang I'm building an API to build mobile application. This extension let me add specific products to appear in specific block on the storefront. Those products are added from admin panel.



      when I debug the code I found that to view products on the storefront it reads a block variable.



      that's widget.xml file:



       <parameter name="product_ids" xsi:type="block" visible="true">
      <label translate="true">Choose custom products</label>
      <block class="TemplateMonsterFeaturedProductBlockAdminhtmlWidgetChooser">
      <data>
      <item name="button" xsi:type="array">
      <item name="open" xsi:type="string" translate="true">Select ...</item>
      </item>
      </data>
      </block>
      </parameter>


      and that's block function used on .phtml



      public function getProductIds()

      $productArr = [];
      //TODO: temporary hide manual products
      $productIdsStr = $this->getData('product_ids');
      //$productIdsStr = false;
      if($productIdsStr && is_string($productIdsStr))
      $productArr = explode(',',$productIdsStr);

      return $productArr;



      I need to get the result returned from getProductIds function in my API module.



      Any solutions?










      share|improve this question














      I'm using TemplateMonter_FeaturedProduct ang I'm building an API to build mobile application. This extension let me add specific products to appear in specific block on the storefront. Those products are added from admin panel.



      when I debug the code I found that to view products on the storefront it reads a block variable.



      that's widget.xml file:



       <parameter name="product_ids" xsi:type="block" visible="true">
      <label translate="true">Choose custom products</label>
      <block class="TemplateMonsterFeaturedProductBlockAdminhtmlWidgetChooser">
      <data>
      <item name="button" xsi:type="array">
      <item name="open" xsi:type="string" translate="true">Select ...</item>
      </item>
      </data>
      </block>
      </parameter>


      and that's block function used on .phtml



      public function getProductIds()

      $productArr = [];
      //TODO: temporary hide manual products
      $productIdsStr = $this->getData('product_ids');
      //$productIdsStr = false;
      if($productIdsStr && is_string($productIdsStr))
      $productArr = explode(',',$productIdsStr);

      return $productArr;



      I need to get the result returned from getProductIds function in my API module.



      Any solutions?







      blocks magento-2.1.7






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Yomna MansourYomna Mansour

      32212




      32212




















          0






          active

          oldest

          votes












          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%2f269796%2fhow-to-call-block-function-in-model%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          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%2f269796%2fhow-to-call-block-function-in-model%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form