Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExportViewedCsv.php
Go to the documentation of this file.
1 <?php
8 
11 
13 {
19  const ADMIN_RESOURCE = 'Magento_Reports::report_products';
20 
26  public function execute()
27  {
28  $fileName = 'products_mostviewed.csv';
29  $grid = $this->_view->getLayout()->createBlock(\Magento\Reports\Block\Adminhtml\Product\Viewed\Grid::class);
30  $this->_initReportAction($grid);
31  return $this->_fileFactory->create($fileName, $grid->getCsvFile(), DirectoryList::VAR_DIR);
32  }
33 }
$fileName
Definition: translate.phtml:15