[email protected] Posted January 20, 2021 Share Posted January 20, 2021 Hi, I want to add supplier reference in the back office Products page, and I have created my own module so I can keep the PrestaShop code untouched. I've managed to have the webpage updated with the new column by override the twig files in my module. But now the new column isn't populated with the supplier reference value, after some hours of tracing, I've found that src\Adapter\Product\AdminProductDataProvider's getCatalogProductList method needs to be updated to include the `supplier_reference` column in the sqlSelect. It works by updating the PS source code, but I still hope that I can keep PS core sourcecode clean and untouched, so I'm wondering if anyone may recommend how I should override the Adapter DataProvider cleanly? Many thanks in advance. Link to comment Share on other sites More sharing options...
joseantgv Posted January 20, 2021 Share Posted January 20, 2021 It's not possible to override /src. Link to comment Share on other sites More sharing options...
[email protected] Posted January 20, 2021 Author Share Posted January 20, 2021 Hi Jo, many thanks for your reply. In that case, if we need to update the SELECT SQL to pull out more data, how should I do it without changing the PS DataProvider code? I really hope that I can do it without touching core source code. I've already created my own module to override a few twig files. Is that something possible we can achieve with my module? Link to comment Share on other sites More sharing options...
joseantgv Posted January 20, 2021 Share Posted January 20, 2021 (edited) Check this: https://devdocs.prestashop.com/1.7/modules/sample-modules/grid-and-identifiable-object-form-hooks-usage/ https://devdocs.prestashop.com/1.7/development/components/grid/tutorials/modify-grid-in-module/ https://devdocs.prestashop.com/1.7/modules/concepts/templating/admin-views/ Edited January 21, 2021 by joseantgv (see edit history) 1 Link to comment Share on other sites More sharing options...
damian_pm Posted October 12, 2021 Share Posted October 12, 2021 (edited) src/ can be override in module for example class /src/Adapter/PDF/OrderInvoicePdfGenerator.php: file1: /modules/someModule/src/OrderInvoicePdfGenerator.php -- copy of file OrderInvoicePdfGenerator.php and changed namespace to PrestaShop\Module\someModule\Controller; file2: /modules/someModul/config/services.yml: services: _defaults: public: true prestashop.adapter.pdf.order_invoice_pdf_generator: class: PrestaShop\Module\someModule\Controller\OrderInvoicePdfGenerator arguments: - '@translator' file3: /modules/someModul/composer.json "autoload": { "psr-4": { "PrestaShop\\Module\\someModule\\": "src/" }, ... Edited October 12, 2021 by damian_pm (see edit history) 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now