如何解决如何在magento 2的UiComponent中获取目录产品
我想在自定义UiComponent中获取目录产品。我试图通过现有的collectionfactory来获取Productdata,但是未获取数据。我正在使用的DataProvider是 Magento \ Catalog \ Model \ ResourceModel \ Product \ Collection ,而CollectionFactory是 Magento \ Catalog \ Ui \ DataProvider \ Product \ Grid \ Collection 。这是我的di.xml
<virtualType name="AllexistproductGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
<arguments>
<argument name="collection" xsi:type="object" shared="false">Magento\Catalog\Model\ResourceModel\Product\Collection</argument>
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="allproductexist_listing_data_source" xsi:type="string">Magento\Catalog\Ui\DataProvider\Product\Grid\Collection</item>
</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\ResourceModel\Product\Collection">
<arguments>
<argument name="mainTable" xsi:type="string">catalog_category_product</argument>
<argument name="resourceModel" xsi:type="string">Magento\Catalog\Model\ResourceModel\Product</argument>
</arguments>
</type>
如您所见,我认为我使用了错误的DataProvider和CollectionFactory。我不明白我必须使用哪个DataProvider和CollectionFactory来获取现有的目录产品。请帮忙。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。