if I want to do override admin templates in my own module, for example
"modules/{my_module}/override/controllers/admin/templates/products/combinations.tpl"
I don't see any changes.
I think this don't work automaticaly. What I should do more?
In prestashop 1.6 you have to manually put it in override folder so for your template it would be
override/controllers/admin/templates/products/combinations.tpl
Related
I'm using a theme with testimonial slider in homepage and I've figured out that there in the module folder a file called all_testimonial.tpl and something about an upload form.
So I guess that there is a way to have a page with all testimonials with the upload form.
But I'm not able to understand how could use that tpl.
Do you have any suggestions?
TPL file is a file extension for a template file format in general.
In Prestashop, Smarty is a template parser written in PHP
Take a have a look at these websites
https://www.smarty.net/
https://www.smarty.net/docsv2/en/smarty.for.designers
It would be difficult to answer which module for testimonial slider you are using in theme and which PrestaShop version website is using.
But I would say to have a look at the Prestashop Hooks
To see List of Hooks -> For a full list of Hooks
To see Module Development Changes -> https://build.prestashop.com/news/module-development-changes-in-17/
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
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...
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 in 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
PrestaShop give you the ability to override core files, you can check the : officiel doc
I've created a module that has an override for the FrontControllerCore class to add additional Smarty variables.
The issue I'm running into is trying to autoload a class that is referenced in the controller that is in my module. The class isn't being loaded and I don't know how to add it to the autoloader.
When you install the module the FrontController.php file should be located in:
override\classes\controller\
so from the FrontController.php you can "include" manually that file like:
require_once(dirname(__FILE__).'/../../../modules/servicecharges/classes/ServiceCharge.php');
There's no autoload for such includes.
Also you can use this free tiny module that override Prestashop autoload. After that all your module custom class will be autoloaded.
Exemple path: /modules/my_module/libs/classes/MyClass.php
Extended Api
I've been able to solve a similar problem, with Composer's autoload. Way to require an autoload in one file on a Prestashop module?
Instead of overriding a controller (leading to conflicts with other plugins or installations of Prestashop already using the same overrides) you could invoke the hook moduleRoutes.
This way, you could call your autlooader always before the controllers:
<?php
public function hookModuleRoutes() {
require_once __DIR__.'/vendor/autoload.php'; // And the autoload here to make our Composer classes available everywhere!
}
Today I starting design theme for prestashop and i'm Beginner on that.
i have a Question about Theme Module
i have Some module for my new Theme Located here:
prestashop/theme/mytheme/Module
and i want customize that for my new theme.
but the prestashop not using My Module instead using default module Located here:
Prestashop/Module/
What's Wrong and how to Fix this?
From the PrestaShop documentation:
Overriding a module's behavior
The modules are usually in the following format:
/modules/my_module/my_module.tpl
/modules/my_module/my_module.css
/modules/my_module/my_module.js
Since PrestaShop 1.5, they can and should also be in the following format:
/modules/my_module/views/templates/front/my_module.tpl
/modules/my_module/views/templates/front/my_module.css
/modules/my_module/views/templates/front/my_module.js
PrestaShop allows you to override or replace certain front-office module files
with new ones within the same theme. The override is governed by the
theme: once it contains a /modules folder (or more!), PrestaShop will
browse its content for files which have the same name and path as
those of existing modules, and replace these with the new ones.
This means, for PrestaShop 1.4-compatible modules:
/themes/my_theme/modules/my_module/my_module.tpl
/themes/my_theme/css/modules/my_module/my_module.css
/themes/my_theme/js/modules/my_module/my_module.js
Since PrestaShop 1.5, the path is slightly longer
/themes/my_theme/modules/my_module/views/templates/front/my_module.tpl
/themes/my_theme/css/modules/my_module/views/templates/front/my_module.css
/themes/my_theme/js/modules/my_module/views/templates/front/my_module.js
In general, the proper path to override a .tpl, .js or .css file
depends on the module's own path. That is the reason why if PrestaShop
1.5 has to work with a module without a view folder, it will need the same override path.
In short, you can keep overriding code in 1.5 just
as you did in 1.4.
The new files will be used when the customer loads
your shop.
Contrary to the override code that is to be placed manually
in the /override folder, module overrides are enabled as soon as the
module is installed. During installation, overriding code is merge
with those already in place (if any), otherwise they are copied to the
/override folder at the root of the PrestaShop folder.
I'm new in Sugar and i have created my custom modules. i wonder how to set custom theme for my custom modules. It means that theme is only applied to my modules. I'm using SugarCE-6.5.9. Thank you very much.
Create the following folder structure: /custom/themes/custom.less. In the custom.less file, you can add your own css styles. Note that this works for SugarCRM 7. I've not tested this on SugarCRM 6.