// Theme can now be selected on AdminThemes page
This commit is contained in:
@@ -24,6 +24,23 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
{extends file="helpers/options/options.tpl"}
|
{extends file="helpers/options/options.tpl"}
|
||||||
|
|
||||||
|
{block name="field"}
|
||||||
|
{if $field['type'] == 'theme'}
|
||||||
|
{if $field['can_display_themes']}
|
||||||
|
{foreach $field.themes as $theme}
|
||||||
|
<div class="select_theme {if $theme->id == $field['id_theme']}select_theme_choice{/if}" onclick="$(this).find('input').attr('checked', true); $('.select_theme').removeClass('select_theme_choice'); $(this).toggleClass('select_theme_choice');">
|
||||||
|
{$theme->name}<br />
|
||||||
|
<img src="../themes/{$theme->directory}/preview.jpg" alt="{$theme->directory}" /><br />
|
||||||
|
<input type="radio" name="id_theme" value="{$theme->id}" {if $theme->id == $field['id_theme']}checked="checked"{/if} />
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
{else}
|
||||||
|
{$smarty.block.parent}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
{block name="after"}
|
{block name="after"}
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<fieldset id="prestastore-content" class="width3"></fieldset>
|
<fieldset id="prestastore-content" class="width3"></fieldset>
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
|
|
||||||
{foreach $categoryData['fields'] AS $key => $field}
|
{foreach $categoryData['fields'] AS $key => $field}
|
||||||
|
|
||||||
|
{block name="field"}
|
||||||
{if $field['type'] == 'hidden'}
|
{if $field['type'] == 'hidden'}
|
||||||
<input type="hidden" name="{$key}" value="{$field['value']}" />
|
<input type="hidden" name="{$key}" value="{$field['value']}" />
|
||||||
{else}
|
{else}
|
||||||
@@ -195,6 +196,7 @@
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
{/block}
|
{/block}
|
||||||
{/if}
|
{/if}
|
||||||
|
{/block}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{if isset($categoryData['submit'])}
|
{if isset($categoryData['submit'])}
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
|
|||||||
@@ -97,7 +97,21 @@ class AdminThemesControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
$this->can_display_themes = (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP) ? true : false;
|
||||||
|
|
||||||
$this->options = array(
|
$this->options = array(
|
||||||
|
'theme' => array(
|
||||||
|
'title' => sprintf($this->l('Select theme for shop %s'), $this->context->shop->name),
|
||||||
|
'description' => (!$this->can_display_themes) ? $this->l('You must select a shop in top list if you want to select a theme') : '',
|
||||||
|
'fields' => array(
|
||||||
|
'theme_for_shop' => array(
|
||||||
|
'type' => 'theme',
|
||||||
|
'themes' => Theme::getThemes(),
|
||||||
|
'id_theme' => $this->context->shop->id_theme,
|
||||||
|
'can_display_themes' => $this->can_display_themes,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
'appearance' => array(
|
'appearance' => array(
|
||||||
'title' => $this->l('Appearance'),
|
'title' => $this->l('Appearance'),
|
||||||
'icon' => 'email',
|
'icon' => 'email',
|
||||||
@@ -581,6 +595,23 @@ class AdminThemesControllerCore extends AdminController
|
|||||||
Configuration::updateGlobalValue('PS_FAVICON', 'favicon.ico');
|
Configuration::updateGlobalValue('PS_FAVICON', 'favicon.ico');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update theme for current shop
|
||||||
|
*/
|
||||||
|
public function updateOptionThemeForShop()
|
||||||
|
{
|
||||||
|
if (!$this->can_display_themes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$id_theme = (int)Tools::getValue('id_theme');
|
||||||
|
if ($id_theme && $this->context->shop->id_theme != $id_theme)
|
||||||
|
{
|
||||||
|
$this->context->shop->id_theme = $id_theme;
|
||||||
|
$this->context->shop->update();
|
||||||
|
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function uploadIco($name, $dest)
|
protected function uploadIco($name, $dest)
|
||||||
{
|
{
|
||||||
if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name']))
|
if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name']))
|
||||||
|
|||||||
Reference in New Issue
Block a user