// upgrade fix relative to php scripts from 1.1.0.5 + generate_root_category_for_multishop
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function add_new_tab($className, $name, $id_parent, $returnId = false)
|
||||
function add_new_tab($className, $name, $id_parent)
|
||||
{
|
||||
$array = array();
|
||||
foreach (explode('|', $name) AS $item)
|
||||
@@ -57,10 +57,4 @@ function add_new_tab($className, $name, $id_parent, $returnId = false)
|
||||
FROM `'._DB_PREFIX_.'tab`
|
||||
WHERE `class_name` = \''.pSQL($className).'\' LIMIT 0,1
|
||||
), 1, 1, 1, 1 FROM `'._DB_PREFIX_.'profile` )');
|
||||
|
||||
if($returnId) {
|
||||
return (int)Db::getInstance()->getValue('SELECT `id_tab`
|
||||
FROM `'._DB_PREFIX_.'tab`
|
||||
WHERE `class_name` = \''.pSQL($className).'\'');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,11 @@ function convert_product_price()
|
||||
$taxRates = array();
|
||||
foreach ($taxes as $data)
|
||||
$taxRates[$data['id_tax']] = (float)($data['rate']) / 100;
|
||||
$resource = DB::getInstance()->ExecuteS('SELECT `id_product`, `price`, `id_tax` FROM `'._DB_PREFIX_.'product`', false);
|
||||
$resource = DB::getInstance()->executeS('SELECT `id_product`, `price`, `id_tax`
|
||||
FROM `'._DB_PREFIX_.'product`', false);
|
||||
if (!$resource)
|
||||
die(mysql_error());
|
||||
return array('error' => 1, 'msg' => Db::getInstance()->getMsgError()); // was previously die(mysql_error())
|
||||
|
||||
while ($row = DB::getInstance()->nextRow($resource))
|
||||
if ($row['id_tax'])
|
||||
{
|
||||
@@ -44,7 +46,7 @@ function convert_product_price()
|
||||
{
|
||||
$newPrice = (float)(number_format($price, 6, '.', ''));
|
||||
$newPrice = Tools::floorf($newPrice / (1 + $taxRates[$row['id_tax']]), 6);
|
||||
DB::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET `price` = '.$newPrice.' WHERE `id_product` = '.(int)$row['id_product']);
|
||||
DB::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product` SET `price` = '.$newPrice.' WHERE `id_product` = '.(int)$row['id_product']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once('./generate_ntree.php');
|
||||
|
||||
function generate_root_category_for_multishop()
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
@@ -10,7 +12,7 @@ function generate_root_category_for_multishop()
|
||||
INSERT INTO `'._DB_PREFIX_.'category` (`id_parent`, `level_depth`, `active`, `date_add`, `date_upd`, `is_root_category`) VALUES
|
||||
(0, 0, 1, NOW(), NOW(), 0)
|
||||
');
|
||||
$id = Db::getInstance()->Insert_ID();
|
||||
$id = Db::getInstance()->insert_id();
|
||||
|
||||
$langs = Db::getInstance()->executeS('
|
||||
SELECT `id_lang`
|
||||
@@ -57,6 +59,6 @@ function generate_root_category_for_multishop()
|
||||
SET `id_category` = 1
|
||||
WHERE `id_shop` = 1
|
||||
');
|
||||
|
||||
Category::regenerateEntireNtree();
|
||||
}
|
||||
|
||||
generate_ntree();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ function migrate_block_info_to_cms_block()
|
||||
`position` int(10) unsigned NOT NULL default \'0\',
|
||||
`display_store` tinyint(1) unsigned NOT NULL default \'1\',
|
||||
PRIMARY KEY (`id_cms_block`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
|
||||
$res &= Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `location`, `position`) VALUES(1, 0, 0)');
|
||||
$res &= Db::getInstance()->Execute('
|
||||
@@ -77,7 +77,7 @@ function migrate_block_info_to_cms_block()
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`name` varchar(40) NOT NULL default \'\',
|
||||
PRIMARY KEY (`id_cms_block`, `id_lang`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
|
||||
|
||||
$query_lang = 'INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`) VALUES';
|
||||
foreach ($languages AS $language)
|
||||
@@ -92,7 +92,7 @@ function migrate_block_info_to_cms_block()
|
||||
`id_cms` int(10) unsigned NOT NULL,
|
||||
`is_category` tinyint(1) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_cms_block_page`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
|
||||
|
||||
$res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration`
|
||||
(name, value) VALUES ("FOOTER_CMS", "")');
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
function set_payment_module_group()
|
||||
{
|
||||
// Get all modules then select only payment ones
|
||||
$modules = Module::getModulesInstalled();
|
||||
$modules = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'module`');
|
||||
foreach ($modules AS $module)
|
||||
{
|
||||
$file = _PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php';
|
||||
|
||||
@@ -35,8 +35,8 @@ function update_carrier_url()
|
||||
|
||||
// Check each one and erase carrier URL if not correct URL
|
||||
foreach ($carriers as $carrier)
|
||||
if (!Validate::isAbsoluteUrl($carrier['url']))
|
||||
Db::getInstance()->execute('
|
||||
if (empty($carrier['url']) || !preg_match('/^https?:\/\/[:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $carrier['url']))
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'carrier`
|
||||
SET `url` = \'\'
|
||||
WHERE `id_carrier`= '.(int)($carrier['id_carrier']));
|
||||
|
||||
@@ -16,4 +16,4 @@ function update_for_13version()
|
||||
("PS_REWRITING_SETTINGS", "0")
|
||||
("PS_CANONICAL_REDIRECT", "0")
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @version Release: $Revision: 12447 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
@@ -31,6 +31,6 @@ function update_module_followup()
|
||||
if (!$id_followup)
|
||||
return;
|
||||
|
||||
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'log_email` ADD INDEX `date_add`(`date_add`), ADD INDEX `id_cart`(`id_cart`);');
|
||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'log_email` ADD INDEX `date_add`(`date_add`), ADD INDEX `id_cart`(`id_cart`);');
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 12447 $
|
||||
* @version Release: $Revision: 12518 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@ function update_order_canada()
|
||||
`tax_name` varchar(40) NOT NULL,
|
||||
`tax_rate` decimal(6,3) NOT NULL,
|
||||
`amount` decimal(20,6) NOT NULL
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8');
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
|
||||
|
||||
|
||||
$address_field = Db::getInstance()->getValue('SELECT value
|
||||
@@ -66,7 +66,7 @@ function update_order_canada()
|
||||
// returns Group::getDefaultPriceDisplayMethod
|
||||
$tax_calculation_method = $order['price_display_method'];
|
||||
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'order_detail` od
|
||||
WHERE od.`id_order` = '.(int)$id_order);
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
|
||||
function update_order_details()
|
||||
{
|
||||
$res = Db::getInstance()->executeS('SHOW COLUMNS FROM `'._DB_PREFIX_.'order_detail` LIKE \'reduction_percent\'');
|
||||
$res = Db::getInstance()->ExecuteS('SHOW COLUMNS FROM `'._DB_PREFIX_.'order_detail` LIKE \'reduction_percent\'');
|
||||
|
||||
if (sizeof($res) == 0)
|
||||
{
|
||||
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_percent` DECIMAL(10, 2) NOT NULL default "0.00" AFTER `product_price`');
|
||||
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_amount` DECIMAL(20, 6) NOT NULL default "0.000000" AFTER `reduction_percent`');
|
||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_percent` DECIMAL(10, 2) NOT NULL default \'0.00\' AFTER `product_price`');
|
||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_amount` DECIMAL(20, 6) NOT NULL default \'0.000000\' AFTER `reduction_percent`');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @version Release: $Revision: 7541 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
@@ -33,4 +33,4 @@ function update_products_ecotax_v133()
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product` SET `ecotax` = \'0\' WHERE 1');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'order_detail` SET `ecotax` = \'0\' WHERE 1;');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,38 +20,38 @@
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @version Release: $Revision: 6594 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function updateproductcomments()
|
||||
{
|
||||
if (Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'product_comment') !== false)
|
||||
if (Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'product_comment') !== false)
|
||||
{
|
||||
Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'product_comment_criterion_lang (
|
||||
Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'product_comment_criterion_lang (
|
||||
`id_product_comment_criterion` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_lang` INT(11) UNSIGNED NOT NULL ,
|
||||
`name` VARCHAR(64) NOT NULL ,
|
||||
PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` )
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'product_comment_criterion_category (
|
||||
Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'product_comment_criterion_category (
|
||||
`id_product_comment_criterion` int(10) unsigned NOT NULL,
|
||||
`id_category` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY(`id_product_comment_criterion`, `id_category`),
|
||||
KEY `id_category` (`id_category`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `id_guest` INT(11) NULL AFTER `id_customer`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `customer_name` varchar(64) NULL AFTER `content`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `deleted` tinyint(1) NOT NULL AFTER `validate`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_customer)');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_guest)');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_product)');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion DROP `id_lang`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion DROP `name`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion ADD `id_product_comment_criterion_type` tinyint(1) NOT NULL AFTER `id_product_comment_criterion`');
|
||||
Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion ADD `active` tinyint(1) NOT NULL AFTER `id_product_comment_criterion_type`');
|
||||
Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment` ADD `title` VARCHAR(64) NULL AFTER `id_guest`;');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `id_guest` INT(11) NULL AFTER `id_customer`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `customer_name` varchar(64) NULL AFTER `content`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD `deleted` tinyint(1) NOT NULL AFTER `validate`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_customer)');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_guest)');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment ADD INDEX (id_product)');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion DROP `id_lang`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion DROP `name`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion ADD `id_product_comment_criterion_type` tinyint(1) NOT NULL AFTER `id_product_comment_criterion`');
|
||||
Db::getInstance()->Execute('ALTER TABLE '._DB_PREFIX_.'product_comment_criterion ADD `active` tinyint(1) NOT NULL AFTER `id_product_comment_criterion_type`');
|
||||
Db::getInstance()->Execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment` ADD `title` VARCHAR(64) NULL AFTER `id_guest`;');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @version Release: $Revision: 6594 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
@@ -30,16 +30,16 @@ function updatetabicon_from_11version()
|
||||
if (version_compare($oldversion,'1.5.0.0','<'))
|
||||
{
|
||||
|
||||
$rows = Db::getInstance()->executeS('SELECT `id_tab`,`class_name` FROM '._DB_PREFIX_.'tab');
|
||||
$rows = Db::getInstance()->ExecuteS('SELECT `id_tab`,`class_name` FROM '._DB_PREFIX_.'tab');
|
||||
if (sizeof($rows))
|
||||
{
|
||||
$img_dir = scandir(_PS_IMG_DIR_.'/t/');
|
||||
$img_dir = scandir(_PS_ROOT_DIR_.'/img/t/');
|
||||
$result = true;
|
||||
foreach ($rows as $tab)
|
||||
{
|
||||
if (file_exists(_PS_IMG_DIR_.'/t/'.$tab['id_tab'].'.gif')
|
||||
AND !file_exists(_PS_IMG_DIR_.'/t/'.$tab['class_name'].'.gif'))
|
||||
$result &= rename(_PS_IMG_DIR_.'/t/'.$tab['id_tab'].'.gif',_PS_IMG_DIR_.'/t/'.$tab['class_name'].'.gif');
|
||||
if (file_exists(_PS_ROOT_DIR_.'/img/t/'.$tab['id_tab'].'.gif')
|
||||
AND !file_exists(_PS_ROOT_DIR_.'/img/t/'.$tab['class_name'].'.gif'))
|
||||
$result &= rename(_PS_ROOT_DIR_.'/img/t/'.$tab['id_tab'].'.gif',_PS_ROOT_DIR_.'/img/t/'.$tab['class_name'].'.gif');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user