I am trying to create a report for categories.





<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
 <module name="Vendor_Module" setup_version="1.0.0"></module>


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
    <add id="Vendor_Module::seoreport" title="Seo Reports" translate="title" module="Vendor_Module" sortOrder="60" parent="Magento_Reports::report" resource="Vendor_Module::report"/>

    <add id="Vendor_Module::index" title="Category Meta Data" module="Vendor_Module" sortOrder="10" action="module/index" resource="Vendor_Module::index" parent="Vendor_Module::seoreport"/>       

Once the menu is clicked, I need to load the report screen with, all the category info like,

Category Id

Category name

Meta Title

Meta description

Category description and etc

Help me with what are the steps I have to follow to get the grid like order and Best seller report with the export feature of Csv and Excel.

Any suggestions are appreciated!! It will be helpful if anyone update me with working code. Thanks..

  • Do you need to create custom report like Bestseller of all category, right ? – Hiren Feb 20 '20 at 6:19
  • @Hiren, Exactly i am looking same, – Manjunath Feb 20 '20 at 6:22
  • do you need filter ? – Hiren Feb 20 '20 at 6:29
  • @Hiren, Yes I need one filter with drop down, status, 1.enabled categories 2. All categories, No need of date filters – Manjunath Feb 20 '20 at 6:30
  • @Hiren, did you get it, what i am trying to do here? – Manjunath Feb 20 '20 at 9:18

I'm going to try and quickly provide a path forward but the question is too broad to offer a working example. I refer to the core Magento_Cms module of a relatively easy to follow example of a Listing UI Component for cms pages.

I'd start with Admin page that displays Listing UI Component.


In the above example, you could replace the content of view/adminhtml/layout/exampleadminnewpage_helloworld_index.xml with something like:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
            <uiComponent name="somename_foryourcomponent_listing" />

Define the UI Component referenced in the layout file view/adminhtml/ui_component/somename_foryourcomponent_listing.xml Here you configure the listing (grid) with to define data provider, toolbars, mass actions, and columns. https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-listing-grid.html

The UI Component needs a Data Provider which is defined in the di.xml and provides the data to the grid. https://devdocs.magento.com/guides/v2.3/ui_comp_guide/concepts/ui_comp_data_source.html

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <argument name="collections" xsi:type="array">
            <item name="somename_foryourcomponent_listing_data_source" xsi:type="string">Vendor\Module\Model\ResourceModel\Category\Grid\Collection</item>
  • hi @lan, I am looking complete solution if possible pls update how to get category collection, mainly I am looking for that code. Please update the code for dataSource with listing ui_component file. Also if you can please update me working code, that helps me a lot. Thanks – Manjunath Feb 20 '20 at 9:33
  • @Manjunath I'm sorry but I do not have an existing example and am not in a position to do this work for you. – Ian at Xantek Feb 24 '20 at 19:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.