public function install() { include_once dirname(__FILE__) . '/LoyaltyStateModule.php'; if (!parent::install() || !$this->installDB() || !$this->registerHook('extraRight') || !$this->registerHook('updateOrderStatus') || !$this->registerHook('newOrder') || !$this->registerHook('adminCustomers') || !$this->registerHook('shoppingCart') || !$this->registerHook('orderReturn') || !$this->registerHook('cancelProduct') || !$this->registerHook('customerAccount') || !Configuration::updateValue('PS_LOYALTY_POINT_VALUE', '0.20') || !Configuration::updateValue('PS_LOYALTY_MINIMAL', 0) || !Configuration::updateValue('PS_LOYALTY_POINT_RATE', '10') || !Configuration::updateValue('PS_LOYALTY_NONE_AWARD', '1')) { return false; } $defaultTranslations = array('en' => 'Loyalty reward', 'fr' => 'Récompense fidélité'); $conf = array((int) Configuration::get('PS_LANG_DEFAULT') => $this->l('Loyalty reward')); foreach (Language::getLanguages() as $language) { if (isset($defaultTranslations[$language['iso_code']])) { $conf[(int) $language['id_lang']] = $defaultTranslations[$language['iso_code']]; } } Configuration::updateValue('PS_LOYALTY_VOUCHER_DETAILS', $conf); $category_config = ''; $categories = Category::getSimpleCategories((int) Configuration::get('PS_LANG_DEFAULT')); foreach ($categories as $category) { $category_config .= (int) $category['id_category'] . ','; } $category_config = rtrim($category_config, ','); Configuration::updateValue('PS_LOYALTY_VOUCHER_CATEGORY', $category_config); /* This hook is optional */ $this->registerHook('displayMyAccountBlock'); if (!LoyaltyStateModule::insertDefaultData()) { return false; } return true; }
function install() { if (!parent::install() or !$this->installDB() or !$this->registerHook('extraRight') or !$this->registerHook('updateOrderStatus') or !$this->registerHook('newOrder') or !$this->registerHook('adminCustomers') or !$this->registerHook('shoppingCart') or !$this->registerHook('orderReturn') or !$this->registerHook('cancelProduct') or !$this->registerHook('customerAccount') or !Configuration::updateValue('PS_LOYALTY_POINT_VALUE', '0.20') or !Configuration::updateValue('PS_LOYALTY_POINT_RATE', '10') or !Configuration::updateValue('PS_LOYALTY_NONE_AWARD', '1') or !Configuration::updateValue('PS_LOYALTY_VOUCHER_DETAILS', array(intval(Configuration::get('PS_LANG_DEFAULT')) => 'Loyalty voucher'))) { return false; } /* This hook is optional */ $this->registerHook('myAccountBlock'); if (!LoyaltyStateModule::insertDefaultData()) { return false; } return true; }