1 | <?php |
||
18 | class Export extends Controller |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Product model class instance |
||
23 | * @var \gplcart\core\models\Product $product |
||
24 | */ |
||
25 | protected $product; |
||
26 | |||
27 | /** |
||
28 | * Export constructor. |
||
29 | * @param Product $product |
||
30 | */ |
||
31 | public function __construct(Product $product) |
||
32 | { |
||
33 | parent::__construct(); |
||
34 | |||
35 | $this->product = $product; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Route callback to display the export page |
||
40 | */ |
||
41 | public function doExport() |
||
42 | { |
||
43 | $this->downloadCsvExport(); |
||
44 | |||
45 | $settings = $this->module->getSettings('export'); |
||
46 | |||
47 | if (empty($settings['columns'])) { |
||
48 | $settings['columns'] = array_keys($settings['header']); |
||
49 | } |
||
50 | |||
51 | $this->setData('settings', $settings); |
||
52 | $this->setData('columns', $settings['header']); |
||
53 | $this->setData('stores', $this->store->getList()); |
||
54 | |||
55 | $this->submitExport(); |
||
56 | $this->setTitleDoExport(); |
||
57 | $this->setBreadcrumbDoExport(); |
||
58 | |||
59 | $this->outputDoExport(); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Sets titles on the export page |
||
64 | */ |
||
65 | protected function setTitleDoExport() |
||
69 | |||
70 | /** |
||
71 | * Sets breadcrumbs on the export page |
||
72 | */ |
||
73 | protected function setBreadcrumbDoExport() |
||
82 | |||
83 | /** |
||
84 | * Renders the export page templates |
||
85 | */ |
||
86 | protected function outputDoExport() |
||
90 | |||
91 | /** |
||
92 | * Start export |
||
93 | */ |
||
94 | protected function submitExport() |
||
100 | |||
101 | /** |
||
102 | * Validates submitted export data |
||
103 | * @return boolean |
||
104 | */ |
||
105 | protected function validateExport() |
||
113 | |||
114 | /** |
||
115 | * Validates destination directory and file |
||
116 | * @return boolean |
||
117 | */ |
||
118 | protected function validateFileExport() |
||
138 | |||
139 | /** |
||
140 | * Sets up export job |
||
141 | */ |
||
142 | protected function setJobExport() |
||
172 | |||
173 | /** |
||
174 | * Download a created CSV file |
||
175 | */ |
||
176 | protected function downloadCsvExport() |
||
184 | |||
185 | /** |
||
186 | * Returns a total number of products found for the given conditions |
||
187 | * @param array $options |
||
188 | * @return integer |
||
189 | */ |
||
190 | protected function getTotalProductExport(array $options) |
||
195 | |||
196 | } |
||
197 |