[Added] event handling
This commit is contained in:
parent
800ae296b5
commit
0a38b8a5d6
46
Events/Events.php
Normal file
46
Events/Events.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace D3\ManufacturerInformation\Events;
|
||||||
|
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||||
|
|
||||||
|
class Events
|
||||||
|
{
|
||||||
|
public static function activate()
|
||||||
|
{
|
||||||
|
self::d3AddLongdescColumnsToOxmanufacturers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function deActivate()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected static function d3AddLongdescColumnsToOxmanufacturers()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->execute("
|
||||||
|
ALTER TABLE oxmanufacturers
|
||||||
|
ADD COLUMN IF NOT EXISTS D3DESCRIPTION VARCHAR(255) NOT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS D3DESCRIPTION_1 VARCHAR(255) NOT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS D3DESCRIPTION_2 VARCHAR(255) NOT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS D3DESCRIPTION_3 VARCHAR(255) NOT NULL;
|
||||||
|
");
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if ((string)$e->getCode() === '1054') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
use D3\ManufacturerInformation\Application\Controller\Admin\ManufacturerInfoLongdesc;
|
use D3\ManufacturerInformation\Application\Controller\Admin\ManufacturerInfoLongdesc;
|
||||||
use D3\ManufacturerInformation\Application\Model\Constants;
|
use D3\ManufacturerInformation\Application\Model\Constants;
|
||||||
|
use D3\ManufacturerInformation\Events\Events;
|
||||||
use D3\ManufacturerInformation\Modules\Application\Model\D3ManufacturerLongDesc;
|
use D3\ManufacturerInformation\Modules\Application\Model\D3ManufacturerLongDesc;
|
||||||
use D3\ManufacturerInformation\Modules\Application\Model\ManufacturerInfoList;
|
use D3\ManufacturerInformation\Modules\Application\Model\ManufacturerInfoList;
|
||||||
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
|
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
|
||||||
@ -49,8 +50,8 @@ $aModule = [
|
|||||||
OEManufacturerList::class => ManufacturerInfoList::class
|
OEManufacturerList::class => ManufacturerInfoList::class
|
||||||
],
|
],
|
||||||
'events' => [
|
'events' => [
|
||||||
// 'onActivate' => '\D3\ThisModule\Setup\Events::onActivate',
|
'onActivate' => Events::class.'::activate',
|
||||||
// 'onDeactivate' => '\D3\ThisModule\Setup\Events::onDeactivate',
|
'onDeactivate' => Events::class.'::deActivate',
|
||||||
],
|
],
|
||||||
'templates' => [
|
'templates' => [
|
||||||
'd3manufacturerlongdesc.tpl' => 'd3/manufacturerinformation/Application/views/admin/tpl/d3manufacturer_longdesc.tpl',
|
'd3manufacturerlongdesc.tpl' => 'd3/manufacturerinformation/Application/views/admin/tpl/d3manufacturer_longdesc.tpl',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user