We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Installing not working

Development and Programming

akrug23's avatar
akrug23
30 posts
14 years ago
akrug23's avatar akrug23

I am new to building modules for EE. But I have followed the getting started tutorial and the module I created shows up in the module list and when I install it I get a message saying that the install was successful but in the module list it says that it is not installed.

I have checked in the database and it is in the module table and the table that I want to it to create is created.

Please help.

Thanks

function install() 
{
  $this->EE->load->dbforge();
    
  $data = array('module_name' => 'Order History', 'module_version' => $this->version, 'has_cp_backend' => 'y', 'has_publish_fields' => 'n');

  $this->EE->db->insert('modules', $data);
    
  $fields = array('order_history_id' => array('type' => 'int', 'constraint' => '10', 'unsigned' => TRUE, 'auto_increment' => TRUE), 'entry_id' => array('type' => 'int', 'constraint'=> '10', 'unsigned' => TRUE), 'order_number' => array('type' => 'varchar', 'constraint' => '250'), 'download_date' => array('type' => 'datetime', 'null' => TRUE),);
        
  $this->EE->dbforge->add_field($fields);
  $this->EE->dbforge->add_key('order_history_id', TRUE);
    
  $this->EE->dbforge->create_table('order_history');
        
  unset($fields);
        

  return TRUE;        
    
}
       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

The problem is with the ‘module_name’ value. It actually has to match the class name of the module. So, try this for your data array (assuming your class name is “Order_history”):

<?php

$data = array(
    'module_name'        => 'Order_history',
    'module_version'     => $this->version,
    'has_cp_backend'     => 'y',
    'has_publish_fields' => 'n'
);
       
akrug23's avatar
akrug23
30 posts
14 years ago
akrug23's avatar akrug23

Thanks that worked.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.