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="TemplateMonster\FeaturedProduct\Block\Adminhtml\Widget\Chooser">
                <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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.