// Add live configurator toolbox - Part 1

This commit is contained in:
Jerome Nadaud
2013-11-18 14:39:46 +01:00
parent 239604b70c
commit 867eef79cc
11 changed files with 575 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;
@@ -0,0 +1,183 @@
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
#gear-right{
background: #333333;
display: block;
height: 50px;
left: 215px;
position: fixed;
top: 90px;
width: 50px;
z-index: 20;
}
#gear-right i{
display: block;
padding-top: 10px;
text-align: center;
}
#tool_customization{
position: fixed;
left: 0;
top: 90px;
z-index: 20;
height: auto;
width: 215px;
background: #333333
}
#tool_customization p{
padding: 15px;
color:#ffffff;
font-size: 13px;
text-shadow: 0.1em 0.1em 0.05em #000000
}
#tool_customization p span{
color:#8d8c8c;
font-size: 11px;
}
#tool_customization .list-tools{
background: #484848;
border:1px solid #595959;
border-left: none;
border-right:none;
height:50px;
}
#tool_customization .list-tools p{font-weight: bold;}
#tool_customization .list-tools i{padding-top: 3px}
#tool_customization #color-box{padding: 15px}
#tool_customization #color-box ul li{
display: inline-block;
border: 1px solid #595959;
height:27px;
width: 27px;
margin:5px 5px 5px 0;
}
#tool_customization #color-box .color-theme1{
display:block;
width:0px;
height:0px;
border-left-color:transparent !important;
border-top-color:transparent !important;
position: relative;
z-index: 1
}
#tool_customization #color-box .color-theme2{
display:block;
width:25px;
height:25px;
position: relative;
top: -26px;
}
#tool_customization #color-box .theme1 .color1{border:13px solid #ffffff;}
#tool_customization #color-box .theme1 .color2{background: #484848;}
#tool_customization #color-box .theme2 .color1{border:13px solid #f6f6f6;}
#tool_customization #color-box .theme2 .color2{background: #f2404e;}
#tool_customization #color-box .theme3 .color1{border:13px solid #333333;}
#tool_customization #color-box .theme3 .color2{background: #545454;}
#tool_customization #color-box .theme4 .color1{border:13px solid #272727;}
#tool_customization #color-box .theme4 .color2{background: #eac22d;}
#tool_customization #color-box .theme5 .color1{border:13px solid #ffffff;}
#tool_customization #color-box .theme5 .color2{background: #729f42;}
#tool_customization #color-box .theme6 .color1{border:13px solid #f5f1e8;}
#tool_customization #color-box .theme6 .color2{background: #b04444;}
#tool_customization #color-box .theme7 .color1{border:13px solid #f1f1f1;}
#tool_customization #color-box .theme7 .color2{background: #317081;}
#tool_customization #color-box .theme8 .color1{border:13px solid #fcfcfc;}
#tool_customization #color-box .theme8 .color2{background: #43bebc;}
#tool_customization #color-box .theme9 .color1{border:13px solid #f9f6ed;}
#tool_customization #color-box .theme9 .color2{background: #eea200;}
#tool_customization #font-box{padding:0 15px 15px;}
#tool_customization #font-box p{
padding:0;
margin: 15px 0 5px;
color:#9c9b9b;
}
#tool_customization #font-box .font-list{
background: #484848;
border:1px solid #595959;
height:30px;
width:180px;
color:#ffffff;
}
#tool_customization #font-box .font-list li{clear:both;padding-right: 10px;}
#tool_customization #font-box .font-list li p{
display: inline-block;
margin: 0;
padding: 5px 15px;
color:#9c9b9b;
text-shadow: 0 0 0 transparent;
}
#tool_customization #font-box .font-list li i{padding-top: 6px}
#tool_customization .btn-tools{
background: #484848;
border:1px solid #595959;
border-left: none;
border-right:none;
height: 56px;
padding: 10px 15px;
}
#tool_customization .btn{font-weight: bold;}
#tool_customization .btn-1{
background: #727171;
color: #ffffff;
text-shadow: 0.1em 0.1em 0.05em #000000
}
#tool_customization .btn-2{
background: #ffffff;
color: #3a3939;
}
#tool_customization #block-advertisement{
padding: 15px
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../');
exit;
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;
@@ -0,0 +1,36 @@
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(
function ()
{
$('#color-box').find('li').click(
function()
{
$('#theme').val($(this).attr('class'));
}
);
}
);
@@ -40,7 +40,55 @@ class ThemeConfigurator extends Module
$this->bootstrap = true;
}
public function install()
{
$themes_colors = array('theme1', 'theme2', 'theme3', 'theme4', 'theme5', 'theme6', 'theme7', 'theme8', 'theme9');
$themes_fonts = array(
'Georgia, serif',
'"Palatino Linotype", "Book Antiqua", Palatino, serif',
'"Times New Roman", Times, serif',
'Arial, Helvetica, sans-serif',
'"Arial Black", Gadget, sans-serif',
'Impact, Charcoal, sans-serif',
'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
'Tahoma, Geneva, sans-serif',
'"Trebuchet MS", Helvetica, sans-serif',
'Verdana, Geneva, sans-serif',
'"Courier New", Courier, monospace',
'"Lucida Console", Monaco, monospace'
);
return (parent::install()
&& $this->registerHook('top')
&& Configuration::updateValue('PS_TC_THEMES', serialize($themes_colors))
&& Configuration::updateValue('PS_TC_THEMES_FONTS', serialize($themes_fonts)));
}
public function hookTop($params)
{
if ((int)Tools::getValue('live_configurator', 0) == 1)
{
if (Tools::isSubmit('submitLiveConfigurator'))
{
Configuration::updateValue('PS_TC_THEME', Tools::getValue('theme'));
Configuration::updateValue('PS_TC_TEXT_PAGE_FONT', Tools::getValue('text-page-font'));
Configuration::updateValue('PS_TC_TEXT_MENU_FONT', Tools::getValue('text-menu-font'));
Configuration::updateValue('PS_TC_PRODUCT_NAME_FONT', Tools::getValue('product-name-font'));
}
$this->context->controller->addCSS($this->_path.'css/live_configurator.css');
$this->context->controller->addJS($this->_path.'js/live_configurator.js');
$this->smarty->assign(array(
'themes_colors' => unserialize(Configuration::get('PS_TC_THEMES_COLORS')),
'themes_fonts' => unserialize(Configuration::get('PS_TC_THEMES_FONTS')),
'advertisement_image' => $this->_path.'/img/'.$this->context->language->iso_code.'/advertisement.png',
'advertisement_text' => $this->l('Over 500+ PrestaShop Premium Templates! Browse Now!')
));
return $this->display(__FILE__, 'live_configurator.tpl');
}
}
public function getContent()
{
if (Tools::isSubmit('submitModule'))
@@ -76,7 +124,6 @@ class ThemeConfigurator extends Module
public function renderForm()
{
$inputs = array();
foreach ($this->getConfigurableModules() as $module)
$inputs[] = array(
@@ -107,7 +154,7 @@ class ThemeConfigurator extends Module
'input' => $inputs,
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-primary')
'class' => 'btn btn-default')
),
);
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../');
exit;
@@ -0,0 +1,90 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div id="gear-right">
<i class="icon-cogs icon-2x icon-light"></i>
</div>
<form action="" method="post">
<input type="hidden" name="theme" id="theme" />
<div id="tool_customization">
<p>
{l s='The customization tool allows you to make color and font changes in your theme.' mod='themeconfigurator'}<br /><br />
<span>
{l s='Only you, as a merchant can see this tool (as you are currently logged in your Back-office), your visitors will not see this tool.' mod='themeconfigurator'}
</span>
</p>
<div class="list-tools">
<p>
{l s='Color theme' mod='themeconfigurator'}
<i class="icon-caret-down pull-right"></i>
</p>
</div>
{if isset($themes_colors)}
<div id="color-box">
<ul>
{foreach $themes_colors as $theme}
<li class="{$theme}">
<div class="color-theme1 color1"></div>
<div class="color-theme2 color2"> </div>
</li>
{/foreach}
</ul>
</div>
{/if}
<div class="list-tools">
<p>
{l s='Font' mod='themeconfigurator'}
<i class="icon-caret-down pull-right"></i>
</p>
</div>
<div id="font-box">
<p>{l s='Text page' mod='themeconfigurator'}</p>
<select name="text-page-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
<p>{l s='Text menu parrent normal' mod='themeconfigurator'}</p>
<select name="text-menu-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
<p>{l s='Product name' mod='themeconfigurator'}</p>
<select name="product-name-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
</div>
<div class="btn-tools">
<button type="reset" class="btn btn-1">{l s='Reset' mod='themeconfigurator'}</button>
<button type="submit" class="btn btn-2" name="submitLiveConfigurator">{l s='Save' mod='themeconfigurator'}</button>
</div>
<div id="block-advertisement">
<img src="{$advertisement_image}" alt="{$advertisement_text}" />
</div>
</div>
</form>
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../');
exit;