00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Report_ShopcartController extends Mage_Adminhtml_Controller_Action
00035 {
00036 public function _initAction()
00037 {
00038 $act = $this->getRequest()->getActionName();
00039 $this->loadLayout()
00040 ->_addBreadcrumb(Mage::helper('reports')->__('Reports'), Mage::helper('reports')->__('Reports'))
00041 ->_addBreadcrumb(Mage::helper('reports')->__('Shopping Cart'), Mage::helper('reports')->__('Shopping Cart'));
00042 return $this;
00043 }
00044
00045 public function customerAction()
00046 {
00047 $this->_initAction()
00048 ->_setActiveMenu('report/shopcart/customer')
00049 ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report'))
00050 ->_addContent($this->getLayout()->createBlock('adminhtml/report_shopcart_customer'))
00051 ->renderLayout();
00052 }
00053
00054
00055
00056
00057 public function exportCustomerCsvAction()
00058 {
00059 $fileName = 'shopcart_customer.csv';
00060 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_customer_grid')
00061 ->getCsv();
00062
00063 $this->_prepareDownloadResponse($fileName, $content);
00064 }
00065
00066
00067
00068
00069 public function exportCustomerExcelAction()
00070 {
00071 $fileName = 'shopcart_customer.xml';
00072 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_customer_grid')
00073 ->getExcel($fileName);
00074
00075 $this->_prepareDownloadResponse($fileName, $content);
00076 }
00077
00078 public function productAction()
00079 {
00080 $this->_initAction()
00081 ->_setActiveMenu('report/shopcart/product')
00082 ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
00083 ->_addContent($this->getLayout()->createBlock('adminhtml/report_shopcart_product'))
00084 ->renderLayout();
00085 }
00086
00087
00088
00089
00090 public function exportProductCsvAction()
00091 {
00092 $fileName = 'shopcart_product.csv';
00093 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_product_grid')
00094 ->getCsv();
00095
00096 $this->_prepareDownloadResponse($fileName, $content);
00097 }
00098
00099
00100
00101
00102 public function exportProductExcelAction()
00103 {
00104 $fileName = 'shopcart_product.xml';
00105 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_product_grid')
00106 ->getExcel($fileName);
00107
00108 $this->_prepareDownloadResponse($fileName, $content);
00109 }
00110
00111 public function abandonedAction()
00112 {
00113 $this->_initAction()
00114 ->_setActiveMenu('report/shopcart/abandoned')
00115 ->_addBreadcrumb(Mage::helper('reports')->__('Abandoned carts'), Mage::helper('reports')->__('Abandoned carts'))
00116 ->_addContent($this->getLayout()->createBlock('adminhtml/report_shopcart_abandoned'))
00117 ->renderLayout();
00118 }
00119
00120
00121
00122
00123 public function exportAbandonedCsvAction()
00124 {
00125 $fileName = 'shopcart_abandoned.csv';
00126 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_abandoned_grid')
00127 ->getCsv();
00128
00129 $this->_prepareDownloadResponse($fileName, $content);
00130 }
00131
00132
00133
00134
00135 public function exportAbandonedExcelAction()
00136 {
00137 $fileName = 'shopcart_abandoned.xml';
00138 $content = $this->getLayout()->createBlock('adminhtml/report_shopcart_abandoned_grid')
00139 ->getExcel($fileName);
00140
00141 $this->_prepareDownloadResponse($fileName, $content);
00142 }
00143
00144 protected function _isAllowed()
00145 {
00146 switch ($this->getRequest()->getActionName()) {
00147 case 'customer':
00148 return Mage::getSingleton('admin/session')->isAllowed('report/shopcart/customer');
00149 break;
00150 case 'product':
00151 return Mage::getSingleton('admin/session')->isAllowed('report/shopcart/product');
00152 break;
00153 case 'abandoned':
00154 return Mage::getSingleton('admin/session')->isAllowed('report/shopcart/abandoned');
00155 break;
00156 default:
00157 return Mage::getSingleton('admin/session')->isAllowed('report/shopcart');
00158 break;
00159 }
00160 }
00161 }