I created a module to add a oneToMany link Product->artists
.
This works perfectly on back office (CRUD + Product link on form).
Now I want to override the Prestashop 1.6 default theme to just add the artist name under the title for products list, product show and product popup.
I'd like to avoid the copy of the hole theme for just ten lines of HTML tags...
What is the best and proper way to do this?
Prestashop theme system works as follow:
If your theme is already handling this template file, you will not be able to change it in a module.
The simplest solution is to modify your theme template files.
If you want to add data to a template you can use Prestashop Hook system. In product page there are many Hooks:
HOOK_EXTRA_LEFT
HOOK_EXTRA_RIGHT
HOOK_PRODUCT_OOS
HOOK_PRODUCT_ACTIONS
HOOK_PRODUCT_TAB
HOOK_PRODUCT_TAB_CONTENT
HOOK_PRODUCT_CONTENT
If one of this hook isn't placed conveniently on the page, add a little JQuery to move it in the DOM as you want.
There's a workaround to this, but it's not a clean solution. You can override the product controller and instead of $this->setTemplate(_PS_THEME_DIR_.'product.tpl');
declare your own template file in your module... That's really not a solution I would consider.