Jump to content

Module development for older versions (1.5.0.1)


teomor
 Share

Recommended Posts

I am trying to develop a small module that is supposed to work on PrestaShop 1.5.0.1 and I am having some trouble with the simple creation of a page in the admin.
 
This is my install code:

$parent_tab = new Tab();
$parent_tab->name[$this->context->language->id] = $this->l('Test Title');
$parent_tab->class_name = 'AdminTestModuleMain';
$parent_tab->module = $this->name;
$parent_tab->id_parent = 0;
$parent_tab->add();

and in my module folder I have created a 'controllers/admin/AdminTestModuleMain.php' file with the following code:

class AdminTestModuleMainController extends AdminController
{
}

The newly created admin tab shows up (as a separate tab in the menu) but when I click on it I get a fatal error:

Fatal error: Class 'AdminTestModuleMainController' not found in /var/www/classes/Controller.php on line 115

I have tried different names for the class, for the controller file, deleting the class_index.php file, disabling cache and also tried to install the module on 1.5.4.0 (and the menu doesn't even show up).

 

I also downloaded a simple addon (that is compatible with 1.5.0.1) from the marketplace and installed it and I get the same fatal error (class not found). I did the same thing with this module in 1.5.4.0 and this module works there.... I don't understand what is going on.. :(

Edited by teomor (see edit history)

Share this post


Link to post
Share on other sites

That doesn't work for me. I need the module to create the admin tab, not the user. This will be a free module that people will install and just work.
Anyway, the tab shows up, but the page returns a fatal error. That's my main issue... Somehow, the controller is not registered in the system..

Edited by teomor (see edit history)

Share this post


Link to post
Share on other sites

Did you try to put your controller in a controllers/admin folder in the root of your module, and if you controller is called default.php for example, name the class:

 

class YourModuleNameDefaultModuleAdminController  extends ModuleAdminController

{

...... your controller code....

 

}

Share this post


Link to post
Share on other sites

Do you mean that there a specific naming convention for older versions that I am anware of?

 

PS: this class called ModuleAdminController that I encounter all over the forums, does not exist in 1.5.0.1

I have no idea what this is...

PPS: I have tried your suggestions and they don't work.

Edited by teomor (see edit history)

Share this post


Link to post
Share on other sites

By the way, my admin tab works in 1.5.1.0 but doesn't in 1.5.0.1
I would hate to try every other version in between to find out which one works and which one doesn't and I couldn't find anything relevant in the change logs...

Share this post


Link to post
Share on other sites

  • 4 months later...

Stop looking. There is no good answer. I moved on to newer versions, as I found lots of undocumented bugs that interfered with my module. I ended up with 1.5.0.15 as the min version for my module..

Edited by teomor (see edit history)

Share this post


Link to post
Share on other sites

No, I can't say that. It really depends on the module. If it doesn't require lots of admin pages, for instance, you don't even need to create a separate admin tab for it..

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More