-->

How to override prestashop core files

2019-08-21 13:32发布

问题:

Can you please explain how to override following core files properly in presatashop. Prestashop 1.7.1.2 allowed only controllers, modal and tpl files in override folder. We can not override src folders in same way.

src/PrestaShopBundle/Controller/Admin/ProductController.php src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig

回答1:

I don't believe this is possible in Prestashop 1.7. See their post here : it seems like they want you to use hooks, ie extending not overriding...



回答2:

PrestaShop give you the ability to override core files, you can check the : officiel doc



回答3:

From PS 1.7.3, you can override src views and controllers in a module.

To override this template file:

src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig

You can add it a module:

modules/<MY-MODULE>/views/PrestaShop/Admin/Product/form.html.twig

Doc PrestaShop for views in a module


And to override this controller file:

src/PrestaShopBundle/Controller/Admin/ProductController.php

You can add it in global override folder:

override/PrestaShop/Controllers/Admin/ProductController.php

Or in a module:

modules/<MY-MODULE>/override/PrestaShop/Controllers/Admin/ProductController.php

Doc PrestaShop for controllers in a module