Jump to content

Unable to override tempate + bug in controller override


tesial

Recommended Posts

Hi there,

 

I'm trying to add a new fieldset in the AdminMaintenance view from the admin backend. I add new fields using HelperForm in the overrided AdminMaintenanceController but some of those fields have a particular "type" which need to be defined in the related helper. The helper in question is options.tpl and is find under /admin3279/themes/default/template/controllers/maintenance/helpers/

 

I've add the right structure in my module's override folder but during installation thoses files are not copyed in the prestashop's override folder. I'm pretty sure the structure is right since:

  1. This is what the doc specify
  2. When i copy manually the options.tpl file, the form is working and the type is rendered accordingly to what is specified in the options.tpl i've copyed

Moreover, (and this is another issue, maybe a Prestashop bug) when i'm installing my module, the overrided AdminMaintenanceController is copyed properly in the Prestashop's override folder. When i uninstall my module, my code is removed from the Prestashop's overrided file BUT the file is left there ("empty", just the definition of the class). This prevent the re-installation of the module. Prestashop try to match the classe's method with the new file but fail (regexp fail) since the class is empty thus not installing my module. I have to manually delete the installed override file and delete the class_index in the cache in order to re-install my module.

 

To clarify, here is the structure of my module and the structure of prestashop's override (before install, after install after uninstall):

Module structure:

+ mymodule
	+ override
		+ controllers
			+ admin
				+ AdminMaintenanceController.php (1)
				+ tempaltes
					+ maintenance
						+ helpers
							+ options
								+ options.tpl (2)

Before installation:

+ override
	+ controllers
		+ admin
			+ templates

After installation:

+ override
	+ controllers
		+ admin
			+ AdminMaintenanceController.php (3)
			+ templates

After uninstall:

+ override
	+ controllers
		+ admin
			+ AdminMaintenanceController.php (4)
			+ templates

(1) My controller which override AdminMaintenanceController.php (AdminMaintenanceControllerCore). This is working (install and use)

(2) The options.tpl that need to override the default options.tpl. This file is not copyed

(3) My controller which is copyed

(4) My controller which has been emptyed by prestashop

 

Here is the related doc:

 - Overloading an existing template (this describe excatly what i'm trying to achieve)

 

Any help would be greatly appreciated,

Thank you

 

Edit:

In addition here is the error message obtained after install>uninstall>install

Warning à la ligne 2427 du fichier C:\development\workspaces\php-storm\prestashop\classes\module\Module.php
[2] preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: No ending delimiter '^' found

Which occurs in the addOverride method.

Edited by tesial (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...