add empik module
This commit is contained in:
33
modules/empikmarketplace/upgrade/install-1.1.0.php
Normal file
33
modules/empikmarketplace/upgrade/install-1.1.0.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Cache\CacheClearer;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmpikMarketplace $object
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_1_0($object)
|
||||
{
|
||||
(new CacheClearer($object))->clear();
|
||||
|
||||
$result = true;
|
||||
|
||||
$installer = $object->getInstaller();
|
||||
|
||||
$result &= $installer->createTabs();
|
||||
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` ADD COLUMN `empik_offer_price` DECIMAL(20, 2) NOT NULL DEFAULT 0;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` ADD COLUMN `empik_offer_price_reduced` DECIMAL(20, 2) NOT NULL DEFAULT 0;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute` ADD COLUMN `empik_offer_price` DECIMAL(20, 2) NOT NULL DEFAULT 0;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute` ADD COLUMN `empik_offer_price_reduced` DECIMAL(20, 2) NOT NULL DEFAULT 0;';
|
||||
|
||||
foreach ($sql as $query) {
|
||||
$result &= Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
18
modules/empikmarketplace/upgrade/install-1.1.3.php
Normal file
18
modules/empikmarketplace/upgrade/install-1.1.3.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Cache\CacheClearer;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmpikMarketplace $object
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_1_3($object)
|
||||
{
|
||||
(new CacheClearer($object))->clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
22
modules/empikmarketplace/upgrade/install-1.1.4.php
Normal file
22
modules/empikmarketplace/upgrade/install-1.1.4.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Adapter\ConfigurationAdapter;
|
||||
use Empik\Marketplace\Cache\CacheClearer;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmpikMarketplace $object
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_1_4($object)
|
||||
{
|
||||
(new CacheClearer($object))->clear();
|
||||
|
||||
$result = true;
|
||||
$result &= Configuration::updateValue(ConfigurationAdapter::CONF_SKU_TYPE, 'REFERENCE');
|
||||
|
||||
return $result;
|
||||
}
|
||||
65
modules/empikmarketplace/upgrade/install-1.2.0.php
Normal file
65
modules/empikmarketplace/upgrade/install-1.2.0.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Adapter\ConfigurationAdapter;
|
||||
use Empik\Marketplace\Cache\CacheClearer;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmpikMarketplace $object
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_2_0($object)
|
||||
{
|
||||
(new CacheClearer($object))->clear();
|
||||
|
||||
$result = true;
|
||||
|
||||
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'empik_product` (
|
||||
`id_empik_product` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_product` INT(11) NOT NULL,
|
||||
`id_product_attribute` INT(11) NOT NULL,
|
||||
`logistic_class` INT(4) NOT NULL DEFAULT 2,
|
||||
`product_export` INT(1) NOT NULL DEFAULT 0,
|
||||
`offer_export` INT(1) NOT NULL DEFAULT 0,
|
||||
`offer_price` DECIMAL(20, 2) NOT NULL DEFAULT 0,
|
||||
`offer_price_reduced` DECIMAL(20, 2) NOT NULL DEFAULT 0,
|
||||
UNIQUE (`id_product`, `id_product_attribute`),
|
||||
PRIMARY KEY (`id_empik_product`)
|
||||
)';
|
||||
|
||||
$sql[] = 'INSERT INTO `' . _DB_PREFIX_ . 'empik_product` (`id_product`, `id_product_attribute`, `logistic_class`, `product_export`, `offer_export`, `offer_price`, `offer_price_reduced`)
|
||||
SELECT `id_product`, 0, 0, IF(`empik_product_disabled`, 0, 1), IF(`empik_offer_disabled`, 0, 1), `empik_offer_price`, `empik_offer_price_reduced`
|
||||
FROM `' . _DB_PREFIX_ . 'product`
|
||||
WHERE (`empik_product_disabled` = 0 OR `empik_offer_disabled` = 0)
|
||||
';
|
||||
|
||||
$sql[] = 'INSERT INTO `' . _DB_PREFIX_ . 'empik_product` (`id_product`, `id_product_attribute`, `logistic_class`, `product_export`, `offer_export`, `offer_price`, `offer_price_reduced`)
|
||||
SELECT `id_product`, `id_product_attribute`, 0, 1, 1, `empik_offer_price`, `empik_offer_price_reduced`
|
||||
FROM `' . _DB_PREFIX_ . 'product_attribute`
|
||||
WHERE (`empik_offer_price` > 0 OR `empik_offer_price_reduced` > 0)
|
||||
';
|
||||
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` DROP COLUMN `empik_product_disabled`;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` DROP COLUMN `empik_offer_disabled`;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` DROP COLUMN `empik_offer_price`;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` DROP COLUMN `empik_offer_price_reduced`;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute` DROP COLUMN `empik_offer_price`;';
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute` DROP COLUMN `empik_offer_price_reduced`;';
|
||||
|
||||
foreach ($sql as $query) {
|
||||
$result &= Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
if (($tab = Tab::getIdFromClassName('AdminEmpikProductsPrice'))) {
|
||||
$tab = new Tab($tab);
|
||||
foreach (Language::getLanguages() as $language) {
|
||||
$tab->name[$language['id_lang']] = $object->l('Products parameters');
|
||||
}
|
||||
$result &= $tab->save();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
27
modules/empikmarketplace/upgrade/install-1.4.0.php
Normal file
27
modules/empikmarketplace/upgrade/install-1.4.0.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Empik\Marketplace\Adapter\ConfigurationAdapter;
|
||||
use Empik\Marketplace\Cache\CacheClearer;
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmpikMarketplace $object
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_4_0($object)
|
||||
{
|
||||
(new CacheClearer($object))->clear();
|
||||
|
||||
$result = true;
|
||||
|
||||
$sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'empik_product` ADD COLUMN `condition` INT(4) NOT NULL DEFAULT 11 AFTER `logistic_class`;';
|
||||
|
||||
foreach ($sql as $query) {
|
||||
$result &= Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
Reference in New Issue
Block a user