Exemplo n.º 1
0
 public function install()
 {
     if (!parent::install()) {
         return false;
     }
     // Insert currencies availability
     if ($this->currencies_mode == 'checkbox') {
         if (!$this->addCheckboxCurrencyRestrictionsForModule()) {
             return false;
         }
     } elseif ($this->currencies_mode == 'radio') {
         if (!$this->addRadioCurrencyRestrictionsForModule()) {
             return false;
         }
     } else {
         Tools::displayError('No currency mode for payment module');
     }
     // Insert countries availability
     $return = $this->addCheckboxCountryRestrictionsForModule();
     if (!Configuration::get('CONF_' . strtoupper($this->name) . '_FIXED')) {
         Configuration::updateValue('CONF_' . strtoupper($this->name) . '_FIXED', '0.2');
     }
     if (!Configuration::get('CONF_' . strtoupper($this->name) . '_VAR')) {
         Configuration::updateValue('CONF_' . strtoupper($this->name) . '_VAR', '2');
     }
     if (!Configuration::get('CONF_' . strtoupper($this->name) . '_FIXED_FOREIGN')) {
         Configuration::updateValue('CONF_' . strtoupper($this->name) . '_FIXED_FOREIGN', '0.2');
     }
     if (!Configuration::get('CONF_' . strtoupper($this->name) . '_VAR_FOREIGN')) {
         Configuration::updateValue('CONF_' . strtoupper($this->name) . '_VAR_FOREIGN', '2');
     }
     return $return;
 }
Exemplo n.º 2
0
    /**
     * @return bool
     */
    public function install()
    {
        Db::getInstance()->execute('
		CREATE TABLE ' . _DB_PREFIX_ . 'pincode (
		`id_pincode` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		`pincode` BIGINT UNSIGNED NOT NULL ,
		`id_carrier` INT UNSIGNED NOT NULL ,
		`date_add` DATETIME NOT NULL,
		 INDEX `date_add`(`date_add`),
		 INDEX `id_pincode`(`id_pincode`),
                 FOREIGN KEY (id_carrier) REFERENCES ' . _DB_PREFIX_ . 'carrier(id_carrier)
		) ENGINE=' . _MYSQL_ENGINE_);
        foreach ($this->conf_keys as $key) {
            Configuration::updateValue($key, 0);
        }
        return parent::install() && $this->registerHook('extraRight') && $this->registerHook('payment') && $this->registerHook('paymentReturn') && $this->registerHook('header');
    }