Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Shopcart.php
Go to the documentation of this file.
1 <?php
13 
18 abstract class Shopcart extends \Magento\Backend\App\Action
19 {
23  protected $_fileFactory;
24 
29  public function __construct(
30  \Magento\Backend\App\Action\Context $context,
31  \Magento\Framework\App\Response\Http\FileFactory $fileFactory
32  ) {
33  $this->_fileFactory = $fileFactory;
34  parent::__construct($context);
35  }
36 
42  public function _initAction()
43  {
44  $this->_view->loadLayout();
45  $this->_addBreadcrumb(__('Reports'), __('Reports'));
46  $this->_addBreadcrumb(__('Shopping Cart'), __('Shopping Cart'));
47  return $this;
48  }
49 
55  protected function _isAllowed()
56  {
57  switch ($this->getRequest()->getActionName()) {
58  case 'customer':
59  return $this->_authorization->isAllowed(null);
60  break;
61  case 'product':
62  return $this->_authorization->isAllowed('Magento_Reports::product');
63  break;
64  case 'abandoned':
65  return $this->_authorization->isAllowed('Magento_Reports::abandoned');
66  break;
67  default:
68  return $this->_authorization->isAllowed('Magento_Reports::shopcart');
69  break;
70  }
71  }
72 }
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\App\Response\Http\FileFactory $fileFactory)
Definition: Shopcart.php:29
__()
Definition: __.php:13
_addBreadcrumb($label, $title, $link=null)