Hi,
I have module a with an admin controller. I want to add some extra buttons to the order overview. The following works with PrestaShop 8:
class GlsparcelController extends OrderController
{
public function __construct()
{
}
public function myIndexAction(Request $request, OrderFilters $filters)
{
$filters->setFilterId('glsparcelOrder');
$orderKpiFactory = $this->container->get('prestashop.core.kpi_row.factory.orders');
$orderGrid = $this->container->get('prestashop.core.grid.factory.order')->getGrid($filters);
$changeOrderStatusesForm = $this->createForm(ChangeOrdersStatusType::class);
$bulkActions = new BulkActionCollection();
$bulkActions
->add(
(new SubmitBulkAction('print_label'))
->setName('Print selected')
->setOptions([
'submit_route' => 'glsparcel_orders_print',
])
);
$orderGrid->getDefinition()->setBulkActions($bulkActions);
return $this->render(
'@PrestaShop/Admin/Sell/Order/Order/index.html.twig',
[
'orderGrid' => $this->presentGrid($orderGrid),
'help_link' => $this->generateSidebarLink($request->attributes->get('_legacy_controller')),
'enableSidebar' => true,
'changeOrderStatusesForm' => $changeOrderStatusesForm->createView(),
'orderKpi' => $orderKpiFactory->build(),
]
);
}
}
Unfortunately it fails in PrestaShop 9.0 with the message:
The "form.factory" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
I assume the problem is due to the new Symfony version. The service links to Symfony\Component\Form\FormFactory.
Can this be solved?
/Kjeld