Jump to content

module development : module not found :(


andrewdj
 Share

Recommended Posts

Following a guide I found on creating simple PaymentModules, I've started attempting one for Datacash Payments. It initially seemed to work, with the module appearing in the Payment list, but when I click install, it waits and then returns an error saying "Module not found".

Are there error logs that I can look at to find out where the problem is? I've looked at other modules and I don't appear to be doing anything differently, albeit it those other modules have far more code in them at present for config and other stuff. No tables are created in my database when I click install.

<?php

class Datacash extends PaymentModule
{
   private $_html = '';
   private $_postErrors = array();

   public function __construct()
   {
       $this->name='Datacash';
       $this->tab='Payment';
       $this->version = '0.0.1';

       $this->page = basename(__FILE__, '.php');
       $this->displayName = $this->l('Datacash Payments Module');
       $this->description = $this->l('Take Payment via Datacash Payment Gateway');

       parent::__construct();
   }

   public function install()
   {
       if(!parent::install())
           return false;
       if(!this->createPaymentcardtbl())
           return false;
       if(!$this->registerHook('invoice'))
           return false;
       if(!$this->registerHook('payment'))
           return false;
       if(!$this->registerHook('paymentReturn'))
           return false;

       return true;
   }

   function createPaymentcardtbl()
   {
       $db = Db::getInstance();

       $query = "CREATE TABLE `"._DB_PREFIX_."order_paymentcard` (
           `id_payment` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
           `id_order` INT NOT NULL ,
           `cardholdername` TEXT NOT NULL ,
           `cardnumber` TEXT NOT NULL
           ) ENGINE = MYISAM ";

       $db->Execute($query);

       return true;
   }
}
?>

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