Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

Conflicts:
	admin-dev/themes/default/template/controllers/modules/configure.tpl
This commit is contained in:
Kevin Granger
2013-11-18 10:23:23 +01:00
140 changed files with 3166 additions and 1338 deletions
+7 -2
View File
@@ -378,8 +378,13 @@ $( document ).ready(function() {
}
$('#datepickerExpand').on('click',function() {
$('#datepicker').removeClass('hide');
$('#date-start').focus();
if ($('#datepicker').hasClass('hide'))
{
$('#datepicker').removeClass('hide');
$('#date-start').focus();
}
else
$('#datepicker').addClass('hide');
});
$('.submitDateDay').on('click',function(e){
+12
View File
@@ -11,6 +11,8 @@ Tree.prototype =
init: function ()
{
var that = $(this);
this.$element.find("label.tree-toggler").click(
function ()
{
@@ -19,12 +21,16 @@ Tree.prototype =
$(this).parent().children(".icon-folder-open")
.removeClass("icon-folder-open")
.addClass("icon-folder-close");
that.trigger('collapse');
}
else
{
$(this).parent().children(".icon-folder-close")
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
that.trigger('expand');
}
$(this).parent().parent().children("ul.tree").toggle(300);
}
@@ -36,6 +42,8 @@ Tree.prototype =
$('li input:checked').parent().addClass("tree-selected");
}
);
return $(this);
},
collapseAll : function($speed)
@@ -49,6 +57,8 @@ Tree.prototype =
$(this).parent().parent().children("ul.tree").hide($speed);
}
);
return $(this);
},
expandAll : function($speed)
@@ -62,6 +72,8 @@ Tree.prototype =
$(this).parent().parent().children("ul.tree").show($speed);
}
);
return $(this);
},
};
@@ -128,6 +128,22 @@
<dd><a href="http://www.prestashop.com/en/contact-us?utm_source=backoffice_dashboard" target="_blank">{l s="Go to prestashop.com"}</a></dd>
</dl>
</section>
<section class="dash_simulation panel">
<h3><i class="icon-link"></i> {l s="Simulation Mode"}</h3>
<span class="switch prestashop-switch">
<input id="PS_DASHBOARD_SIMULATION_on" class="ps_dashboard_simulation" type="radio" checked="checked" value="1" name="PS_DASHBOARD_SIMULATION">
<label class="radioCheck" for="PS_DASHBOARD_SIMULATION_on">
<i class="icon-check-sign color_success"></i> {l s='Yes'}
</label>
<input id="PS_DASHBOARD_SIMULATION_off" class="ps_dashboard_simulation" type="radio" value="0" name="PS_DASHBOARD_SIMULATION">
<label class="radioCheck" for="PS_DASHBOARD_SIMULATION_off">
<i class="icon-ban-circle color_danger"></i> {l s='No'}
</label>
<span class="slide-button btn btn-default"></span>
</span>
</section>
</div>
</div>
</div>
@@ -177,7 +177,7 @@
</div>
<div id="login-footer" class="animated fadeIn">
<p class="text-center text-muted">
<a href="http://www.prestashop.com/">
<a href="http://www.prestashop.com/" onclick="return !window.open(this.href);">
&copy; PrestaShop&#8482; 2005-{$smarty.now|date_format:"%Y"} - All rights reserved
</a>
</p>
@@ -32,7 +32,7 @@
</button>
<ul class="dropdown-menu">
{foreach from=$module_languages item=language}
<li><a href="{$tradlink}{$language['iso_code']}#{$module_name}">{$language.name}</a></li>
<li><a href="{$trad_link}{$language['iso_code']}#{$module_name}">{$language.name}</a></li>
{/foreach}
</ul>
</div>
@@ -25,19 +25,37 @@
<div class="bootstrap">
<div class="page-head">
<h2 class="page-title">
{l s='Configure'} : {$module_name}
{l s='Configure:'} {$module_display_name} ({$module_name})
</h2>
<div class="page-bar toolbarBox">
<div class="btn-toolbar">
<ul class="cc_button nav nav-pills pull-right">
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_hooklink}" title="{l s='Manage hooks'}">
<a id="desc-module-hook" class="toolbar_btn" href="{$module_disable_link}" title="{l s='Disable'}">
<i class="process-icon-off"></i>
<div>{l s='Disable'}</div>
</a>
</li>
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_uninstall_link}" title="{l s='Uninstall'}">
<i class="process-icon-minus-sign-alt"></i>
<div>{l s='Uninstall'}</div>
</a>
</li>
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_reset_link}" title="{l s='Reset'}">
<i class="process-icon-share-alt"></i>
<div>{l s='Reset'}</div>
</a>
</li>
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_hook_link}" title="{l s='Manage hooks'}">
<i class="process-icon-anchor"></i>
<div>{l s='Manage hooks'}</div>
</a>
</li>
<li>
<a id="desc-module-back" class="toolbar_btn" href="{$backlink}" title="{l s='Back'}">
<a id="desc-module-back" class="toolbar_btn" href="{$back_link}" title="{l s='Back'}">
<i class="process-icon-back" ></i>
<div>{l s='Back'}</div>
</a>
@@ -155,7 +155,7 @@
</div>
<div class="col-lg-3">
<div class="panel">
<h3><i class="icon-eye-open"></i> {l s='LiveEdit'}</h3>
<h3><i class="icon-eye-open"></i> {l s='Live Edit'}</h3>
{if $live_edit}
<p>{l s='You have to select a shop to use LiveEdit'}</p>
{else}
@@ -80,7 +80,17 @@
});
{/if}
$(document).ready(function () {
$("#{$id}").tree("collapseAll");
var tree = $("#{$id}").tree("collapseAll");
tree.on('collapse', function() {
$('#expand-all-{$id}').show();
});
tree.on('expand', function() {
$('#collapse-all-{$id}').show();
});
$('#collapse-all-{$id}').hide();
$("#{$id}").find(":input[type=radio]").click(
function()
{
@@ -61,7 +61,7 @@
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="btn btn-default" />
<button type="button" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" class="btn btn-default">{l s='Update translations'}</button>
<script type="text/javascript">
$(document).ready(function(){
@@ -87,13 +87,13 @@
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<input type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<button type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" class="btn btn-default">{l s='Update translations'}</button>
<br />
{foreach $modules_translations as $theme_name => $theme}
{if $theme_name}<h2>&gt;{l s='Theme:'} <a name="{$theme_name}">{$theme_name}</h2>{/if}
{foreach $theme as $module_name => $module}
<h3>{l s='Module:'} <a name="{$module_name}">{$module_name}</a></h3>
<h2>{l s='Module:'} <a name="{$module_name}">{$module_name}</a></h2>
{foreach $module as $template_name => $newLang}
{if !empty($newLang)}
{assign var=occurrences value=0}
@@ -1,4 +1,4 @@
<li class="help-context-{$label|escape:'htmlall':'UTF-8'}" style="display:none">
<li class="help-context-{$label|escape:'htmlall':'UTF-8'}">
<a id="desc-{$label|escape:'htmlall':'UTF-8'}-help"
class="toolbar_btn"
href="#"
@@ -74,7 +74,7 @@
<div class="alert alert-warning" id="{$list_id}-empty-filters-alert" style="display:none;">{l s='Please fill at least one field to perform a search in this list.'}</div>
{block name="startForm"}
<form method="post" action="{$action}" class="form-horizontal clearfix">
<form method="post" action="{$action}" class="form-horizontal clearfix" id="{$list_id}">
{/block}
{if !$simple_header}
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
+5
View File
@@ -1067,4 +1067,9 @@ class ValidateCore
{
return (preg_match('/^[0-1]\.[0-9]{1,2}(\.[0-9]{1,2}){0,2}$/', $version) && ip2long($version));
}
public static function isOrderInvoiceNumber($id)
{
return (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id));
}
}
+4 -2
View File
@@ -144,7 +144,7 @@ class HelperFormCore extends Helper
$uploader->setFiles(array(
0 => array(
'type' => HelperUploader::TYPE_IMAGE,
'image' => isset($params['thumb'])?'<img src="'.$params['thumb'].'" alt="'.$params['title'].'" title="'.$params['title'].'" />':null,
'image' => isset($params['thumb'])?'<img src="'.$params['thumb'].'" alt="'.(isset($params['title']) ? $params['title'] : '').'" title="'.(isset($params['title']) ? $params['title'] : '').'" />':null,
)));
$uploader->setTitle(isset($params['title'])?$params['title']:null);
@@ -245,7 +245,7 @@ class HelperFormCore extends Helper
*
* @return string
*/
public function renderAssoShop($params, $disable_shared = false)
public function renderAssoShop($disable_shared = false, $template_directory = null)
{
if (!Shop::isFeatureActive())
return;
@@ -288,6 +288,8 @@ class HelperFormCore extends Helper
}*/
$tree = new HelperTreeShops('shop-tree', 'Shops');
if (isset($template_directory))
$tree->setTemplateDirectory($template_directory);
$tree->setSelectedShops($assos);
$tree->setAttribute('table', $this->table);
return $tree->render();
+1 -1
View File
@@ -526,7 +526,7 @@ class HelperListCore extends Helper
if (Tools::getIsset($this->table.'Orderby'))
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table;
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->list_id;
/* Determine current page number */
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
+16 -15
View File
@@ -212,36 +212,37 @@ class HelperTreeCategoriesCore extends TreeCore
$this->setAttribute('use_search', $this->useSearch());
}
$this->addAction(new TreeToolbarLink(
$collapse_all = new TreeToolbarLink(
'Collapse All',
'#',
'$(\'#'.$this->getId().'\').tree(\'collapseAll\')',
'icon-collapse-alt')
);
$this->addAction(new TreeToolbarLink(
'$(\'#'.$this->getId().'\').tree(\'collapseAll\');$(\'#collapse-all-'.$this->getId().'\').hide();$(\'#expand-all-'.$this->getId().'\').show();',
'icon-collapse-alt');
$collapse_all->setAttribute('id', 'collapse-all-'.$this->getId());
$expand_all = new TreeToolbarLink(
'Expand All',
'#',
'$(\'#'.$this->getId().'\').tree(\'expandAll\')',
'icon-expand-alt')
);
'$(\'#'.$this->getId().'\').tree(\'expandAll\');$(\'#collapse-all-'.$this->getId().'\').show();$(\'#expand-all-'.$this->getId().'\').hide();',
'icon-expand-alt');
$expand_all->setAttribute('id', 'expand-all-'.$this->getId());
$this->addAction($collapse_all);
$this->addAction($expand_all);
if ($this->useCheckBox())
{
$checkAll = new TreeToolbarLink(
$check_all = new TreeToolbarLink(
'Check All',
'#',
'checkAllAssociatedCategories($(\'#'.$this->getId().'\'));',
'icon-check-sign');
$checkAll->setAttribute('id', 'check-all-'.$this->getId());
$unCheckAll = new TreeToolbarLink(
$check_all->setAttribute('id', 'check-all-'.$this->getId());
$uncheck_all = new TreeToolbarLink(
'Uncheck All',
'#',
'uncheckAllAssociatedCategories($(\'#'.$this->getId().'\'));',
'icon-check-empty');
$unCheckAll->setAttribute('id', 'uncheck-all-'.$this->getId());
$this->addAction($checkAll);
$this->addAction($unCheckAll);
$uncheck_all->setAttribute('id', 'uncheck-all-'.$this->getId());
$this->addAction($check_all);
$this->addAction($uncheck_all);
$this->setNodeFolderTemplate('tree_node_folder_checkbox.tpl');
$this->setNodeItemTemplate('tree_node_item_checkbox.tpl');
$this->setAttribute('use_checkbox', $this->useCheckBox());
+22
View File
@@ -123,6 +123,28 @@ class OrderInvoiceCore extends ObjectModel
AND od.`id_order_invoice` = '.(int)$this->id);
}
public static function getInvoiceByNumber($id_invoice)
{
if (is_numeric($id_invoice))
$id_invoice = (int)($id_invoice);
elseif (is_string($id_invoice))
{
$matches = array();
if (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id_invoice, $matches) !== FALSE)
$id_invoice = $matches[1];
}
else
return false;
$id_order_invoice = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_order_invoice`
FROM `'._DB_PREFIX_.'order_invoice`
WHERE number = '.$id_invoice
);
return ($id_order_invoice ? new OrderInvoice($id_order_invoice) : false);
}
/**
* Get order products
*
+3 -3
View File
@@ -61,7 +61,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
$this->getToolbar()->setActions($value);
$this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->setActions($value);
return $this;
}
@@ -70,7 +70,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
return $this->getToolbar()->getActions();
return $this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->getActions();
}
public function setAttribute($name, $value)
@@ -293,7 +293,7 @@ class TreeCore
if (!isset($this->_toolbar))
$this->setToolbar(new TreeToolbarCore());
$this->getToolbar()->addAction($action);
$this->getToolbar()->setTemplateDirectory($this->getTemplateDirectory())->addAction($action);
return $this;
}
+7 -3
View File
@@ -40,12 +40,13 @@ class TreeToolbarCore implements ITreeToolbarCore
return $this->render();
}
public function setActions($value)
public function setActions($actions)
{
if (!is_array($value) && !$value instanceof Traversable)
if (!is_array($actions) && !$actions instanceof Traversable)
throw new PrestaShopException('Action value must be an traversable array');
$this->_actions = $value;
foreach($actions as $action)
$this->addAction($action);
}
public function getActions()
@@ -165,6 +166,9 @@ class TreeToolbarCore implements ITreeToolbarCore
if (!isset($this->_actions))
$this->_actions = array();
if (isset($this->_template_directory))
$action->setTemplateDirectory($this->getTemplateDirectory());
$this->_actions[] = $action;
return $this;
}
+40 -4
View File
@@ -155,13 +155,49 @@ abstract class TreeToolbarButtonCore
public function getTemplateDirectory()
{
if (!isset($this->_template_directory))
$this->_template_directory = $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)
.self::DEFAULT_TEMPLATE_DIRECTORY);
$this->_template_directory = $this->_normalizeDirectory(self::DEFAULT_TEMPLATE_DIRECTORY);
return $this->_template_directory;
}
public function getTemplateFile($template)
{
if (preg_match_all('/((?:^|[A-Z])[a-z]+)/', get_class($this->getContext()->controller), $matches) !== FALSE)
$controllerName = strtolower($matches[0][1]);
if ($this->getContext()->controller instanceof ModuleAdminController)
return $this->_normalizeDirectory(
$this->getContext()->controller->getTemplatePath())
.$this->getTemplateDirectory().$template;
else if ($this->getContext()->controller instanceof AdminController
&& isset($controllerName) && file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
.DIRECTORY_SEPARATOR
.$controllerName
.DIRECTORY_SEPARATOR
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
.DIRECTORY_SEPARATOR
.$controllerName
.DIRECTORY_SEPARATOR
.$this->getTemplateDirectory().$template;
else if (file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(1))
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(1))
.$this->getTemplateDirectory().$template;
else if (file_exists($this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0))
.$this->getTemplateDirectory().$template))
return $this->_normalizeDirectory(
$this->getContext()->smarty->getTemplateDir(0))
.$this->getTemplateDirectory().$template;
else
return $this->getTemplateDirectory().$template;
}
public function hasAttribute($name)
{
return (isset($this->_attributes)
@@ -171,7 +207,7 @@ abstract class TreeToolbarButtonCore
public function render()
{
return $this->getContext()->smarty->createTemplate(
$this->getTemplateDirectory().$this->getTemplate(),
$this->getTemplateFile($this->getTemplate()),
$this->getContext()->smarty
)->assign($this->getAttributes())->fetch();
}
@@ -553,7 +553,17 @@ class AdminAttributesGroupsControllerCore extends AdminController
case 'editAttributes':
if ($this->id_attribute)
$bread_extended[] = $this->l('Edit Value');
{
if (($id = Tools::getValue('id_attribute_group')))
{
if (Validate::isLoadedObject($obj = new AttributeGroup((int)$id)))
$bread_extended[] = '<a href="'.Context::getContext()->link->getAdminLink('AdminAttributesGroups').'&id_attribute_group='.$id.'&viewattribute_group">'.$obj->name[$this->context->employee->id_lang].'</a>';
if (Validate::isLoadedObject($obj = new Attribute((int)$this->id_attribute)))
$bread_extended[] = sprintf($this->l('Edit: %s'), $obj->name[$this->context->employee->id_lang]);
}
else
$bread_extended[] = $this->l('Edit Value');
}
else
$bread_extended[] = $this->l('Add New Values');
break;
+8 -14
View File
@@ -309,7 +309,13 @@ class AdminDashboardControllerCore extends AdminController
die(Tools::jsonEncode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
}
public function ajaxProcessSetSimulationMode()
{
Configuration::updateValue('PS_DASHBOARD_SIMULATION', (int)Tools::getValue('PS_DASHBOARD_SIMULATION'));
die ('k'.Configuration::get('PS_DASHBOARD_SIMULATION').'k');
}
public function ajaxProcessGetBlogRss()
{
$return = array('has_errors' => false, 'rss' => array());
@@ -371,19 +377,7 @@ class AdminDashboardControllerCore extends AdminController
$return['widget_html'] = $module_obj->$hook($params);
die(Tools::jsonEncode($return));
}
public function ajaxProcessSavePreactivationRequest()
{
$isoUser = Context::getContext()->language->iso_code;
$isoCountry = Context::getContext()->country->iso_code;
$employee = new Employee((int)Context::getContext()->cookie->id_employee);
$firstname = $employee->firstname;
$lastname = $employee->lastname;
$email = $employee->email;
$return = @Tools::file_get_contents('http://api.prestashop.com/partner/premium/set_request.php?iso_country='.strtoupper($isoCountry).'&iso_lang='.strtolower($isoUser).'&host='.urlencode($_SERVER['HTTP_HOST']).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&partner='.htmlentities(Tools::getValue('module')).'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&email='.urlencode($email).'&firstname='.urlencode($firstname).'&lastname='.urlencode($lastname).'&type=home');
die($return);
}
}
}
+13 -6
View File
@@ -699,15 +699,22 @@ class AdminModulesControllerCore extends AdminController
if (isset($module->multishop_context))
$this->multishop_context = $module->multishop_context;
$backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
$hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
$tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
$back_link = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
$hook_link = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
$trad_link = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
$disable_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&enable=0&tab_module='.$module->tab;
$uninstall_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&uninstall='.$module->name.'&tab_module='.$module->tab;
$reset_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&reset&tab_module='.$module->tab;
$this->context->smarty->assign(array(
'module_name' => $module->name,
'backlink' => $backlink,
'module_hooklink' => $hooklink,
'tradlink' => $tradlink,
'module_display_name' => $module->displayName,
'back_link' => $back_link,
'module_hook_link' => $hook_link,
'module_disable_link' => $disable_link,
'module_uninstall_link' => $uninstall_link,
'module_reset_link' => $reset_link,
'trad_link' => $trad_link,
'module_languages' => Language::getLanguages(false),
'theme_language_dir' => _THEME_LANG_DIR_
));
+2 -2
View File
@@ -124,8 +124,8 @@ class AdminSearchControllerCore extends AdminController
/* Invoices */
if ($searchType == 4)
{
if ((int)$this->query && Validate::isUnsignedInt((int)$this->query) && ($invoice = Order::getInvoice((int)$this->query)))
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.(int)($invoice['id_order']));
if (Validate::isOrderInvoiceNumber($this->query) && ($invoice = OrderInvoice::getInvoiceByNumber($this->query)))
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.(int)($invoice->id_order));
$this->errors[] = Tools::displayError('No invoice was found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
}
@@ -285,6 +285,7 @@ class AdminTrackingControllerCore extends AdminController
{
$this->table = '';
$this->actions = array();
$this->list_skip_actions = array();
$this->lang = false;
$this->identifier = '';
$this->_orderBy = '';
+1
View File
@@ -67,6 +67,7 @@ UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'BLOCK_CATEG_NBR_COLU
UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'UPGRADER_BACKUPDB_FILENAME';
UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'UPGRADER_BACKUPFILES_FILENAME';
UPDATE `PREFIX_configuration` SET value = '40' WHERE name = 'CONF_AVERAGE_PRODUCT_MARGIN';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'PS_DASHBOARD_SIMULATION';
/* No right column */
DELETE FROM `PREFIX_hook_module` WHERE id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn');
+3
View File
@@ -283,5 +283,8 @@
<hook id="displayBackOfficeCategory" live_edit="0">
<name>displayBackOfficeCategory</name><title>Display new elements in the Back Office, tab AdminCategories</title><description>This hook launches modules when the AdminCategories tab is displayed in the Back Office</description>
</hook>
<hook id="displayProductListFunctionalButtons" live_edit="0">
<name>displayProductListFunctionalButtons</name><title>Display new elements in the Front Office, products list</title><description>This hook launches modules when the products list is displayed in the Front Office</description>
</hook>
</entities>
</entity_hook>
+14 -20
View File
@@ -279,34 +279,28 @@ function saveDashConfig(widget_name) {
});
}
function preactivationLinkClick(module) {
$.ajax({
url : adminstats_ajax_url,
data : {
ajax : "1",
controller : "AdminDashboard",
action : "savePreactivationRequest",
module : module,
},
type: 'POST',
success : function(jsonData){
}
});
}
$(document).ready( function () {
$('#calendar_form input[type="submit"]').on('click', function(elt) {
elt.preventDefault();
setDashboardDateRange(elt.currentTarget.name);
});
$(".preactivationLink").on('click', function() {
preactivationLinkClick($(this).attr("rel"));
});
refreshDashboard(false, false);
getBlogRss();
bindSubmitDashConfig();
bindCancelDashConfig();
$('.ps_dashboard_simulation').change(function(e) {
$.ajax({
url : dashboard_ajax_url,
data : {
ajax:true,
action:'setSimulationMode',
PS_DASHBOARD_SIMULATION: $(this).val()
},
success : function(result) {
refreshDashboard(false, false);
}
});
});
});
+3 -1
View File
@@ -25,8 +25,10 @@ function displayHelpButton(label, iso_user, country_iso_code, _PS_VERSION_){
if(msg.content != 'none' && msg.content != '')
{
$('ul.cc_button').append(msg.content);
$('.help-context-'+help_class_name).fadeIn("fast").show();
$('.help-context-'+help_class_name);
}
else
$('.help-context-'+help_class_name).attr('disabled', 'disabled');
},
beforeSend: function(data)
{
+44 -25
View File
@@ -35,6 +35,8 @@ class AddShareThis extends Module
$this->author = 'Custom';
$this->tab = 'front_office_features';
$this->need_instance = 0;
$this->version = '0.1';
$this->bootstrap = true;
$this->_directory = dirname(__FILE__);
parent::__construct();
$this->displayName = $this->l('Add Sharethis');
@@ -74,7 +76,7 @@ class AddShareThis extends Module
public function getContent()
{
$this->_html .= '<h2>'.$this->displayName.'<span style=" float:right;"></span></h2><div class="clear"></div>';
$this->_html = '<h2><img src="'.$this->_path.'logo.png" alt="" title="" /> '.$this->displayName.'</h2>';
if (Tools::isSubmit('submitCog'))
{
$this->updateCog();
@@ -82,34 +84,49 @@ class AddShareThis extends Module
}
$this->_html .= '
<fieldset class="space" id="cogField">
<legend><img src="'.$this->_path.'logo.png" alt="" title="" /> '.$this->l('Configuration').'</legend>
<form id="cogForm" name="cogForm" method="post" action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'">
<br/>
<em>'.$this->l('(Key in your account statistic http://sharethis.com)').'</em>
<div class="clearfix"></div><br/><br/>
<label>'.$this->l('Publisher Pub Key:').'</label>
<div class="margin-form">
<input type="text" name="conf_row" value="1" id="conf_row" size="60" value="'.Tools::safeOutput(Tools::getValue('conf_row', Configuration::get('CONF_ROW'))).'" />
</div><br/><br/>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Twitter" id="Twitter"'.(Configuration::get('ADDTHISSHARE_TWITTER') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/twitter.gif" />
<div class="panel" id="cogField">
<h3><i class="icon-cogs"></i> '.$this->l('Configuration').'</h3>
<form id="cogForm" name="cogForm" method="post" action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" class="form-horizontal">
<br/><br/>
<div class="form-group">
<label class="control-label col-lg-3">'.$this->l('Publisher Pub Key:').'</label>
<div class="col-lg-9">
<input type="text" name="conf_row" value="1" id="conf_row" size="60" value="'.Tools::safeOutput(Tools::getValue('conf_row', Configuration::get('CONF_ROW'))).'" />
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Google" id="Google"'.(Configuration::get('ADDTHISSHARE_GOOGLE') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/google.gif" />
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<p class="help-block">'.$this->l('Key in your account statistic http://sharethis.com').'</p>
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Pinterest" id="Pinterest" '.(Configuration::get('ADDTHISSHARE_PINTEREST') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/pinterest.gif" />
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Twitter" id="Twitter"'.(Configuration::get('ADDTHISSHARE_TWITTER') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/twitter.gif" />
</div>
<div class="margin-form">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Facebook" id="Facebook"'.(Configuration::get('ADDTHISSHARE_FACEBOOK') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/facebook.gif" />
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Google" id="Google"'.(Configuration::get('ADDTHISSHARE_GOOGLE') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/google.gif" />
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Pinterest" id="Pinterest" '.(Configuration::get('ADDTHISSHARE_PINTEREST') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/pinterest.gif" />
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<input style="margin:-8px 20px 0 0;" value="1" type="checkbox" name="Facebook" id="Facebook"'.(Configuration::get('ADDTHISSHARE_FACEBOOK') ? ' checked="checked"' : '').' />
<img src="'.$this->_path.'img/facebook.gif" />
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-push-3">
<button type="submit" class="btn btn-default" name="submitCog" id="submitCog"><i class="icon-save"></i> '.$this->l('Save').'</button>
</div>
<br/><br/><div class="margin-form">
<input type="submit" class="button" name="submitCog" id="submitCog" value="'.$this->l('Save').'" />
</div>
</form>
</fieldset>';
@@ -161,8 +178,10 @@ class AddShareThis extends Module
public function hookExtraRight($params)
{
$cache_id = 'addsharethis_content|'.(int)$this->context->shop->id;
if (!$this->isCached('addsharethis.tpl', $cache_id))
{
$data = array();
if (Configuration::get('ADDTHISSHARE_TWITTER'))
$data['twitter'] = '<span class="st_twitter_hcount sharebtn" displayText="Tweet"></span>';
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>addsharethis</name>
<displayName><![CDATA[Add Sharethis]]></displayName>
<version><![CDATA[]]></version>
<version><![CDATA[0.1]]></version>
<description><![CDATA[Display social count button on the home page]]></description>
<author><![CDATA[Custom]]></author>
<tab><![CDATA[front_office_features]]></tab>
+185
View File
@@ -0,0 +1,185 @@
<?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
*/
if (!defined('_PS_VERSION_'))
exit;
class BlockBanner extends Module
{
public function __construct()
{
$this->name = 'blockbanner';
$this->tab = 'other';
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Banner block');
$this->description = $this->l('Displays banner at the top of the store.');
}
public function install()
{
Configuration::updateValue('BLOCKBANNER_IMG', 'store.jpg');
Configuration::updateValue('BLOCKBANNER_LINK', '');
Configuration::updateValue('BLOCKBANNER_DESC', '');
return parent::install() && $this->registerHook('displayTop') && $this->registerHook('header');
}
public function uninstall()
{
Configuration::deleteByName('BLOCKBANNER_IMG');
Configuration::deleteByName('BLOCKBANNER_LINK');
Configuration::deleteByName('BLOCKBANNER_DESC');
return parent::uninstall();
}
public function hookDisplayTop($params)
{
if (!$this->isCached('blockbanner.tpl', $this->getCacheId()))
{
if (file_exists(_PS_MODULE_DIR_.'blockbanner'.DIRECTORY_SEPARATOR.Configuration::get('BLOCKBANNER_IMG')))
$this->smarty->assign('banner_img', Configuration::get('BLOCKBANNER_IMG'));
$this->smarty->assign('banner_link', Configuration::get('BLOCKBANNER_LINK'));
$this->smarty->assign('banner_desc', Configuration::get('BLOCKBANNER_DESC'));
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'store s'
.Shop::addSqlAssociation('store', 's');
$total = Db::getInstance()->getValue($sql);
if ($total <= 0)
return;
}
return $this->display(__FILE__, 'blockbanner.tpl', $this->getCacheId());
}
public function hookHeader($params)
{
$this->context->controller->addCSS($this->_path.'blockbanner.css', 'all');
}
public function postProcess()
{
if (Tools::isSubmit('submitStoreConf'))
{
if (isset($_FILES['BLOCKBANNER_IMG']) && isset($_FILES['BLOCKBANNER_IMG']['tmp_name']) && !empty($_FILES['BLOCKBANNER_IMG']['tmp_name']))
{
if ($error = ImageManager::validateUpload($_FILES['BLOCKBANNER_IMG'], 4000000))
return $this->displayError($this->l('Invalid image'));
else
{
$ext = substr($_FILES['BLOCKBANNER_IMG']['name'], strrpos($_FILES['BLOCKBANNER_IMG']['name'], '.') + 1);
$file_name = md5($_FILES['BLOCKBANNER_IMG']['name']).'.'.$ext;
if (!move_uploaded_file($_FILES['BLOCKBANNER_IMG']['tmp_name'], dirname(__FILE__).'/'.$file_name))
return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
else
{
if (Configuration::hasContext('BLOCKBANNER_IMG', null, Shop::getContext()) && Configuration::get('BLOCKBANNER_IMG') != $file_name)
@unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKBANNER_IMG'));
Configuration::updateValue('BLOCKBANNER_IMG', $file_name);
$this->_clearCache('blockbanner.tpl');
return $this->displayConfirmation($this->l('The settings have been updated.'));
}
}
}
Configuration::updateValue('BLOCKBANNER_LINK', Tools::getValue('BLOCKBANNER_LINK'));
Configuration::updateValue('BLOCKBANNER_DESC', Tools::getValue('BLOCKBANNER_DESC'));
}
return '';
}
public function getContent()
{
return $this->postProcess().$this->renderForm();
return $output;
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'file',
'label' => $this->l('Block image'),
'name' => 'BLOCKBANNER_IMG',
'desc' => $this->l('Please upload banner image'),
'thumb' => '../modules/'.$this->name.'/'.Configuration::get('BLOCKBANNER_IMG'),
),
array(
'type' => 'text',
'label' => $this->l('Image Link'),
'name' => 'BLOCKBANNER_LINK',
'desc' => $this->l('Please input banner link')
),
array(
'type' => 'text',
'label' => $this->l('Image description'),
'name' => 'BLOCKBANNER_DESC',
'desc' => $this->l('Please input banner image description')
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default')
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitStoreConf';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues()
{
return array(
'BLOCKBANNER_IMG' => Tools::getValue('BLOCKBANNER_IMG', Configuration::get('BLOCKBANNER_IMG')),
'BLOCKBANNER_LINK' => Tools::getValue('BLOCKBANNER_LINK', Configuration::get('BLOCKBANNER_LINK')),
'BLOCKBANNER_DESC' => Tools::getValue('BLOCKBANNER_DESC', Configuration::get('BLOCKBANNER_DESC')),
);
}
}
+40
View File
@@ -0,0 +1,40 @@
{*
* 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
*}
<!-- Block stores module -->
<div id="banner_block_top">
<div class="banner-top">
<div class="container">
<a href="{$banner_link}" title="{$banner_desc}">
{if isset($banner_img)}
<img class="img-responsive" src="{$module_dir}{$banner_img}" alt=""/>
{else}
{$banner_desc}
{/if}
</a>
</div>
</div>
</div>
<!-- /Block stores module -->
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockbanner</name>
<displayName><![CDATA[Banner block]]></displayName>
<version><![CDATA[1]]></version>
<description><![CDATA[Displays banner at the top of the store.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[other]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
+35
View File
@@ -0,0 +1,35 @@
<?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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,35 @@
<?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;
+5 -3
View File
@@ -129,13 +129,15 @@ class BlockCategories extends Module
if (!isset($resultIds[$id_category]))
return false;
$return = array(
'id' => $id_category,
'link' => $this->context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']),
'name' => $resultIds[$id_category]['name'],
'desc'=> $resultIds[$id_category]['description'],
'name' => $resultIds[$id_category]['name'],
'desc'=> $resultIds[$id_category]['description'],
'children' => $children
);
return $return;
}
@@ -215,7 +217,7 @@ class BlockCategories extends Module
$resultIds[$row['id_category']] = &$row;
}
$blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category ? $category->id : null));
$blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category && (!isset($params['is_top_menu']) || !$params['is_top_menu']) ? $category->id : null));
$this->smarty->assign('blockCategTree', $blockCategTree);
if ($category)
@@ -0,0 +1,63 @@
{*
* 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
*}
<!-- Block categories module -->
<div id="categories_block_top">
<div class="category_top">
<div class="list">
<ul class="tree {if $isDhtml}dhtml{/if} sf-menu sf-js-enabled clearfix">
{foreach from=$blockCategTree.children item=child name=blockCategTree}
{if $smarty.foreach.blockCategTree.last}
{include file="$branche_tpl_path" node=$child last='true'}
{else}
{include file="$branche_tpl_path" node=$child}
{/if}
{if isset($blockCategTree.thumbnails) && $blockCategTree.thumbnails|count > 0}
<div id="category-thumbnails">
{foreach $blockCategTree.thumbnails as $thumbnail}
<div>{$thumbnail}</div>
{/foreach}
</div>
{/if}
{if ($smarty.foreach.blockCategTree.iteration mod $numberColumn) == 0 AND !$smarty.foreach.blockCategTree.last}
</ul>
</div>
</div>
<div class="category_footer" style="float:left;clear:none;width:{$widthColumn}%">
<div style="float:left" class="list">
<ul class="tree {if $isDhtml}dhtml{/if}">
{/if}
{/foreach}
</ul>
</div>
</div>
<br class="clear"/>
</div>
<!-- /Block categories module -->
@@ -19,7 +19,8 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registred Trademark & Property of PrestaShop SA
*/
@@ -31,10 +32,18 @@ require_once(dirname(__FILE__).'/../../init.php');
if (substr(Tools::encrypt('blocklayered/index'),0,10) != Tools::getValue('layered_token') || !Module::isInstalled('blocklayered'))
die('Bad token');
if (Tools::getValue('admin_dir', false))
{
define('_PS_ADMIN_DIR_', base64_decode(Tools::getValue('admin_dir')));
define('_PS_BO_ALL_THEMES_DIR_', _PS_ADMIN_DIR_.'/themes/');
}
include(dirname(__FILE__).'/blocklayered.php');
$category_box = Tools::getValue('categoryBox');
/* Clean categoryBox before use */
if (is_array($category_box))
foreach ($category_box AS &$value)
+251 -172
View File
@@ -61,7 +61,8 @@ class BlockLayered extends Module
&& $this->registerHook('afterSaveProduct') && $this->registerHook('productListAssign') && $this->registerHook('postProcessAttributeGroup')
&& $this->registerHook('postProcessFeature') && $this->registerHook('featureValueForm') && $this->registerHook('postProcessFeatureValue')
&& $this->registerHook('afterDeleteFeatureValue') && $this->registerHook('afterSaveFeatureValue') && $this->registerHook('attributeForm')
&& $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute'))
&& $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute')
&& $this->registerHook('displayBackOfficeHeader'))
{
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 1);
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
@@ -686,7 +687,7 @@ class BlockLayered extends Module
if ($result)
foreach ($result as $data)
$lang_value[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']);
$return = '<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="'.$this->l('Invalid characters:').' <>;=#{}_">
@@ -1281,6 +1282,17 @@ class BlockLayered extends Module
return $this->hookLeftColumn($params);
}
public function hookDisplayBackOfficeHeader()
{
if (method_exists($this->context->controller, 'addJquery'))
{
if (version_compare(_PS_VERSION_, '1.6.0', '>=') === TRUE)
$this->context->controller->addCSS($this->_path.'views/css/blocklayered_bt.css');
else
$this->context->controller->addCSS($this->_path.'views/css/blocklayered.css');
}
}
public function hookHeader($params)
{
global $smarty, $cookie;
@@ -1337,6 +1349,7 @@ class BlockLayered extends Module
$this->context->controller->addJS(($this->_path).'blocklayered.js');
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
$this->context->controller->addJQueryUI('ui.slider');
$this->context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css"');
$this->context->controller->addCSS(($this->_path).'blocklayered-15.css', 'all');
$this->context->controller->addJQueryPlugin('scrollTo');
@@ -1776,10 +1789,10 @@ class BlockLayered extends Module
<thead>
<tr>
<th class="fixed-width-xs"><span class="title_box">'.$this->l('ID').'</span></th>
<th class="text-left"><span class="title_box">'.$this->l('Name').'</span></th>
<th><span class="title_box text-left">'.$this->l('Name').'</span></th>
<th class="fixed-width-sm"><span class="title_box">'.$this->l('Categories').'</span></th>
<th><span class="title_box">'.$this->l('Created on').'</span></th>
<th><span class="title_box">'.$this->l('Actions').'</span></th>
<th><span class="title_box text-right">'.$this->l('Actions').'</span></th>
</tr>
</thead>';
@@ -1794,12 +1807,25 @@ class BlockLayered extends Module
<td class="text-left">'.$filters_template['name'].'</td>
<td>'.(int)$filters_template['n_categories'].'</td>
<td>'.Tools::displayDate($filters_template['date_add'],null , true).'</td>
<td>
<a href="#" onclick="return updElements('.($filters_template['n_categories'] ? 0 : 1).', '.(int)$filters_template['id_layered_filter'].');">
<img src="../img/admin/edit.gif" alt="" title="'.$this->l('Edit').'" /></a>
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteFilterTemplate=1&id_layered_filter='.(int)$filters_template['id_layered_filter'].'"
<td class="text-right">
<div class="btn-group-action">
<div class="btn-group">
<a href="#" class="btn btn-default" onclick="return updElements('.($filters_template['n_categories'] ? 0 : 1).', '.(int)$filters_template['id_layered_filter'].');">
<i class="icon-pencil"></i> '.$this->l('Edit').'
</a>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteFilterTemplate=1&id_layered_filter='.(int)$filters_template['id_layered_filter'].'"
onclick="return confirm(\''.addslashes(sprintf($this->l('Delete filter template #%d?'), (int)$filters_template['id_layered_filter'])).'\');">
<img src="../img/admin/delete.gif" alt="" title="'.$this->l('Delete').'" /></a>
<i class="icon-trash"></i> '.$this->l('Delete').'
</a>
</li>
</ul>
</div>
</div>
</td>
</tr>';
}
@@ -1814,52 +1840,25 @@ class BlockLayered extends Module
</div>
<div class="panel">
<h3><i class="icon-cogs"></i> '.$this->l('Build your own filter template').'</h3>
<link rel="stylesheet" href="'._PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css" />
<style type="text/css">
#error-filter-name { display: none; }
#layered_container_left ul, #layered_container_right ul { list-style-type: none; padding-left: 0px; }
.ui-effects-transfer { border: 1px solid #CCC; }
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
ul#selected_filters, #layered_container_right ul { list-style-type: none; margin: 0; padding: 0; }
ul#selected_filters li, #layered_container_right ul li { width: 326px; font-size: 11px; padding: 8px 9px 7px 20px; height: 14px; margin-bottom: 5px; }
ul#selected_filters li span.ui-icon { position: absolute; margin-top: -2px; margin-left: -18px; }
#layered_container_right ul li span { display: none; }
#layered_container_right ul li { padding-left: 8px; position: relative; }
#layered_container_left ul li { cursor: move; position: relative; }
#layered-cat-counter { display: none; }
#layered-step-2, #layered-step-3 { display: none; }
#layered-step-2 h3 { margin-top: 0; }
#table-filter-templates tr th, #table-filter-templates tr td { text-align: center; }
.filter_type { width: 70px; position: absolute; right: 53px; top: 5px;}
.filter_show_limit { position: absolute; width: 40px; right: 5px; top: 5px; }
#layered-step-3 .alert { width: auto; }
#fancybox-content {
height: 400px !important;
overflow: auto !important;
}
</style>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" onsubmit="return checkForm();">';
$html .= '
<h2>'.$this->l('Step 1/3 - Select categories').'</h2>
<p style="margin-top: 20px;">
<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >'.$this->l('Use this template for:').'</span>
<input type="radio" id="scope_1" name="scope" value="1" style="margin-left: 15px;" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" />
<label for="scope_1" style="float: none;">'.$this->l('All categories').'</label>
<input type="radio" id="scope_2" name="scope" value="2" style="margin-left: 15px;" class="layered-category-selection" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" />
<style>
.link {
color: black;
cursor: pointer;
text-decoration: underline;
}
.link:hover {
color: gray;
}
</style>
<label for="scope_2" style="float: none;"><a id="inline" href="#layered-categories-selection" style="text-decoration: underline;"></a>'.preg_replace('/\*([^*]+)\*/Usi', '<span class="link">$1</span>', $this->l('*Specific* categories')).'
(<span id="layered-cat-counter"></span> '.$this->l('selected').')</label>
</p>';
<h4>'.$this->l('Step 1/3 - Select categories').'</h4>
<hr />
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-lg-3">'.$this->l('Use this template for:').'</label>
<div class="col-lg-9">
<p class="radio">
<input type="radio" id="scope_1" name="scope" value="1" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" />
<label for="scope_1">'.$this->l('All categories').'</label>
</p>
<p class="radio">
<input type="radio" id="scope_2" name="scope" value="2" class="layered-category-selection" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" />
<label for="scope_2"><a id="inline" href="#layered-categories-selection">'.sprintf($this->l('Specific categories (%s selected)'), '<span id="layered-cat-counter"></span>').'</a></label>
</p>
</div>
</div>';
$shops = Shop::getShops(true, null, true);
if (count($shops) > 1)
@@ -1871,14 +1870,16 @@ class BlockLayered extends Module
if (Shop::isFeatureActive())
{
$html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >'.$this->l('Choose shop association:').'</span>';
$html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">'.$helper->renderAssoShop().'</div>';
$html .= '<div class="form-group">
<label class="control-label col-lg-3">'.$this->l('Choose shop association:').'</label>
<div class="col-lg-9">'.$helper->renderAssoShop().'</div>
</div>';
}
}
$html .= '
<div id="error-treeview" class="error" style="display: none;">
<img src="../img/admin/error2.png" alt="" /> '.$this->l('Please select at least one specific category or select "All categories".').'
$html .= '</div>
<div id="error-treeview" class="alert alert-danger" style="display: none;">
'.$this->l('Please select at least one specific category or select "All categories".').'
</div>
<div style="display: none;">
<div id="layered-categories-selection" style="padding: 10px; text-align: left;">
@@ -1903,24 +1904,22 @@ class BlockLayered extends Module
$html .= '
<br />
<center><input type="button" class="button" value="'.$this->l('Save this selection').'" onclick="$.fancybox.close();" /></center>
<button type="button" class="btn btn-default" onclick="$.fancybox.close();">'.$this->l('Save this selection').'</button>
</div>
</div>
<div id="layered-step-2">
<hr size="1" noshade />
<h2>'.$this->l('Step 2/3 - Select filters').'</h2>
<div id="layered-step-2" class="row" style="display:none">
<h4>'.$this->l('Step 2/3 - Select filters').'</h4>
<hr />
<div id="layered_container">
<div id="layered_container_left" style="width: 360px; float: left; height: 200px; overflow-y: auto;">
<h3>'.$this->l('Selected filters').' <span id="num_sel_filters">(0)</span></h3>
<div id="layered_container_left" class="col-lg-6">
<h4><strong>'.$this->l('Selected filters').' <span id="num_sel_filters">(0)</span></strong></h4>
<p id="no-filters">'.$this->l('No filters selected yet.').'</p>
<ul id="selected_filters"></ul>
<ul id="selected_filters" style="height: 200px; overflow-y: auto;"></ul>
</div>
<div id="layered-ajax-refresh">
<div id="layered-ajax-refresh" class="col-lg-6">
'.$this->ajaxCallBackOffice().'
</div>
</div>
<div class="clear"></div>
<hr size="1" noshade />';
</div>';
$this->context->controller->addJQueryPlugin('fancybox');
$this->context->controller->addJQueryUI('ui.sortable');
@@ -1985,7 +1984,7 @@ class BlockLayered extends Module
$.ajax(
{
type: \'POST\',
url: \''.__PS_BASE_URI__.'\' + \'modules/blocklayered/blocklayered-ajax-back.php\',
url: \''.__PS_BASE_URI__.'\' + \'modules/blocklayered/blocklayered-ajax-back.php?admin_dir='.base64_encode(_PS_ADMIN_DIR_).'\',
data: \'layered_token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&id_lang='.$id_lang.'&\'
+(all ? \'\' : $(\'input[name="categoryBox[]"]\').serialize()+\'&\')
+(id_layered_filter ? \'id_layered_filter=\'+parseInt(id_layered_filter) : \'\')
@@ -2110,21 +2109,16 @@ class BlockLayered extends Module
});
</script>
</div>
<div id="layered-step-3">
<div id="error-filter-name" class="error">
<img src="../img/admin/error.png" alt="" title="" />'.$this->l('Errors:').'
<ul>
<li>'.$this->l('Filter template name required (cannot be empty)').'</li>
</ul>
</div>
<h2>'.$this->l('Step 3/3 - Name your template').'</h2>
<div class="clearfix">&nbsp;</div>
<div id="layered-step-3" class="row">
<div id="error-filter-name" class="alert alert-danger">'.$this->l('Filter template name required (cannot be empty)').'</div>
<h4>'.$this->l('Step 3/3 - Name your template').'</h4>
<hr />
<p>'.$this->l('Template name:').' <input type="text" id="layered_tpl_name" onkeyup="if ($(this).val() != \'\')
{ $(\'#error-filter-name\').hide(); } else { $(\'#error-filter-name\').show(); }" name="layered_tpl_name" maxlength="64" value="'.sprintf($this->l('My template %s'), date('Y-m-d')).'"
style="width: 200px; font-size: 11px;" /> <span style="font-size: 10px; font-style: italic;">('.$this->l('only as a reminder').')</span></p>
<hr size="1" noshade />
<p class="alert">'.$this->l('No filters selected, the blocklayered will be disable for the categories seleted.').'</p>
<br />
<center><input type="submit" class="button" name="SubmitFilter" value="'.$this->l('Save this filter template').'" /></center>
<div class="alert alert-warning">'.$this->l('No filters selected, the blocklayered will be disable for the categories seleted.').'</div>
<button type="submit" class="btn btn-default" name="SubmitFilter"><i class="icon-save"></i> '.$this->l('Save this filter template').'</button>
</div>
<input type="hidden" name="id_layered_filter" id="id_layered_filter" value="0" />
<input type="hidden" name="n_existing" id="n_existing" value="'.(int)count($filters_templates).'" />
@@ -2132,92 +2126,178 @@ class BlockLayered extends Module
</div>
<div class="panel">
<h3><i class="icon-cogs"></i> '.$this->l('Configuration').'</h3>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
<table border="0" style="font-size: 11px; width: 100%; margin: 0 auto;" class="table">
<tr>
<th style="text-align: center;">'.$this->l('Option').'</th>
<th style="text-align: center; width: 200px;">'.$this->l('Value').'</th>
</tr>
<tr>
<td style="text-align: right;">'.$this->l('Hide filter values with no product is matching').'</td>
<td style="text-align: center;">
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_hide_0_values" value="1" '.(Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_hide_0_values" value="0" '.(!Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr>
<td style="text-align: right;">'.$this->l('Show the number of matching products').'</td>
<td style="text-align: center;">
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_show_qties" value="1" '.(Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_show_qties" value="0" '.(!Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr>
<td style="text-align: right;">'.$this->l('Show products from subcategories').'</td>
<td style="text-align: center;">
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_full_tree" value="1" '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_full_tree" value="0" '.(!Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Category filter depth (0 for no limits, 1 by default)').'</td>
<td>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Hide filter values with no product is matching').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_hide_0_values" id="ps_layered_hide_0_values_on" value="1"'.(Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? ' checked="checked"' : '').'>
<label for="ps_layered_hide_0_values_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_hide_0_values" id="ps_layered_hide_0_values_off" value="0"'.(!Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? ' checked="checked"' : '').'>
<label for="ps_layered_hide_0_values_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Show the number of matching products').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_show_qties" id="ps_layered_show_qties_on" value="1"'.(Configuration::get('PS_LAYERED_SHOW_QTIES') ? ' checked="checked"' : '').'>
<label for="ps_layered_show_qties_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_show_qties" id="ps_layered_show_qties_off" value="0"'.(!Configuration::get('PS_LAYERED_SHOW_QTIES') ? ' checked="checked"' : '').'>
<label for="ps_layered_show_qties_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Show products from subcategories').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_full_tree" id="ps_layered_full_tree_on" value="1"'.(Configuration::get('PS_LAYERED_FULL_TREE') ? ' checked="checked"' : '').'>
<label for="ps_layered_hide_0_values_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_full_tree" id="ps_layered_full_tree_off" value="0"'.(!Configuration::get('PS_LAYERED_FULL_TREE') ? ' checked="checked"' : '').'>
<label for="ps_layered_full_tree_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Category filter depth (0 for no limits, 1 by default)').'</label>
<div class="col-lg-9">
<input type="text" name="ps_layered_filter_category_depth" value="'.((Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') !== false) ? Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') : 1).'" />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Use tax to filter price').'</td>
<td>
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_filter_price_usetax" value="1" '.(Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_filter_price_usetax" value="0" '.(!Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use condition filter').'</td>
<td>
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_filter_index_condition" value="1" '.(Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_filter_index_condition" value="0" '.(!Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use availability filter').'</td>
<td>
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_filter_index_availability" value="1" '.(Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_filter_index_availability" value="0" '.(!Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use manufacturer filter').'</td>
<td>
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_filter_index_manufacturer" value="1" '.(Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_filter_index_manufacturer" value="0" '.(!Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? 'checked="checked"' : '').' />
</td>
</tr>
<tr style="text-align: center;">
<td style="text-align: right;">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use category filter').'</td>
<td>
<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />
'.$this->l('Yes').' <input type="radio" name="ps_layered_filter_index_category" value="1" '.(Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? 'checked="checked"' : '').' />
<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" />
'.$this->l('No').' <input type="radio" name="ps_layered_filter_index_category" value="0" '.(!Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? 'checked="checked"' : '').' />
</td>
</tr>
</table>
<p style="text-align: center;"><input type="submit" class="button" name="submitLayeredSettings" value="'.$this->l('Save configuration').'" /></p>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Use tax to filter price').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_filter_price_usetax" id="ps_layered_filter_price_usetax_on" value="1"'.(Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_price_usetax_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_filter_price_usetax" id="ps_layered_filter_price_usetax_off" value="0"'.(!Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? ' checked="checked"' : '').'>
<label for="pps_layered_filter_price_usetax_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use condition filter').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_filter_index_condition" id="ps_layered_filter_index_condition_on" value="1"'.(Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_condition_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_filter_index_condition" id="ps_layered_filter_index_condition_off" value="0"'.(!Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_condition_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use availability filter').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_filter_index_availability" id="ps_layered_filter_index_availability_on" value="1"'.(Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_availability_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_filter_index_availability" id="ps_layered_filter_index_availability_off" value="0"'.(!Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_availability_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use manufacturer filter').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_filter_index_manufacturer" id="ps_layered_filter_index_manufacturer_on" value="1"'.(Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_manufacturer_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_filter_index_manufacturer" id="ps_layered_filter_index_manufacturer_off" value="0"'.(!Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_manufacturer_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">'.$this->l('Allow indexing robots (google, yahoo, bing, ...) to use category filter').'</label>
<div class="col-lg-9">
<div class="row">
<div class="input-group col-lg-2">
<span class="switch prestashop-switch">
<input type="radio" name="ps_layered_filter_index_category" id="ps_layered_filter_index_category_on" value="1"'.(Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_category_on" class="radioCheck">
<i class="icon-check-sign color_success"></i> '.$this->l('Yes').'
</label>
<input type="radio" name="ps_layered_filter_index_category" id="ps_layered_filter_index_category_off" value="0"'.(!Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? ' checked="checked"' : '').'>
<label for="ps_layered_filter_index_category_off" class="radioCheck">
<i class="icon-ban-circle color_danger"></i> '.$this->l('No').'
</label>
<span class="slide-button btn btn-default"></span>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" class="btn btn-default" name="submitLayeredSettings"><i class="icon-save"></i> '.$this->l('Save configuration').'</button>
</div>
</div>
</form>
</div>';
@@ -3497,12 +3577,11 @@ class BlockLayered extends Module
$n_elements = 20;
$html = '
<div id="layered_container_right" style="width: 360px; float: left; margin-left: 20px; height: '.(int)(30 + $n_elements * 38).'px; overflow-y: auto;">
<h3>'.$this->l('Available filters').' <span id="num_avail_filters">(0)</span></h3>
<div id="layered_container_right" style="height: 200px; overflow-y: auto;">
<h4><strong>'.$this->l('Available filters').' <span id="num_avail_filters">(0)</span></strong></h4>
<ul id="all_filters"></ul>
<ul>
<li class="ui-state-default layered_right">
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
<input type="checkbox" id="layered_selection_subcategories" name="layered_selection_subcategories" />
<span class="position"></span>'.$this->l('Sub-categories filter').'
@@ -3791,9 +3870,9 @@ class BlockLayered extends Module
$helper->table = 'layered_filter';
$helper->identifier = 'id_layered_filter';
$helper->base_folder = Tools::getValue('base_folder').'/themes/default/template/helpers/form/';
$html .= '
<div id="shop_association_ajax">'.$helper->renderAssoShop().'</div>
<div id="shop_association_ajax">'.$helper->renderAssoShop(false, Tools::getValue('base_folder').'/themes/default/template/helpers/tree/').'</div>
<script type="text/javascript">
$(document).ready(function() {
$(\'#shop_association\').html($(\'#shop_association_ajax\').html());
@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_9($object)
{
return $object->registerHook('displayBackOfficeHeader');
}
@@ -0,0 +1,21 @@
#error-filter-name { display: none; }
#layered_container_left ul, #layered_container_right ul { list-style-type: none; padding-left: 0px; }
.ui-effects-transfer { border: 1px solid #CCC; }
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
ul#selected_filters, #layered_container_right ul { list-style-type: none; margin: 0; padding: 0; }
ul#selected_filters li, #layered_container_right ul li { width: 326px; font-size: 11px; padding: 8px 9px 7px 20px; height: 14px; margin-bottom: 5px; }
ul#selected_filters li span.ui-icon { position: absolute; margin-top: -2px; margin-left: -18px; }
#layered_container_right ul li span { display: none; }
#layered_container_right ul li { padding-left: 8px; position: relative; }
#layered_container_left ul li { cursor: move; position: relative; }
#layered-cat-counter { display: none; }
#layered-step-2, #layered-step-3 { display: none; }
#layered-step-2 h3 { margin-top: 0; }
#table-filter-templates tr th, #table-filter-templates tr td { text-align: center; }
.filter_type { width: 70px; position: absolute; right: 53px; top: 5px;}
.filter_show_limit { position: absolute; width: 40px; right: 5px; top: 5px; }
#layered-step-3 .alert { width: auto; }
#fancybox-content {
height: 400px !important;
overflow: auto !important;
}
@@ -0,0 +1,21 @@
#error-filter-name { display: none; }
#layered_container_left ul, #layered_container_right ul { list-style-type: none; padding-left: 0px; }
.ui-effects-transfer { border: 1px solid #CCC; }
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
ul#selected_filters, #layered_container_right ul { list-style-type: none; margin: 0; padding: 0; }
ul#selected_filters li, #layered_container_right ul li { font-size: 11px; padding: 8px 9px 7px 20px; height: 38px; margin-bottom: 5px; }
ul#selected_filters li span.ui-icon { position: absolute; margin-top: -2px; margin-left: -18px; }
#layered_container_right ul li span { display: none; }
#layered_container_right ul li { padding-left: 8px; position: relative; }
#layered_container_left ul li { cursor: move; position: relative; }
#layered-cat-counter { display: none; }
#layered-step-2, #layered-step-3 { display: none; }
#layered-step-2 h3 { margin-top: 0; }
#table-filter-templates tr th, #table-filter-templates tr td { text-align: center; }
.filter_type { width: 120px; position: absolute; right: 130px; top: 5px;}
.filter_show_limit { position: absolute; width: 120px; right: 5px; top: 5px; }
#layered-step-3 .alert { width: auto; }
#fancybox-content {
height: 400px !important;
overflow: auto !important;
}
+13
View File
@@ -487,8 +487,21 @@ class Blocktopmenu extends Module
foreach ($children as $child)
$this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
if ($category->level_depth == 2)
{
$files = scandir(_PS_CAT_IMG_DIR_);
$this->_menu .= '<li id="category-thumbnail">';
foreach ($files as $file)
if (preg_match('/'.$category->id.'-([0-9])?_thumb.jpg/i', $file) === 1)
$this->_menu .= '<div>'.ImageManager::thumbnail(_PS_CAT_IMG_DIR_.$file, 'category_'.$file, 100, 'jpg', true, true).'</div>';
$this->_menu .= '</li>';
}
$this->_menu .= '</ul>';
}
$this->_menu .= '</li>';
}
}
+26 -12
View File
@@ -38,7 +38,7 @@ class BlockWishList extends Module
{
$this->name = 'blockwishlist';
$this->tab = 'front_office_features';
$this->version = 0.2;
$this->version = 0.3;
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -62,13 +62,15 @@ class BlockWishList extends Module
if($query)
if(!Db::getInstance()->execute(trim($query)))
return false;
if (!parent::install() OR
!$this->registerHook('rightColumn') OR
!$this->registerHook('productActions') OR
!$this->registerHook('cart') OR
!$this->registerHook('customerAccount') OR
!$this->registerHook('header') OR
!$this->registerHook('adminCustomers')
if (!parent::install() ||
!$this->registerHook('rightColumn') ||
!$this->registerHook('productActions') ||
!$this->registerHook('cart') ||
!$this->registerHook('customerAccount') ||
!$this->registerHook('header') ||
!$this->registerHook('adminCustomers') ||
!$this->registerHook('displayProductListFunctionalButtons') ||
!$this->registerHook('top')
)
return false;
/* This hook is optional */
@@ -79,10 +81,10 @@ class BlockWishList extends Module
public function uninstall()
{
return (
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist') AND
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_email') AND
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product') AND
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product_cart') AND
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist') &&
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_email') &&
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product') &&
Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'wishlist_product_cart') &&
parent::uninstall()
);
}
@@ -107,6 +109,18 @@ class BlockWishList extends Module
return $this->_html;
}
public function hookDisplayProductListFunctionalButtons($params)
{
//TODO : Add cache
$this->smarty->assign('product', $params['product']);
return $this->display(__FILE__, 'blockwishlist_button.tpl');
}
public function hookTop($params)
{
return $this->display(__FILE__, 'blockwishlist_top.tpl');
}
public function hookHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
@@ -0,0 +1,28 @@
{*
* 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 class="wishlist">
<a href="#" id="wishlist_button" onclick="WishlistCart('wishlist_block_list', 'add', '{$product.id_product|intval}', false, 1); return false;" class="addToWishlist"><i class="icon-heart-empty"></i> Add to Wishlist</a>
</div>
@@ -0,0 +1,28 @@
{*
* 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
*}
<script type="text/javascript">
var isLoggedWishlist = {if $logged}true{else}false{/if};
</script>
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blockwishlist</name>
<displayName><![CDATA[Wishlist block]]></displayName>
<version><![CDATA[0.2]]></version>
<version><![CDATA[0.3]]></version>
<description><![CDATA[Adds a block containing the customer&#039;s wishlists.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_0_3($object)
{
return ($object->registerHook('displayProductListFunctionalButtons') && $object->registerHook('top'));
}
+39
View File
@@ -97,6 +97,45 @@ class Dashactivity extends Module
public function hookDashboardData($params)
{
if (Configuration::get('PS_DASHBOARD_SIMULATION'))
{
$days = round((strtotime($params['date_to']) - strtotime($params['date_from'])) / 3600 / 24);
$online_visitor = round(rand(10, 50));
$visits = round(rand(200, 2000) * $days);
return array(
'data_value' => array(
'pending_orders' => round(rand(0, 5)),
'return_exchanges' => round(rand(0, 5)),
'abandoned_cart' => round(rand(5, 50)),
'products_out_of_stock' => round(rand(1, 10)),
'new_messages' => round(rand(1, 10) * $days),
'order_inquires' => 42,
'product_reviews' => round(rand(5, 50) * $days),
'new_customers' => round(rand(1, 5) * $days),
'online_visitor' => $online_visitor,
'active_shopping_cart' => round($online_visitor / 10),
'new_registrations' => round(rand(1, 5) * $days),
'total_suscribers' => round(rand(200, 2000)),
'visits' => $visits,
'unique_visitors' => round($visits * 0.6),
),
'data_trends' => array(
'orders_trends' => array('way' => 'down', 'value' => 0.42),
),
'data_list_small' => array(
'dash_traffic_source' => array('prestashop.com' => round($visits / 2), 'google.com' => round($visits / 3), 'Direct Traffic' => round($visits / 4))
),
'data_chart' => array(
'dash_trends_chart1' => array('chart_type' => 'pie_chart_trends', 'data' => array(
array('key' => 'prestashop.com', 'y' => round($visits / 2)),
array('key' => 'google.com', 'y' => round($visits / 3)),
array('key' => 'Direct Traffic', 'y' => round($visits / 4))
))
)
);
}
$gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false;
if (Validate::isLoadedObject($gapi) && $gapi->isConfigured())
{
@@ -29,10 +29,10 @@
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th>{$goals_year}</th>
<th>{l s='Traffic' mod='dashgoals'}</th>
<th>{l s='Conversion Rate' mod='dashgoals'}</th>
<th>{l s='Average Cart Value' mod='dashgoals'}</th>
<th class="fixed-width-md">{$goals_year}</th>
<th class="fixed-width-md">{l s='Traffic' mod='dashgoals'}</th>
<th class="fixed-width-md">{l s='Conversion Rate' mod='dashgoals'}</th>
<th class="fixed-width-lg">{l s='Average Cart Value' mod='dashgoals'}</th>
<th>{l s='Sales' mod='dashgoals'}</th>
</tr>
</thead>
+28 -6
View File
@@ -75,11 +75,30 @@ class Dashtrends extends Module
'total_expenses' => array()
);
$tmp_data['visits'] = AdminStatsControllerCore::getVisits(false, $date_from, $date_to, 'day');
$tmp_data['orders'] = AdminStatsControllerCore::getOrders($date_from, $date_to, 'day');
$tmp_data['total_paid_tax_excl'] = AdminStatsControllerCore::getTotalSales($date_from, $date_to, 'day');
$tmp_data['total_purchases'] = AdminStatsControllerCore::getPurchases($date_from, $date_to, 'day');
$tmp_data['total_expenses'] = AdminStatsControllerCore::getExpenses($date_from, $date_to, 'day');
if (Configuration::get('PS_DASHBOARD_SIMULATION'))
{
$from = strtotime($date_from.' 00:00:00');
$to = min(time(), strtotime($date_to.' 23:59:59'));
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
{
$tmp_data['visits'][$date] = round(rand(2000, 20000));
$tmp_data['conversion_rate'][$date] = rand(80, 250) / 100;
$tmp_data['average_cart_value'][$date] = round(rand(60, 200), 2);
$tmp_data['orders'][$date] = round($tmp_data['visits'][$date] * $tmp_data['conversion_rate'][$date] / 100);
$tmp_data['total_paid_tax_excl'][$date] = $tmp_data['orders'][$date] * $tmp_data['average_cart_value'][$date];
$tmp_data['total_purchases'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(50, 70) / 100;
$tmp_data['total_expenses'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 10) / 100;
}
}
else
{
$tmp_data['visits'] = AdminStatsControllerCore::getVisits(false, $date_from, $date_to, 'day');
$tmp_data['orders'] = AdminStatsControllerCore::getOrders($date_from, $date_to, 'day');
$tmp_data['total_paid_tax_excl'] = AdminStatsControllerCore::getTotalSales($date_from, $date_to, 'day');
$tmp_data['total_purchases'] = AdminStatsControllerCore::getPurchases($date_from, $date_to, 'day');
$tmp_data['total_expenses'] = AdminStatsControllerCore::getExpenses($date_from, $date_to, 'day');
}
return $tmp_data;
}
@@ -93,7 +112,10 @@ class Dashtrends extends Module
'conversion_rate' => array(),
'net_profits' => array()
);
$from = max(strtotime(_PS_CREATION_DATE_.' 00:00:00'), strtotime($date_from.' 00:00:00'));
$from = strtotime($date_from.' 00:00:00');
if (!Configuration::get('PS_DASHBOARD_SIMULATION'))
$from = max(strtotime(_PS_CREATION_DATE_.' 00:00:00'), $from);
$to = min(time(), strtotime($date_to.' 23:59:59'));
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
{
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>productcomments</name>
<displayName><![CDATA[Product Comments]]></displayName>
<version><![CDATA[2.3]]></version>
<version><![CDATA[2.4]]></version>
<description><![CDATA[Allows users to post reviews.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+24 -2
View File
@@ -41,7 +41,7 @@ class ProductComments extends Module
{
$this->name = 'productcomments';
$this->tab = 'front_office_features';
$this->version = '2.3';
$this->version = '2.4';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name);
@@ -70,6 +70,8 @@ class ProductComments extends Module
!$this->registerHook('productTabContent') ||
!$this->registerHook('header') ||
!$this->registerHook('productOutOfStock') ||
!$this->registerHook('displayProductListReviews') ||
!$this->registerHook('top') ||
!Configuration::updateValue('PRODUCT_COMMENTS_MINIMAL_TIME', 30) ||
!Configuration::updateValue('PRODUCT_COMMENTS_ALLOW_GUESTS', 0) ||
!Configuration::updateValue('PRODUCT_COMMENTS_MODERATE', 1))
@@ -87,7 +89,9 @@ class ProductComments extends Module
!$this->unregisterHook('productOutOfStock') ||
!$this->unregisterHook('productTabContent') ||
!$this->unregisterHook('header') ||
!$this->unregisterHook('productTab'))
!$this->unregisterHook('productTab') ||
!$this->unregisterHook('top') ||
!$this->unregisterHook('displayProductListReviews'))
return false;
return true;
}
@@ -691,6 +695,24 @@ class ProductComments extends Module
return ($this->display(__FILE__, '/tab.tpl'));
}
public function hookTop($params)
{
$this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js');
return $this->display(__FILE__, 'productcomments_top.tpl');
}
public function hookDisplayProductListReviews($params)
{
require_once(dirname(__FILE__).'/ProductComment.php');
$average = ProductComment::getAverageGrade((int)$params['product']['id_product']);
$this->smarty->assign(array(
'product' => $params['product'],
'averageTotal' => round($average['grade']),
));
return $this->display(__FILE__, 'productcomments_reviews.tpl');
}
public function hookproductOutOfStock($params)
{
require_once(dirname(__FILE__).'/ProductComment.php');
@@ -0,0 +1,37 @@
{*
* 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
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="comments_note">
<div class="star_content clearfix">
{section name="i" start=0 loop=5 step=1}
{if $averageTotal le $smarty.section.i.index}
<div class="star"></div>
{else}
<div class="star star_on"></div>
{/if}
{/section}
</div>
<span>{l s='%s Review(s)'|sprintf:$averageTotal mod='productcomments'}&nbsp</span>
</div>
@@ -0,0 +1,6 @@
<script type="text/javascript">
$( document ).ready(function() {
$('input[@type=radio].star').rating();
$('.auto-submit-star').rating();
});
</script>
+35
View File
@@ -0,0 +1,35 @@
<?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,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_2_4($object)
{
return ($object->registerHook('displayProductListReviews') && $object->registerHook('top'));
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>productpaymentlogos</name>
<displayName><![CDATA[Product payment logos block]]></displayName>
<version><![CDATA[1]]></version>
<description><![CDATA[Displays payment system logos at the product page.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[other]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+35
View File
@@ -0,0 +1,35 @@
<?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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -0,0 +1,184 @@
<?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
*/
if (!defined('_PS_VERSION_'))
exit;
class ProductPaymentLogos extends Module
{
public function __construct()
{
$this->name = 'productpaymentlogos';
$this->tab = 'other';
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Product payment logos block');
$this->description = $this->l('Displays payment system logos at the product page.');
}
public function install()
{
Configuration::updateValue('PRODUCTPAYMENTLOGOS_IMG', 'payment-logo.png');
Configuration::updateValue('PRODUCTPAYMENTLOGOS_LINK', '');
Configuration::updateValue('PRODUCTPAYMENTLOGOS_TITLE', '');
return parent::install() && $this->registerHook('displayProductButtons') && $this->registerHook('header');
}
public function uninstall()
{
Configuration::deleteByName('PRODUCTPAYMENTLOGOS_IMG');
Configuration::deleteByName('PRODUCTPAYMENTLOGOS_LINK');
Configuration::deleteByName('PRODUCTPAYMENTLOGOS_TITLE');
return parent::uninstall();
}
public function hookDisplayProductButtons($params)
{
if (!$this->isCached('productpaymentlogos.tpl', $this->getCacheId()))
{
$this->smarty->assign('banner_img', Configuration::get('PRODUCTPAYMENTLOGOS_IMG'));
$this->smarty->assign('banner_link', Configuration::get('PRODUCTPAYMENTLOGOS_LINK'));
$this->smarty->assign('banner_title', Configuration::get('PRODUCTPAYMENTLOGOS_TITLE'));
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'store s'
.Shop::addSqlAssociation('store', 's');
$total = Db::getInstance()->getValue($sql);
if ($total <= 0)
return;
}
return $this->display(__FILE__, 'productpaymentlogos.tpl', $this->getCacheId());
}
public function hookHeader($params)
{
$this->context->controller->addCSS($this->_path.'productpaymentlogos.css', 'all');
}
public function postProcess()
{
if (Tools::isSubmit('submitStoreConf'))
{
if (isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']) && isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name']) && !empty($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name']))
{
if ($error = ImageManager::validateUpload($_FILES['PRODUCTPAYMENTLOGOS_IMG'], 4000000))
return $this->displayError($this->l('Invalid image'));
else
{
$ext = substr($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], strrpos($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], '.') + 1);
$file_name = md5($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name']).'.'.$ext;
if (!move_uploaded_file($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name'], dirname(__FILE__).'/'.$file_name))
return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
else
{
if (Configuration::hasContext('PRODUCTPAYMENTLOGOS_IMG', null, Shop::getContext()) && Configuration::get('PRODUCTPAYMENTLOGOS_IMG') != $file_name)
@unlink(dirname(__FILE__).'/'.Configuration::get('PRODUCTPAYMENTLOGOS_IMG'));
Configuration::updateValue('PRODUCTPAYMENTLOGOS_IMG', $file_name);
$this->_clearCache('productpaymentlogos.tpl');
return $this->displayConfirmation($this->l('The settings have been updated.'));
}
}
}
Configuration::updateValue('PRODUCTPAYMENTLOGOS_LINK', Tools::getValue('PRODUCTPAYMENTLOGOS_LINK'));
Configuration::updateValue('PRODUCTPAYMENTLOGOS_TITLE', Tools::getValue('PRODUCTPAYMENTLOGOS_TITLE'));
}
return '';
}
public function getContent()
{
return $this->postProcess().$this->renderForm();
return $output;
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Logos heading'),
'name' => 'PRODUCTPAYMENTLOGOS_TITLE',
'desc' => $this->l('Please input logos heading')
),
array(
'type' => 'file',
'label' => $this->l('Block image'),
'name' => 'PRODUCTPAYMENTLOGOS_IMG',
'desc' => $this->l('Please upload banner image'),
'thumb' => '../modules/'.$this->name.'/'.Configuration::get('PRODUCTPAYMENTLOGOS_IMG'),
),
array(
'type' => 'text',
'label' => $this->l('Image Link'),
'name' => 'PRODUCTPAYMENTLOGOS_LINK',
'desc' => $this->l('Please input banner link')
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default')
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitStoreConf';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues()
{
return array(
'PRODUCTPAYMENTLOGOS_IMG' => Tools::getValue('PRODUCTPAYMENTLOGOS_IMG', Configuration::get('PRODUCTPAYMENTLOGOS_IMG')),
'PRODUCTPAYMENTLOGOS_LINK' => Tools::getValue('PRODUCTPAYMENTLOGOS_LINK', Configuration::get('PRODUCTPAYMENTLOGOS_LINK')),
'PRODUCTPAYMENTLOGOS_TITLE' => Tools::getValue('PRODUCTPAYMENTLOGOS_TITLE', Configuration::get('PRODUCTPAYMENTLOGOS_TITLE')),
);
}
}
@@ -0,0 +1,38 @@
{*
* 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
*}
<!-- Block stores module -->
{if !$content_only}
</div>
<div id="product_payment_logos">
<div class="box-security">
<h5 class="product-heading-h5">{$banner_title}</h5>
<a href="{$banner_link}" title="{$banner_title}"><img src="{$module_dir}{$banner_img}" alt="{$banner_title}"/></a>
</div>
{/if}
<!-- /Block stores module -->
@@ -0,0 +1,35 @@
<?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;

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

+414 -19
View File
@@ -26,20 +26,281 @@
if (!defined('_PS_VERSION_'))
exit;
class ThemeConfigurator extends Module
{
protected $max_image_size = 1048576;
protected $default_language;
protected $languages;
public function __construct()
{
$this->name = 'themeconfigurator';
$this->tab = 'front_office_features';
$this->version = '0.1';
$this->bootstrap = true;
$this->secure_key = Tools::encrypt($this->name);
$this->default_language = Language::getLanguage(Configuration::get('PS_LANG_DEFAULT'));
$this->languages = Language::getLanguages();
parent::__construct();
$this->displayName = $this->l('Theme configurator');
$this->description = $this->l('Configure elements of your theme');
$this->module_path = _PS_MODULE_DIR_.$this->name.'/';
$this->uploads_path = _PS_MODULE_DIR_.$this->name.'/images/';
$this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/';
$this->hooks_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/hooks/';
}
public function install()
{
if (!parent::install() ||
!$this->installDB() ||
!$this->registerHook('displayHeader') ||
!$this->registerHook('displayTop') ||
!$this->registerHook('displayLeftColumn') ||
!$this->registerHook('displayRightColumn') ||
!$this->registerHook('displayHome') ||
!$this->registerHook('displayFooter') ||
!$this->registerHook('displayBackOfficeHeader'))
return false;
return true;
}
private function installDB()
{
return (
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'themeconfigurator`') &&
Db::getInstance()->Execute('
CREATE TABLE `'._DB_PREFIX_.'themeconfigurator` (
`id_item` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_shop` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`item_order` int(10) unsigned NOT NULL,
`title` VARCHAR(100),
`title_use` tinyint(1) unsigned NOT NULL DEFAULT \'0\',
`hook` VARCHAR(100),
`url` VARCHAR(100),
`target` tinyint(1) unsigned NOT NULL DEFAULT \'0\',
`image` VARCHAR(100),
`image_w` VARCHAR(10),
`image_h` VARCHAR(10),
`html` TEXT,
`active` tinyint(1) unsigned NOT NULL DEFAULT \'1\',
PRIMARY KEY (`id_item`)
) ENGINE = '._MYSQL_ENGINE_.' DEFAULT CHARSET=UTF8;')
);
return true;
}
public function uninstall()
{
$images = Db::getInstance()->executeS('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator`');
foreach ($images as $image)
$this->deleteImage($image['image']);
if (!Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'themeconfigurator`') ||
!parent::uninstall())
return false;
return true;
}
public function hookDisplayBackOfficeHeader()
{
if (Tools::getValue('configure') != $this->name)
return;
$this->context->controller->addCSS($this->_path.'views/css/admin.css');
$this->context->controller->addJquery();
$this->context->controller->addJS($this->_path.'views/js/admin.js');
}
public function hookdisplayHeader($params)
{
$this->context->controller->addCss($this->_path.'views/css/hooks.css', 'all');
}
public function hookDisplayTop()
{
$this->context->smarty->assign(array(
'htmlitems'=> $this->getItemsFromHook('top'),
'hook' => 'top'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
}
public function hookDisplayHome()
{
$this->context->smarty->assign(array(
'htmlitems'=> $this->getItemsFromHook('home'),
'hook' => 'home'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
}
public function hookDisplayLeftColumn()
{
$this->context->smarty->assign(array(
'htmlitems'=> $this->getItemsFromHook('left'),
'hook' => 'left'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
}
public function hookDisplayRightColumn()
{
$this->context->smarty->assign(array(
'htmlitems'=> $this->getItemsFromHook('right'),
'hook' => 'right'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
}
public function hookDisplayFooter()
{
$this->context->smarty->assign(array(
'htmlitems'=> $this->getItemsFromHook('footer'),
'hook' => 'footer'
));
return $this->display(__FILE__, 'views/templates/hooks/hook.tpl');
}
protected function getItemsFromHook($hook)
{
if (!$hook)
return false;
return Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'themeconfigurator`
WHERE id_shop = '.(int)$this->context->shop->id.' AND id_lang = '.(int)$this->context->language->id.' AND hook = \''.pSQL($hook).'\' AND active = 1
ORDER BY item_order ASC'
);
}
protected function deleteImage($image)
{
$file_name = $this->uploads_path.$image;
if (realpath(dirname($file_name)) != $this->uploads_path)
die;
if ($image != '' && is_file($file_name))
unlink($file_name);
}
protected function removeItem()
{
$id_item = (int)Tools::getValue('item_id');
if ($image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)$id_item))
$this->deleteImage($image);
Db::getInstance()->delete(_DB_PREFIX_.'themeconfigurator', 'id_item = '.(int)$id_item);
if (Db::getInstance()->Affected_Rows() == 1)
{
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'themeconfigurator`
SET item_order = item_order-1
WHERE (
item_order > '.(int)Tools::getValue('item_order').' AND
id_shop = '.(int)$this->context->shop->id.' AND
hook = \''.pSQL(Tools::getValue('item_hook')).'\')
');
$this->context->smarty->assign('confirmation', $this->l('Successful deletion.'));
}
else
$this->context->smarty->assign('error', $this->l('Can\'t delete the slide.'));
}
protected function updateItem()
{
$id_item = (int)Tools::getValue('item_id');
$title = Tools::getValue('item_title');
$content = Tools::getValue('item_html');
if (!Validate::isCleanHtml($title, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')) || !Validate::isCleanHtml($content,(int)Configuration::get('PS_ALLOW_HTML_IFRAME')))
{
$this->context->smarty->assign('error', $this->l('Invalid content'));
return false;
}
$new_image = '';
$image_w = (is_numeric(Tools::getValue('item_img_w'))) ? (int)Tools::getValue('item_img_w') : '';
$image_h = (is_numeric(Tools::getValue('item_img_h'))) ? (int)Tools::getValue('item_img_h') : '';
if(!empty($_FILES['item_img']['name']))
{
if ($old_image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)$id_item))
$this->_deleteImages($old_image);
if (!$image = $this->uploadImage($_FILES['item_img'], $image_w, $image_h))
return false;
$new_image = 'image = \''.pSQL($image).'\',';
}
else
{
$image_w = '';
$image_h = '';
}
if (!Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'themeconfigurator` SET
title = \''.pSQL($title).'\',
title_use = '.(int)Tools::getValue('item_title_use').',
hook = \''.pSQL(Tools::getValue('item_hook')).'\',
url = \''.pSQL(Tools::getValue('item_url')).'\',
target = '.(int)Tools::getValue('item_target').',
'.$new_image.'
image_w = '.(int)$image_w.',
image_h = '.(int)$image_h.',
active = '.(int)Tools::getValue('item_active').',
html = \''.pSQL($content).'\'
WHERE id_item = '.(int)Tools::getValue('item_id')
))
{
if ($image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)Tools::getValue('item_id')))
$this->deleteImage($image);
$this->context->smarty->assign('error', $this->l('An error occured while saving data.'));
return false;
}
$this->context->smarty->assign('confirmation', $this->l('Successfully updated.'));
return true;
}
protected function uploadImage($image, $image_w = '', $image_h = '')
{
$res = false;
if (is_array($image) && (ImageManager::validateUpload($image, $this->max_image_size) === false) && ($tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS')) && move_uploaded_file($image['tmp_name'], $tmp_name))
{
$type = Tools::strtolower(Tools::substr(strrchr($image['name'], '.'), 1));
$img_name = Tools::encrypt($image['name'].sha1(microtime())).'.'.$type;
Configuration::set('PS_IMAGE_QUALITY','png_all');
if (ImageManager::resize($tmp_name, dirname(__FILE__).'/images/'.$img_name, $image_w, $image_h))
$res = true;
}
if (isset($temp_name))
@unlink($tmp_name);
if (!$res)
{
$this->context->smarty->assign('error', $this->l('An error occurred during the image upload.'));
return false;
}
return $img_name;
}
public function getContent()
{
if (Tools::isSubmit('submitModule'))
@@ -70,19 +331,107 @@ class ThemeConfigurator extends Module
$module_instance->install();
}
}
return $this->renderForm();
if (Tools::isSubmit('newItem'))
$this->addItem();
elseif (Tools::isSubmit('updateItem'))
$this->updateItem();
elseif (Tools::isSubmit('removeItem'))
$this->removeItem();
$html = $this->renderConfigurationForm();
$html .= $this->renderThemeConfiguratorForm();
return $html;
}
public function renderForm()
protected function addItem()
{
$title = Tools::getValue('item_title');
$content = Tools::getValue('item_html');
if (!Validate::isCleanHtml($title, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')) || !Validate::isCleanHtml($content, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')))
{
$this->context->smarty->assign('error', $this->l('Invalid content'));
return false;
}
if (!$current_order = (int)Db::getInstance()->getValue('
SELECT item_order + 1
FROM `'._DB_PREFIX_.'themeconfigurator`
WHERE
id_shop = '.(int)$this->context->shop->id.'
AND id_lang = '.(int)Tools::getValue('id_lang').'
AND hook = \''.pSQL(Tools::getValue('item_hook')).'\'
ORDER BY item_order DESC'
))
$current_order = 1;
$image_w = is_numeric(Tools::getValue('item_img_w')) ? (int)Tools::getValue('item_img_w') : '';
$image_h = is_numeric(Tools::getValue('item_img_h')) ? (int)Tools::getValue('item_img_h') : '';
if(!empty($_FILES['item_img']['name']))
{
if (!$image = $this->uploadImage($_FILES['item_img'], $image_w, $image_h))
return false;
}
else
{
$image = '';
$image_w = '';
$image_h = '';
}
if (!Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'themeconfigurator` (
`id_shop`, `id_lang`, `item_order`, `title`, `title_use`, `hook`, `url`, `target`, `image`, `image_w`, `image_h`, `html`, `active`
) VALUES (
\''.(int)$this->context->shop->id.'\',
\''.(int)Tools::getValue('id_lang').'\',
\''.(int)$current_order.'\',
\''.pSQL($title).'\',
\''.(int)Tools::getValue('item_title_use').'\',
\''.pSQL(Tools::getValue('item_hook')).'\',
\''.pSQL(Tools::getValue('item_url')).'\',
\''.(int)Tools::getValue('item_target').'\',
\''.pSQL($image).'\',
\''.pSQL($image_w).'\',
\''.pSQL($image_h).'\',
\''.pSQL($content).'\',
1)
'))
{
if (!Tools::isEmpty($image))
$this->deleteImage($image);
$this->context->smarty->assign('error', $this->l('An error occured while saving data.'));
return false;
}
$this->context->smarty->assign('confirmation', $this->l('New item added successfull.'));
return true;
}
public function renderConfigurationForm()
{
$inputs = array();
foreach ($this->getConfigurableModules() as $module)
{
$desc = '';
if (isset($module['is_module']) && $module['is_module'])
{
$module_instance = Module::getInstanceByName($module['name']);
if (Validate::isLoadedObject($module_instance) && method_exists($module_instance, 'getContent'))
$desc = '<a href="'.$this->context->link->getAdminLink('AdminModules', true).'&configure='.urlencode($module_instance->name).'&tab_module='.$module_instance->tab.'&module_name='.urlencode($module_instance->name).'">'.$this->l('Configure').'</a>';
}
if (!$desc && isset($module['desc']) && $module['desc'])
$desc = $module['desc'];
$inputs[] = array(
'type' => 'switch',
'label' => $module['label'],
'name' => $module['name'],
'desc' => (isset($module['desc']) ? $module['desc'] : ''),
'desc' => $desc,
'values' => array(
array(
'id' => 'active_on',
@@ -96,6 +445,7 @@ class ThemeConfigurator extends Module
)
),
);
}
$fields_form = array(
'form' => array(
@@ -130,6 +480,52 @@ class ThemeConfigurator extends Module
return $helper->generateForm(array($fields_form));
}
protected function renderThemeConfiguratorForm()
{
$id_shop = (int)$this->context->shop->id;
$items = array();
$this->context->smarty->assign('htmlcontent', array(
'admin_tpl_path' => $this->admin_tpl_path,
'hooks_tpl_path' => $this->hooks_tpl_path,
'info' => array(
'module' => $this->name,
'name' => $this->displayName,
'version' => $this->version,
'psVersion' => _PS_VERSION_,
'context' => (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') == 0) ? 1 : ($this->context->shop->getTotalShops() != 1) ? $this->context->shop->getContext() : 1
)
));
foreach ($this->languages as $language) {
$hooks[$language['id_lang']] = array('home', 'top', 'left', 'right', 'footer');
foreach ($hooks[$language['id_lang']] as $hook)
$items[$language['id_lang']][$hook] = Db::getInstance()->ExecuteS('
SELECT * FROM `'._DB_PREFIX_.'themeconfigurator`
WHERE id_shop = '.(int)$id_shop.'
AND id_lang = '.(int)$language['id_lang'].'
AND hook = \''.pSQL($hook).'\'
ORDER BY item_order ASC'
);
}
$this->context->smarty->assign('htmlitems', array(
'items' => $items,
'lang' => array(
'default' => $this->default_language,
'all' => $this->languages,
'lang_dir' => _THEME_LANG_DIR_,
'user' => $this->context->language->id
),
'postAction' => 'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&tab_module=other&module_name='.$this->name.'',
'id_shop' => $id_shop
));
return $this->display(__FILE__, 'views/templates/admin/admin.tpl');
}
protected function getConfigurableModules()
{
@@ -137,56 +533,55 @@ class ThemeConfigurator extends Module
array(
'label' => $this->l('Display the reinsurance block'),
'name' => 'blockreinsurance',
'desc' => '<a href="#">'.$this->l('Configure the reinsurance block').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockreinsurance')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Display the social following links'),
'name' => 'blocksocial',
'desc' => '<a href="#">'.$this->l('Configure the social following links').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blocksocial')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Display contact information'),
'name' => 'blockcontactinfos',
'desc' => '<a href="#">'.$this->l('Configure the contact information of your store').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockcontactinfos')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Display social buttons on the products page'),
'name' => 'addsharethis',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('addsharethis')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Display facebook block on the home page'),
'name' => 'blockfacebook',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockfacebook')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Customer cms information block'),
'name' => 'blockcmsinfo',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockcmsinfo')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Customer banner information block'),
'name' => 'tmhtmlcontent',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('tmhtmlcontent')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Enable Quick view'),
'name' => 'quick_view',
'value' => (int)Tools::getValue('PS_QUICK_VIEW', Configuration::get('PS_QUICK_VIEW'))
),
array(
'label' => $this->l('Enable top banner'),
'name' => 'blockbanner',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockbanner')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Enable product payment logos'),
'name' => 'productpaymentlogos',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('productpaymentlogos')) && $module->active),
'is_module' => true,
)
);
}
@@ -198,5 +593,5 @@ class ThemeConfigurator extends Module
$values[$module['name']] = $module['value'];
return $values;
}
}
}
}
@@ -27,33 +27,13 @@
font-size:16px;
color:#090;
}
.new-item .languages {
float:left;
overflow:hidden;
}
.new-item .languages li {
float:left;
margin-right:5px;
padding:5px;
width:26px;
height:18px;
text-align:center;
}
.new-item .languages li.active {
background:#d1d1d1;
}
.lang-tabs {
position:relative;
z-index:99;
clear:both;
overflow:hidden;
margin-top:20px;
}
.lang-tabs li {
border:1px solid #f3f3f3;
border-bottom:1px solid #e9e9e9;
border-bottom:none;
background:#FAFAFA;
float:left;
padding:15px;
@@ -61,6 +41,7 @@
line-height:24px;
margin-right:5px;
cursor:pointer;
margin-bottom:0;
}
.lang-tabs li img {
vertical-align:baseline;
@@ -83,19 +64,22 @@
}
h3.hook-title {
h4.hook-title {
border:1px solid #d1d1d1;
background:#e5e5e5;
padding:10px 10px;
margin:20px 0 !important;
text-transform:capitalize;
clear:both;
}
#items {
padding-left:0;
}
.item {
margin:0 0 5px;
padding:10px;
border:1px solid #e5e5e5;
background:#F1F1F1;
background:#fff;
line-height:25px;
font-weight:bold;
color:#444;
@@ -125,15 +109,6 @@ h3.hook-title {
padding-left:10px;
font-size:18px;
}
.item .button{
float:right;
margin-left:10px;
cursor:pointer;
font-size:14px;
line-height:18px;
vertical-align: bottom;
}
.item .button i{
margin-right:5px;
font-size:16px;
@@ -175,26 +150,13 @@ h3.hook-title {
line-height:normal;
position:relative;
overflow:hidden;
padding-top:10px;
}
.new-item .item-container {
display:none;
padding:10px;
border:1px solid #ccc;
background:#F1F1F1;
line-height:normal;
position:relative;
overflow:hidden;
clear:both;
}
.item .item-field, .new-item .item-field {
padding:10px 0;
clear:both;
overflow:hidden;
}
.item .image-display, .new-item .image-display {
position:absolute;
top:20px;
right:20px;
text-align:center;
}
.item .image-display img, .new-item .image-display img {
max-width:400px;

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 158 KiB

@@ -1,6 +1,6 @@
jQuery(document).ready(function() {
$('.button.new-item').click(function() {
var item_container = $(this).parent('.new-item');
var item_container = $(this).parent().parent('.new-item');
item_container.toggleClass('active').children('.item-container').slideToggle();
});
$('.button-edit').click(function() {
@@ -1,16 +1,13 @@
<div id="htmlcontent">
<h2>{$htmlcontent.info.name} (v.{$htmlcontent.info.version})</h2>
{if $error}
{if isset($error) && $error}
{include file="{$htmlcontent.admin_tpl_path}messages.tpl" id="main" text=$error class='error'}
{/if}
{if $confirmation}
{if isset($confirmation) && $confirmation}
{include file="{$htmlcontent.admin_tpl_path}messages.tpl" id="main" text=$confirmation class='conf'}
{/if}
<!-- New -->
{include file="{$htmlcontent.admin_tpl_path}new.tpl"}
<!-- Slides -->
{include file="{$htmlcontent.admin_tpl_path}items.tpl"}
</div>
</div>
@@ -0,0 +1,116 @@
<ul class="lang-tabs nav nav-tabs">
{foreach from=$htmlitems.lang.all item=lang}
<li id="lang-{$lang.id_lang}" class="lang-flag{if $lang.id_lang == $htmlitems.lang.default.id_lang} active{/if}"><img src="../img/l/{$lang.id_lang}.jpg" class="pointer" alt="{$lang.name}" title="{$lang.name}" /> {$lang.name}</li>
{/foreach}
</ul>
<div class="lang-items">
{foreach name=langs from=$htmlitems.items key=lang item=langItems}
<div id="items-{$lang}" class="lang-content" style="display:{if $lang == $htmlitems.lang.default.id_lang}block{else}none{/if};">
{foreach name=hooks from=$langItems key=hook item=hookItems}
<h4 class="hook-title">{l s='Hook' mod='themeconfigurator'} "{$hook}"</h4>
{if $hookItems}
<ul id="items">
{foreach name=items from=$hookItems item=hItem}
<li id="item-{$hItem.id_item}" class="item panel">
<span class="item-order">{if $hItem.item_order le 9}0{/if}{$hItem.item_order}</span>
<!--<i class="icon-sort"></i>-->
<span class="item-title">{$hItem.title}</span>
<span class="button btn btn-default button-edit pull-right"><i class="icon-edit"></i>{l s='Edit' mod='themeconfigurator'}</span>
<span class="button btn btn-default button-close pull-right"><i class="icon-remove"></i>{l s='Close' mod='themeconfigurator'}</span>
<div class="item-container">
<form method="post" action="{$htmlitems.postAction}" enctype="multipart/form-data" class="item-form defaultForm form-horizontal">
<input type="hidden" name="id_lang" value="{$lang}" />
<input type="hidden" name="item_id" value="{$hItem.id_item}" />
<input type="hidden" name="item_order" value="{$hItem.item_order}" />
<div class="image-display item-field form-group">
<img src="{$module_dir}images/{$hItem.image}" alt="" title="" style="width:{$hItem.image_w}px; height:{$hItem.image_h}px;{if !$hItem.image} display:none;{/if}" class="preview" />
</div>
<div class="active item-field form-group">
<label class="control-label col-lg-3">{l s='Active' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="checkbox" name="item_active" value="1"{if $hItem.active == 1} checked="checked"{/if} />
</div>
</div>
<div class="title item-field form-group">
<label class="control-label col-lg-3">{l s='Title' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="text" name="item_title" size="48" value="{$hItem.title}" />
</div>
</div>
<div class="title_use item-field form-group">
<label class="control-label col-lg-3">{l s='Use title in front' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="checkbox" name="item_title_use" value="1"{if $hItem.title_use == 1} checked="checked"{/if} />
</div>
</div>
<div class="hook item-field form-group">
<label class="control-label col-lg-3">{l s='Hook' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<select name="item_hook" default="home">
<option value="home"{if $hItem.hook == 'home'} selected="selected"{/if}>home</option>
<option value="top"{if $hItem.hook == 'top'} selected="selected"{/if}>top</option>
<option value="left"{if $hItem.hook == 'left'} selected="selected"{/if}>left</option>
<option value="right"{if $hItem.hook == 'right'} selected="selected"{/if}>right</option>
<option value="footer"{if $hItem.hook == 'footer'} selected="selected"{/if}>footer</option>
</select>
</div>
</div>
<div class="image item-field form-group">
<label class="control-label col-lg-3">{l s='Image' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="file" name="item_img" />
</div>
</div>
<div class="image_w item-field form-group">
<label class="control-label col-lg-3">{l s='Image width' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input name="item_img_w" type="text" maxlength="4" size="4" value="{$hItem.image_w}"/>
</div>
</div>
<div class="image_h item-field form-group">
<label class="control-label col-lg-3">{l s='Image height' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input name="item_img_h" type="text" maxlength="4" size="4" value="{$hItem.image_h}"/>
</div>
</div>
<div class="url item-field form-group">
<label class="control-label col-lg-3">{l s='URL' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="text" name="item_url" size="48" value="{$hItem.url}" />
</div>
</div>
<div class="target item-field form-group">
<label class="control-label col-lg-3">{l s='Target blank' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="checkbox" name="item_target" value="1"{if $hItem.target == 1} checked="checked"{/if} />
</div>
</div>
<div class="html item-field form-group">
<label class="control-label col-lg-3">{l s='HTML' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<textarea name="item_html" cols="65" rows="12">{$hItem.html}</textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" name="removeItem" class="button btn btn-default button-remove" onClick="this.form.submit();"><i class="icon-remove-sign"></i>{l s='Remove' mod='themeconfigurator'}</button>
<button type="submit" name="updateItem" class="button btn btn-default button-save" onClick="this.form.submit();"><i class="icon-save"></i>{l s='Save' mod='themeconfigurator'}</button>
</div>
</div>
</form>
</div>
</li>
{/foreach}
</ul>
{else}
<div class="item">
{l s='No items available' mod='themeconfigurator'}
</div>
{/if}
{/foreach}
</div>
{/foreach}
</div>
@@ -0,0 +1,3 @@
<div id="{$id}-response" {if !isset($text)}style="display:none;"{/if} class="message alert alert-{if isset($class) && $class=='error'}danger{else}success{/if}">
<div>{if isset($text)}{$text}{/if}</div>
</div>
@@ -0,0 +1,91 @@
<div class="new-item">
<div class="form-group clearfix">
<span class="button btn btn-default new-item"><i class="icon-plus-sign"></i>{l s='Add item' mod='themeconfigurator'}</span>
</div>
<div class="item-container">
<form method="post" action="{$htmlitems.postAction}" enctype="multipart/form-data" class="item-form defaultForm form-horizontal">
<div class="panel">
<div class="language item-field form-group">
<label class="control-label col-lg-3">{l s='Language' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
{foreach from=$htmlitems.lang.all item=lang}
{if $lang.id_lang == $htmlitems.lang.default.id_lang} {$lang.iso_code}{/if}
{/foreach}
<span class="caret">&nbsp;</span>
</button>
<ul class="languages dropdown-menu">
{foreach from=$htmlitems.lang.all item=lang}
<li id="lang-{$lang.id_lang}" class="new-lang-flag"><a href="javascript:hideOtherLanguage({$lang.id_lang});">{$lang.name}</a></li>
{/foreach}
</ul>
<input type="hidden" id="lang-id" name="id_lang" value="{$htmlitems.lang.default.id_lang}" />
</div>
</div>
<div class="title item-field form-group">
<label class="control-label col-lg-3 ">{l s='Title' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input class="form-control" type="text" name="item_title" size="48" value="" />
</div>
</div>
<div class="title_use item-field form-group">
<label class="control-label col-lg-3">{l s='Use title in front' mod='themeconfigurator'}</label>
<input type="checkbox" name="item_title_use" value="1" />
</div>
<div class="hook item-field form-group">
<label class="control-label col-lg-3">{l s='Hook' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<select class="form-control" name="item_hook" default="home">
<option value="home">home</option>
<option value="top">top</option>
<option value="left">left</option>
<option value="right">right</option>
<option value="footer">footer</option>
</select>
</div>
</div>
<div class="image item-field form-group">
<label class="control-label col-lg-3">{l s='Image' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="file" name="item_img" />
</div>
</div>
<div class="image_w item-field form-group">
<label class="control-label col-lg-3">{l s='Image width' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input name="item_img_w" type="text" maxlength="4" size="4" value=""/>
</div>
</div>
<div class="image_h item-field form-group">
<label class="control-label col-lg-3">{l s='Image height' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input name="item_img_h" type="text" maxlength="4" size="4" value=""/>
</div>
</div>
<div class="url item-field form-group">
<label class="control-label col-lg-3">{l s='URL' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="text" name="item_url" size="48" value="http://" />
</div>
</div>
<div class="target item-field form-group">
<label class="control-label col-lg-3">{l s='Target blank' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<input type="checkbox" name="item_target" value="1" />
</div>
</div>
<div class="html item-field form-group">
<label class="control-label col-lg-3">{l s='HTML' mod='themeconfigurator'}</label>
<div class="col-lg-7">
<textarea name="item_html" cols="65" rows="12"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" name="newItem" class="button-save btn btn-default" onClick="this.form.submit();">{l s='Save' mod='themeconfigurator'}</button>
</div>
</div>
</div>
</form>
</div>
</div>
@@ -1,7 +1,7 @@
{if isset($htmlitems.items) && $htmlitems.items}
<div id="htmlcontent_home">
{if isset($htmlitems) && $htmlitems}
<div id="htmlcontent_{$hook}">
<ul class="htmlcontent-home clearfix row">
{foreach name=items from=$htmlitems.items item=hItem}
{foreach name=items from=$htmlitems item=hItem}
<li class="htmlcontent-item col-xs-4">
{if $hItem.url}
<a href="{$hItem.url}" class="item-link"{if $hItem.target == 1} target="_blank"{/if}>
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>tmhtmlcontent</name>
<displayName><![CDATA[TM HTML content]]></displayName>
<version><![CDATA[1.0]]></version>
<description><![CDATA[]]></description>
<author><![CDATA[TemplateMonster]]></author>
<tab><![CDATA[other]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

Some files were not shown because too many files have changed in this diff Show More