From 27731f3bb2617a388b73617dc6381a03562df679 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Wed, 13 Nov 2013 20:13:42 +0100 Subject: [PATCH] // Bootstraping blocklayered backoffice and ajax fix --- .../blocklayered/blocklayered-ajax-back.php | 11 +- modules/blocklayered/blocklayered.php | 419 +++++++++++------- modules/blocklayered/upgrade/install-1.9.php | 9 + .../blocklayered/views/css/blocklayered.css | 21 + .../views/css/blocklayered_bt.css | 21 + 5 files changed, 310 insertions(+), 171 deletions(-) create mode 100644 modules/blocklayered/upgrade/install-1.9.php create mode 100644 modules/blocklayered/views/css/blocklayered.css create mode 100644 modules/blocklayered/views/css/blocklayered_bt.css diff --git a/modules/blocklayered/blocklayered-ajax-back.php b/modules/blocklayered/blocklayered-ajax-back.php index 0cb509fd2..427ca792d 100644 --- a/modules/blocklayered/blocklayered-ajax-back.php +++ b/modules/blocklayered/blocklayered-ajax-back.php @@ -19,7 +19,8 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @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) diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 48e79eb03..aa3505e78 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -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 = '

'.$this->l('Build your own filter template').'

- -
'; $html .= ' -

'.$this->l('Step 1/3 - Select categories').'

-

- '.$this->l('Use this template for:').' - - - - - -

'; +

'.$this->l('Step 1/3 - Select categories').'

+
+
+
+ +
+

+ + +

+

+ + +

+
+
'; $shops = Shop::getShops(true, null, true); if (count($shops) > 1) @@ -1871,12 +1870,14 @@ class BlockLayered extends Module if (Shop::isFeatureActive()) { - $html .= ''.$this->l('Choose shop association:').''; - $html .= '
'.$helper->renderAssoShop().'
'; + $html .= '
+ +
'.$helper->renderAssoShop().'
+
'; } } - - $html .= ' + + $html .= '
@@ -1903,24 +1904,22 @@ class BlockLayered extends Module $html .= '
-
+
-
-
-

'.$this->l('Step 2/3 - Select filters').'

+ +
+ +
+
+
+ + + + + + + +
+
+
+
+
+ +
+
+
+ + + + + + + +
+
+
+
+
+ +
+
+
+ + + + + + + +
+
+
+
+
+ +
+
+
+ + + + + + + +
+
+
+
+
+ +
+
+
+ + + + + + + +
+
+
+
+
+
+ +
+
'; @@ -3497,12 +3577,11 @@ class BlockLayered extends Module $n_elements = 20; $html = ' -
-

'.$this->l('Available filters').' (0)

+
+

'.$this->l('Available filters').' (0)

    • - '.$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 .= ' -
      '.$helper->renderAssoShop().'
      +
      '.$helper->renderAssoShop(false, Tools::getValue('base_folder').'/themes/default/template/helpers/tree/').'