// ImageType is now applied to a them

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11700 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2011-12-22 21:48:40 +00:00
parent 5768a6c688
commit e8a3c10175
19 changed files with 1714 additions and 1717 deletions
+9 -24
View File
@@ -392,30 +392,14 @@ class ThemeInstallator extends Module
}
}
private function updateImages()
private function updateImages($id_theme)
{
foreach ($this->xml->images->image as $row)
{
$foo = Db::getInstance()->getRow('
SELECT name FROM `'._DB_PREFIX_.'image_type` i
WHERE i.name LIKE \''.pSQL($row['name']).'\'');
if ((int)(Tools::getValue('imagesConfig')) == 1 AND $foo)
continue ;
if ($foo)
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'image_type` i
SET `width` = '.(int)($row['width']).',
`height` = '.(int)($row['height']).',
`products` = '.($row['products'] == 'true' ? 1 : 0).',
`categories` = '.($row['categories'] == 'true' ? 1 : 0).',
`manufacturers` = '.($row['manufacturers'] == 'true' ? 1 : 0).',
`suppliers` = '.($row['suppliers'] == 'true' ? 1 : 0).',
`scenes` = '.($row['scenes'] == 'true' ? 1 : 0).'
WHERE i.name LIKE \''.pSQL($row['name']).'\'');
else
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'image_type` (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
VALUES (
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'image_type` (`id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
VALUES ('.(int)$id_theme.',
\''.pSQL($row['name']).'\',
'.(int)($row['width']).',
'.(int)($row['height']).',
@@ -540,12 +524,13 @@ class ThemeInstallator extends Module
}
}
}
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages())
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$theme = new Theme();
$theme->name = (string)$this->xml['name'];
$theme->add();
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages((int)$theme->id))
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$this->_msg .= parent::displayConfirmation($msg);
$this->_html .= '
<input type="submit" class="button" name="submitThemes" value="'.$this->l('Previous').'" />