модулей/mypaymentmodule/mypaymentmodule.php
public function hookCreateAccountForm()
{
return '<!--new field in form-->'
. '<div class="form-group">'
. '<label for="card_number">'
. 'Card number:'
. '</label>'
. '<input class="form-control" id="card_number" type="text" name="card_number">'
. '</div>'
. '<!--new field in form-->';
}
public function hookCreateAccount($params)
{
[here put some validation of data]
$cadrNumber = $params['_POST']['card_number'];
$customer = $params['newCustomer'];
$db = Db::getInstance();
$query = 'INSERT INTO `'._DB_PREFIX_.'mymodule_card`
(`customer_id`, `card_number`)
VALUES
("'.intval($customer->id).'", "'. intval($cadrNumber).'")';
$db->Execute($query);
}
функция ниже вызов, конечно, во время модуля инсталяции!
private function _createMymoduleCardTbl()
{
$db = Db::getInstance();
$query = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."mymodule_card` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`customer_id` INT NOT NULL ,
`card_number` TEXT NOT NULL
) ENGINE = MYISAM ";
$db->Execute($query);
return TRUE;
}
не забывайте про крючки, регистрирующиеся при установке!
$this->registerHook('createAccountForm')
$this->registerHook('createAccount')