56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* 2024 Anvanto
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
*
|
|
* @author Anvanto <anvantoco@gmail.com>
|
|
* @copyright 2024 Anvanto
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
*/
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
function upgrade_module_3_4_13($object)
|
|
{
|
|
if (
|
|
Configuration::get('an_bl_show_in_DisplayHome') && (
|
|
$object->isRegisteredInHook('displayHomeAfter') ||
|
|
$object->isRegisteredInHook('displayBlogWidget') ||
|
|
$object->isRegisteredInHook('displayHome')
|
|
)){
|
|
$widgetObj = new anBlogWidgets();
|
|
$widgetObj->id_anblogcat = (int) Configuration::get('an_bl_categories_DisplayHome_blog');
|
|
$widgetObj->sort = 'new';
|
|
$widgetObj->slider = 0;
|
|
$widgetObj->limit = (int) Configuration::get('an_bl_limit_DisplayHome_blog');
|
|
$widgetObj->relation = 0;
|
|
|
|
if ($object->isRegisteredInHook('displayHomeAfter')){
|
|
$widgetObj->snow_on = 4;
|
|
} elseif ($object->isRegisteredInHook('displayBlogWidget')){
|
|
$widgetObj->snow_on = 5;
|
|
} else {
|
|
$widgetObj->snow_on = 1;
|
|
}
|
|
|
|
$languages = Language::getLanguages();
|
|
foreach ($languages as $language) {
|
|
$widgetObj->title[$language['id_lang']] = 'Blog';
|
|
}
|
|
$widgetObj->save();
|
|
|
|
Db::getInstance()->insert('anblog_blog_widgets_shop', [
|
|
'id_anblog_blog_widgets' => (int) $widgetObj->id,
|
|
'id_shop' => (int) Context::getContext()->shop->id
|
|
]);
|
|
|
|
anBlogWidgets::exportJsonWidgets(new anBlogContentTheme());
|
|
}
|
|
|
|
return true;
|
|
}
|