Hello guys.
i'm developping a custom module. It clone product from one shop to another in multistore mode.
So, a preview screenshot of what i need at the bottom. I need to put 2 buttons in the header toolbars. How can i achieve it?
My custom admin controller:
public function compare(Request $request): Response { // Form to make comparison of sources and clones products and confirm the clone process $formBuilder = $this->createFormBuilder($ps, [ 'action' => $this->generateUrl('final_process'), 'method' => 'POST' ]); // Add a hidden input only for each product to clone which is valid) // This input will contain a serialized object of the product source and the product clone // $productToCompare is an array($product_source_obj, $product_clone_obj) foreach($productsToCompare as $product_r) { $input_name = 'product-'.$product_r->id; $formBuilder ->add($input_name, HiddenType::class, [ 'data' => base64_encode(serialize($productStorage)), 'mapped' => false, ]) ; } $form = $formBuilder->getForm(); $form->handleRequest($request); return $this->render('@Modules/mymodule/views/templates/admin/compare.html.twig', [ 'formObject' => $form, 'productsToCompare' => $productsToCompare, ]); }
Also, my template:
{% extends '@!PrestaShop/Admin/layout.html.twig' %} {% block content %} {{ form_start(form) }} <button type="submit" class="btn btn-primary">VALID AND CLONE</button> <button type="button" class="btn btn-outline-secondary" onClick="window.history.back();">GO BACK</button> {{ form_end(form) }} <div class="row"> <div class="content container-fluid"> <div class="col table-responsive"> <table class="table table-sm table-hover"> {{ table content }} </table> </div> </div> </div> {% endblock %}
I thnik i'm missing something between the the extended layout and the block content.