|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license GPLv3, http://www.gnu.org/copyleft/gpl.html |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2020-2023 |
|
6
|
|
|
* @package TYPO3 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace Aimeos\Aimeos\Widgets; |
|
11
|
|
|
|
|
12
|
|
|
use TYPO3\CMS\Dashboard\Widgets\WidgetConfigurationInterface; |
|
|
|
|
|
|
13
|
|
|
use TYPO3\CMS\Dashboard\Widgets\WidgetInterface; |
|
|
|
|
|
|
14
|
|
|
use TYPO3\CMS\Fluid\View\StandaloneView; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Renders a widgent of the latest orders |
|
19
|
|
|
* @package TYPO3 |
|
20
|
|
|
*/ |
|
21
|
|
|
class LatestOrdersWidget implements WidgetInterface |
|
22
|
|
|
{ |
|
23
|
|
|
private WidgetConfigurationInterface $configuration; |
|
24
|
|
|
private StandaloneView $view; |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
public function __construct(WidgetConfigurationInterface $configuration, StandaloneView $view) |
|
28
|
|
|
{ |
|
29
|
|
|
$this->configuration = $configuration; |
|
30
|
|
|
$this->view = $view; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function getOptions(): array |
|
35
|
|
|
{ |
|
36
|
|
|
return []; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Renders the content for the widget |
|
42
|
|
|
* |
|
43
|
|
|
* @return string HTML code |
|
44
|
|
|
*/ |
|
45
|
|
|
public function renderWidgetContent(): string |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->view->assign('items', $this->getOrderItems())->render('Widgets/LatestOrdersWidget'); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Returns the latest order items |
|
53
|
|
|
* |
|
54
|
|
|
* @return array Associative list of order IDs as keys and order items as values |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function getOrderItems() : array |
|
57
|
|
|
{ |
|
58
|
|
|
$config = \Aimeos\Aimeos\Base::config(); |
|
59
|
|
|
$context = \Aimeos\Aimeos\Base::context($config); |
|
60
|
|
|
|
|
61
|
|
|
$manager = \Aimeos\MShop::create( $context, 'locale' ); |
|
62
|
|
|
$item = $manager->bootstrap( 'default', '', '', true ); |
|
|
|
|
|
|
63
|
|
|
$context->setLocale( $item ); |
|
64
|
|
|
|
|
65
|
|
|
$manager = \Aimeos\MShop::create($context, 'order'); |
|
66
|
|
|
$filter = $manager->filter()->order('-order.id')->slice(0, 10); |
|
67
|
|
|
|
|
68
|
|
|
return $manager->search($filter, ['order/base/address'])->toArray(); |
|
69
|
|
|
} |
|
70
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths