How to override prestashop core files

2019-08-21 12:43发布

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

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-21 13:16

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

查看更多
太酷不给撩
3楼-- · 2019-08-21 13:20

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

查看更多
ゆ 、 Hurt°
4楼-- · 2019-08-21 13:23

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...

查看更多
登录 后发表回答