Skip to content

Instantly share code, notes, and snippets.

@lucnap
Created April 24, 2020 14:27
Show Gist options
  • Save lucnap/a336c6767e9df76d7ba36572a6e32709 to your computer and use it in GitHub Desktop.
Save lucnap/a336c6767e9df76d7ba36572a6e32709 to your computer and use it in GitHub Desktop.
Blocks outgoing order confirmation email
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class LunaEnergiaNaz extends Module {
public function __construct() {
$this->name = 'lunaenergianaz';
$this->tab = 'front_office_features';
$this->version = '1.0.0';
$this->author = 'Luciano';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
'min' => '1.7',
'max' => _PS_VERSION_
];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Personalizzazioni');
$this->description = $this->l('Varie personalizzazioni');
$this->confirmUninstall = $this->l('Sei sicuro di voler disinstallare il modulo?');
if (!Configuration::get('LUNAENERGIANAZ')) {
$this->warning = $this->l('No name provided');
}
}
public function install() {
// se attivo il multistore allora il viene settato il contesto su tutti i shop e le modifiche verranno applicate a tutti
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
if (!parent::install() ||
!Configuration::updateValue('LUNAENERGIANAZ', 'Modulo Lunasoftware')
) {
return false;
}
$this->registerHook('actionEmailSendBefore');
return true;
}
public function hookActionEmailSendBefore(array $params) {
if($params['template'] === 'order_conf'){
return false;
}
return true;
}
public function uninstall() {
if (!parent::uninstall() ||
!Configuration::deleteByName('LUNAENERGIANAZ')
) {
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment