public static function getGlobalValue($key, $id_lang = null) { ConfigurationKPI::setKpiDefinition(); $r = parent::getGlobalValue($key, $id_lang); ConfigurationKPI::unsetKpiDefinition(); return $r; }
public function testGetGlobalValue() { $this->assertEquals('RESULT_NOT_OVERRIDDEN', Configuration::getGlobalValue('PS_TEST_NOT_OVERRIDDEN')); $this->assertEquals('RESULT_GROUP_OVERRIDDEN', Configuration::getGlobalValue('PS_TEST_GROUP_OVERRIDDEN')); $this->assertEquals('RESULT_SHOP_OVERRIDDEN', Configuration::getGlobalValue('PS_TEST_SHOP_OVERRIDDEN')); $this->assertEquals('RESULT_GROUP_SHOP_OVERRIDDEN', Configuration::getGlobalValue('PS_TEST_GROUP_SHOP_OVERRIDDEN')); $this->assertFalse(Configuration::getGlobalValue('PS_TEST_DOES_NOT_EXIST')); }
public function __construct() { if (Tools::getValue('token') != Configuration::getGlobalValue('CRONJOBS_EXECUTION_TOKEN')) { die('Invalid token'); } parent::__construct(); $this->postProcess(); die; }
<?php include dirname(__FILE__) . '/../../config/config.inc.php'; include dirname(__FILE__) . '/../../init.php'; include dirname(__FILE__) . '/pm_advancedsearch4.php'; if (php_sapi_name() != 'cli') { if (isset($_GET['secure_key'])) { $secureKey = version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Configuration::getGlobalValue('PM_AS4_SECURE_KEY') : Configuration::get('PM_AS4_SECURE_KEY'); if (!empty($secureKey) and $secureKey === $_GET['secure_key']) { $PM_AdvancedSearch4 = new PM_AdvancedSearch4(); $PM_AdvancedSearch4->cronTask(); echo 'Reindexation done'; } } } else { $PM_AdvancedSearch4 = new PM_AdvancedSearch4(); $PM_AdvancedSearch4->cronTask(); echo 'Reindexation done via PHP Cli'; }
/** * @return bool Return true if multishop feature is active and at last 2 shops have been created */ public static function isFeatureActive() { static $feature_active = null; if ($feature_active === null) { $feature_active = Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') && Db::getInstance()->getValue('SELECT COUNT(*) FROM ' . _DB_PREFIX_ . 'shop') > 1; } return $feature_active; }
public function getContent() { global $cookie; $html = ''; if (Tools::isSubmit('SubmitFilter')) { if (!Tools::getValue('layered_tpl_name')) { $html .= ' <div class="error"> <span style="float:right"> <a href="" id="hideError"><img src="../img/admin/close.png" alt="X"></a> </span> <img src="../img/admin/error2.png">' . $this->l('Filter template name required (cannot be empty)') . ' </div>'; } else { if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) { Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter')); $this->buildLayeredCategories(); } if (Tools::getValue('scope') == 1) { Db::getInstance()->execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'layered_filter'); $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_category FROM ' . _DB_PREFIX_ . 'category'); foreach ($categories as $category) { $_POST['categoryBox'][] = (int) $category['id_category']; } } $id_layered_filter = (int) $_POST['id_layered_filter']; if (!$id_layered_filter) { $id_layered_filter = (int) Db::getInstance()->Insert_ID(); } $shop_list = array(); if (isset($_POST['checkBoxShopAsso_layered_filter'])) { foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_shop => $row) { $assos[] = array('id_object' => (int) $id_layered_filter, 'id_shop' => (int) $id_shop); $shop_list[] = (int) $id_shop; } } else { $shop_list = array(Context::getContext()->shop->id); } if (count($_POST['categoryBox'])) { /* Clean categoryBox before use */ if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) { foreach ($_POST['categoryBox'] as &$category_box_tmp) { $category_box_tmp = (int) $category_box_tmp; } } $filter_values = array(); foreach ($_POST['categoryBox'] as $idc) { $filter_values['categories'][] = (int) $idc; } $filter_values['shop_list'] = $shop_list; $values = false; foreach ($_POST['categoryBox'] as $id_category_layered) { foreach ($_POST as $key => $value) { if (substr($key, 0, 17) == 'layered_selection' && $value == 'on') { $values = true; $type = 0; $limit = 0; if (Tools::getValue($key . '_filter_type')) { $type = Tools::getValue($key . '_filter_type'); } if (Tools::getValue($key . '_filter_show_limit')) { $limit = Tools::getValue($key . '_filter_show_limit'); } $filter_values[$key] = array('filter_type' => (int) $type, 'filter_show_limit' => (int) $limit); } } } Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter_shop WHERE `id_layered_filter` = ' . (int) $id_layered_filter); if (isset($assos)) { foreach ($assos as $asso) { Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'layered_filter_shop (`id_layered_filter`, `id_shop`) VALUES(' . $id_layered_filter . ', ' . (int) $asso['id_shop'] . ')'); } } $values_to_insert = array('name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filter_values)), 'n_categories' => (int) count($filter_values['categories']), 'date_add' => date('Y-m-d H:i:s')); if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) { $values_to_insert['id_layered_filter'] = (int) Tools::getValue('id_layered_filter'); } Db::getInstance()->autoExecute(_DB_PREFIX_ . 'layered_filter', $values_to_insert, 'INSERT'); $this->buildLayeredCategories(); $html .= '<div class="conf">' . $this->l('Your filter') . ' "' . Tools::safeOutput(Tools::getValue('layered_tpl_name')) . '" ' . (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'] ? $this->l('was updated successfully.') : $this->l('was added successfully.')) . '</div>'; } } } else { if (Tools::isSubmit('submitLayeredSettings')) { Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', (int) Tools::getValue('ps_layered_hide_0_values')); Configuration::updateValue('PS_LAYERED_SHOW_QTIES', (int) Tools::getValue('ps_layered_show_qties')); Configuration::updateValue('PS_LAYERED_FULL_TREE', (int) Tools::getValue('ps_layered_full_tree')); Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', (int) Tools::getValue('ps_layered_filter_price_usetax')); Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int) Tools::getValue('ps_layered_filter_category_depth')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', (int) Tools::getValue('ps_layered_filter_index_availability')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', (int) Tools::getValue('ps_layered_filter_index_condition')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', (int) Tools::getValue('ps_layered_filter_index_manufacturer')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', (int) Tools::getValue('ps_layered_filter_index_category')); $html .= ' <div class="conf">' . $this->l('Settings saved successfully') . '</div>'; } else { if (isset($_GET['deleteFilterTemplate'])) { $layered_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT filters FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter']); if ($layered_values) { Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter'] . ' LIMIT 1'); $this->buildLayeredCategories(); $html .= ' <div class="conf">' . $this->l('Filter template deleted, categories updated (reverted to default Filter template).') . ' </div>'; } else { $html .= ' <div class="error"> <img src="../img/admin/error.png" alt="" title="" /> ' . $this->l('Filter template not found') . ' </div>'; } } } } $html .= ' <div id="ajax-message-ok" class="conf ajax-message" style="display: none"> <span class="message"></span> </div> <div id="ajax-message-ko" class="error ajax-message" style="display: none"> <span class="message"></span> </div> <h2>' . $this->l('Layered navigation') . '</h2> <fieldset class="width4"> <legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Indexes and caches') . '</legend> <span id="indexing-warning" style="display: none; color:red; font-weight: bold">' . $this->l('Indexing is in progress. Please do not leave this page') . '<br/><br/></span>'; if (!Configuration::getGlobalValue('PS_LAYERED_INDEXED')) { $html .= ' <script type="text/javascript"> $(document).ready(function() { $(\'#url-indexer\').click(); $(\'#full-index\').click(); }); </script>'; } $category_ist = array(); foreach (Db::getInstance()->executeS('SELECT id_category FROM `' . _DB_PREFIX_ . 'category`') as $category) { if ($category['id_category'] != 1) { $category_ist[] = $category['id_category']; } } $domain = Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST']; $html .= ' <a class="bold ajaxcall-recurcive" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Index all missing prices') . '</a> <br /> <a class="bold ajaxcall-recurcive" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1">' . $this->l('Rebuild entire price index') . '</a> <br /> <a class="bold ajaxcall" id="attribute-indexer" rel="attribute" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Build attribute index') . '</a> <br /> <a class="bold ajaxcall" id="url-indexer" rel="price" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1">' . $this->l('Build URL index') . '</a> <br /> <br /> ' . $this->l('You can set a cron job that will rebuild price index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1</b> <br /> ' . $this->l('You can set a cron job that will rebuild URL index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1</b> <br /> ' . $this->l('You can set a cron job that will rebuild attribute index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '</b> <br /><br /> ' . $this->l('A nightly rebuild is recommended.') . ' <script type="text/javascript"> $(\'.ajaxcall\').click(function() { if (this.legend == undefined) this.legend = $(this).html(); if (this.running == undefined) this.running = false; if (this.running == true) return false; $(\'.ajax-message\').hide(); this.running = true; if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed) { $(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\'); $(\'#indexing-warning\').show(); } this.restartAllowed = false; var type = $(this).attr(\'rel\'); $.ajax({ url: this.href+\'&ajax=1\', context: this, dataType: \'json\', cache: \'false\', success: function(res) { this.running = false; this.restartAllowed = true; $(\'#indexing-warning\').hide(); $(this).html(this.legend); if (type == \'price\') $(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('URL indexation finished')) . '\'); else $(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Attribute indexation finished')) . '\'); $(\'#ajax-message-ok\').show(); return; }, error: function(res) { this.restartAllowed = true; $(\'#indexing-warning\').hide(); if (type == \'price\') $(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('URL indexation failed')) . '\'); else $(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Attribute indexation failed')) . '\'); $(\'#ajax-message-ko\').show(); $(this).html(this.legend); this.running = false; } }); return false; }); $(\'.ajaxcall-recurcive\').each(function(it, elm) { $(elm).click(function() { if (this.cursor == undefined) this.cursor = 0; if (this.legend == undefined) this.legend = $(this).html(); if (this.running == undefined) this.running = false; if (this.running == true) return false; $(\'.ajax-message\').hide(); this.running = true; if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed) { $(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\'); $(\'#indexing-warning\').show(); } this.restartAllowed = false; $.ajax({ url: this.href+\'&ajax=1&cursor=\'+this.cursor, context: this, dataType: \'json\', cache: \'false\', success: function(res) { this.running = false; if (res.result) { this.cursor = 0; $(\'#indexing-warning\').hide(); $(this).html(this.legend); $(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Price indexation finished')) . '\'); $(\'#ajax-message-ok\').show(); return; } this.cursor = parseInt(res.cursor); $(this).html(this.legend+\' ' . addslashes($this->l('(in progress, %s products price to index)')) . '\'.replace(\'%s\', res.count)); $(this).click(); }, error: function(res) { this.restartAllowed = true; $(\'#indexing-warning\').hide(); $(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Price indexation failed')) . '\'); $(\'#ajax-message-ko\').show(); $(this).html(this.legend); this.cursor = 0; this.running = false; } }); return false; }); }); </script> </fieldset> <br /> <fieldset class="width4"> <legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Existing filter templates') . '</legend>'; $filters_templates = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC'); if (count($filters_templates)) { $html .= '<p>' . count($filters_templates) . ' ' . $this->l('filter templates are configured:') . '</p> <table id="table-filter-templates" class="table" style="width: 700px;"> <tr> <th>' . $this->l('ID') . '</th> <th>' . $this->l('Name') . '</th> <th>' . $this->l('Categories') . '</th> <th>' . $this->l('Created on') . '</th> <th>' . $this->l('Actions') . '</th> </tr>'; foreach ($filters_templates as $filters_template) { /* Clean request URI first */ $_SERVER['REQUEST_URI'] = preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI']); $html .= ' <tr> <td>' . (int) $filters_template['id_layered_filter'] . '</td> <td style="text-align: left; padding-left: 10px; width: 270px;">' . $filters_template['name'] . '</td> <td style="text-align: center;">' . (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'] . '" 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> </td> </tr>'; } $html .= ' </table>'; } else { $html .= $this->l('No filter template found.'); } $html .= ' </fieldset><br /> <fieldset class="width4"> <legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Build your own filter template') . '</legend> <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>'; $shops = Shop::getShops(true, null, true); if (count($shops) > 1) { $helper = new HelperForm(); $helper->id = null; $helper->table = 'layered_filter'; $helper->identifier = 'id_layered_filter'; 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 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".') . ' </div> <div style="display: none;"> <div id="layered-categories-selection" style="padding: 10px; text-align: left;"> <h2>' . $this->l('Categories using this template') . '</h2> <ol style="padding-left: 20px;"> <li>' . $this->l('Select one ore more category using this filter template') . '</li> <li>' . $this->l('Press "Save this selection" or close the window to save') . '</li> </ol>'; $selected_cat = array(); // Translations are not automatic for the moment ;) if (Shop::getContext() == Shop::CONTEXT_SHOP) { $root_category = Category::getRootCategory(); $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name); } else { $root_category = array('id_category' => '0', 'name' => $this->l('Root')); } $helper = new Helper(); $html .= $helper->renderCategoryTree(null, $selected_cat, 'categoryBox'); $html .= ' <br /> <center><input type="button" class="button" value="' . $this->l('Save this selection') . '" onclick="$.fancybox.close();" /></center> </div> </div> <div id="layered-step-2"> <hr size="1" noshade /> <h2>' . $this->l('Step 2/3 - Select filters') . '</h2> <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> <p id="no-filters">' . $this->l('No filters selected yet.') . '</p> <ul id="selected_filters"></ul> </div> <div id="layered-ajax-refresh"> ' . $this->ajaxCallBackOffice() . ' </div> </div> <div class="clear"></div> <hr size="1" noshade />'; $this->context->controller->addJQueryPlugin('fancybox'); $this->context->controller->addJQueryUI('ui.sortable'); $this->context->controller->addJQueryUI('ui.draggable'); $this->context->controller->addJQueryUI('effects.transfer'); $id_lang = Context::getContext()->cookie->id_lang; $html .= ' <script type="text/javascript"> function updLayCounters(showAlert) { $(\'#num_sel_filters\').html(\'(\'+$(\'ul#selected_filters\').find(\'li\').length+\')\'); $(\'#num_avail_filters\').html(\'(\'+$(\'#layered_container_right ul\').find(\'li\').length+\')\'); if ($(\'ul#selected_filters\').find(\'li\').length >= 1) { $(\'#layered-step-3\').show(); $(\'#layered-step-3 .alert\').hide(); } else { if (showAlert) $(\'#layered-step-3\').show(); else $(\'#layered-step-3\').hide(); $(\'#layered-step-3 .alert\').show(); } } function updPositions() { $(\'#layered_container_left li\').each(function(idx) { $(this).find(\'span.position\').html(parseInt(1+idx)+\'. \'); }); } function updCatCounter() { $(\'#layered-cat-counter\').html($(\'#categories-treeview\').find(\'input:checked\').length); $(\'#layered-cat-counter\').show(); } function updHeight() { $(\'#layered_container_left\').css(\'height\', 30+(1+$(\'#layered_container_left\').find(\'li\').length)*34); $(\'#layered_container_right\').css(\'height\', 30+(1+$(\'#layered_container_right\').find(\'li\').length)*34); } function updElements(all, id_layered_filter) { if ($(\'#error-treeview\').is(\':hidden\')) $(\'#layered-step-2\').show(); else $(\'#layered-step-2\').hide(); $(\'#layered-ajax-refresh\').css(\'background-color\', \'black\'); $(\'#layered-ajax-refresh\').css(\'opacity\', \'0.2\'); $(\'#layered-ajax-refresh\').html(\'<div style="margin: 0 auto; padding: 10px; text-align: center;">\' +\'<img src="../img/admin/ajax-loader-big.gif" alt="" /><br /><p style="color: white;">' . addslashes($this->l('Loading...')) . '</p></div>\'); $.ajax( { type: \'POST\', url: \'' . __PS_BASE_URI__ . '\' + \'modules/blocklayered/blocklayered-ajax-back.php\', 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) : \'\') +\'&base_folder=' . urlencode(_PS_ADMIN_DIR_) . '\', success: function(result) { $(\'#layered-ajax-refresh\').css(\'background-color\', \'transparent\'); $(\'#layered-ajax-refresh\').css(\'opacity\', \'1\'); $(\'#layered-ajax-refresh\').html(result); $(\'#layered_container_right li input\').each(function() { if ($(\'#layered_container_left\').find(\'input[id="\'+$(this).attr(\'id\')+\'"]\').length > 0) $(this).parent().remove(); }); updHeight(); updLayCounters(true); } }); return false; } function checkForm() { if ($(\'#layered_tpl_name\').val() == \'\') { $(\'#error-filter-name\').show(); return false; } else if ($(\'#scope_1\').attr(\'checked\') && $(\'#n_existing\').val() > 0) if (!confirm(\'' . addslashes($this->l('You selected -All categories-, all existing filter templates will be deleted, OK?')) . '\')) return false; return true; } function launch() { $(\'#layered_container input\').live(\'click\', function () { if ($(this).parent().hasClass(\'layered_right\')) { $(\'p#no-filters\').hide(); $(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png") repeat-x scroll 50% 50% #FDF5CE\'); $(this).parent().removeClass(\'layered_right\'); $(this).parent().addClass(\'layered_left\'); $(this).effect(\'transfer\', { to: $(\'#layered_container_left ul#selected_filters\') }, 300, function() { $(this).parent().appendTo(\'ul#selected_filters\'); updLayCounters(false); updHeight(); updPositions(); }); } else { $(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png") repeat-x scroll 50% 50% #F6F6F6\'); $(this).effect(\'transfer\', { to: $(\'#layered_container_right ul#all_filters\') }, 300, function() { $(this).parent().removeClass(\'layered_left\'); $(this).parent().addClass(\'layered_right\'); $(this).parent().appendTo(\'ul#all_filters\'); updLayCounters(true); updHeight(); updPositions(); if ($(\'#layered_container_left ul\').length == 0) $(\'p#no-filters\').show(); }); } enableSortable(); }); $(\'label a#inline\').fancybox({ \'hideOnContentClick\': false, \'onClosed\': function() { lock_treeview_hidding = false; $(\'#categories-treeview\').parent().parent().hide(); updCatCounter(); if ($(\'#categories-treeview\').find(\'input:checked\').length == 0) $(\'#error-treeview\').show(); else $(\'#error-treeview\').hide(); updElements(0, 0); }, \'onComplete\': function() { lock_treeview_hidding = true; $(\'#categories-treeview\').parent().parent().show(); if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\')) return; if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\', true)) $($(\'#categories-treeview li\')[0]).removeClass(\'static\'); $($(\'#categories-treeview li span\')[0]).trigger(\'click\'); $($(\'#categories-treeview li\')[0]).children(\'div\').remove(); $($(\'#categories-treeview li\')[0]). removeClass(\'collapsable lastCollapsable\'). addClass(\'last static\'); $(\'.hitarea\').live(\'click\', function(it) { $(this).parent().find(\'> .category_label\').click(); }); } }); updHeight(); updLayCounters(false); updPositions(); updCatCounter(); enableSortable(); } function enableSortable() { $(function() { $(\'ul#selected_filters\').sortable({ axis: \'y\', update: function() { updPositions(); }, placeholder: \'ui-state-highlight\' }); $(\'ul#selected_filters\').disableSelection(); }); } $(document).ready(function() { launch(); }); </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> <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> <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) . '" /> </form> </fieldset><br /> <fieldset class="width4"> <legend><img src="../img/admin/cog.gif" alt="" /> ' . $this->l('Configuration') . '</legend> <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> <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> </form> </fieldset>'; return $html; }
public static function getSpecialCatrgoryIdsArray() { $wyuxmpthu = "specialIds"; global $cookie; ${$wyuxmpthu} = array(); if (Module::isInstalled("agilemembership")) { ${"GLOBALS"}["fmpcnwtupy"] = "specialIds"; ${${"GLOBALS"}["fmpcnwtupy"]}[] = intval(Configuration::get("AGILE_MEMBERSHIP_CID")); } if (Module::isInstalled("agileprepaidcredit")) { ${${"GLOBALS"}["qgvsfxh"]}[] = intval(Configuration::getGlobalValue("AGILE_PCREDIT_CID")); } if (Module::isInstalled("agilesellerlistoptions")) { ${${"GLOBALS"}["qgvsfxh"]}[] = intval(Configuration::get("ASLO_CATEGORY_ID")); } return ${${"GLOBALS"}["qgvsfxh"]}; }
public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true, Context $context = null) { global $cookie; if (!$checkAccess or !$this->checkAccess($cookie->id_customer)) { return false; } if (!$context) { $context = Context::getContext(); } $front = true; if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) { $front = false; } if (Module::isInstalled('agilemembership') and $this->id == Configuration::get('AGILE_MEMBERSHIP_CID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agileprepaidcredit') and $this->id == Configuration::getGlobalValue('AGILE_PCREDIT_CID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agilesellerlistoptions') and $this->id == Configuration::get('ASLO_CATEGORY_ID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } $agile_sql_parts = AgileSellerManager::getAdditionalSqlForProducts("p"); if (empty($agile_sql_parts['selects']) and empty($agile_sql_parts['joins']) and empty($agile_sql_parts['wheres'])) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agilesellerlistoptions')) { require_once _PS_ROOT_DIR_ . "/modules/agilesellerlistoptions/agilesellerlistoptions.php"; if ($this->id <= 1 or $this->id == 2 or $this->id == (int) Configuration::get('PS_HOME_CATEGORY')) { return AgileSellerListOptions::get_home_products($id_lang, $p, $n); } if (empty($orderBy) || $orderBy == 'position') { $orderBy = 'position2'; } } if ($p < 1) { $p = 1; } if (empty($orderBy)) { $orderBy = 'position'; } else { $orderBy = strtolower($orderBy); } if (empty($orderWay)) { $orderWay = 'ASC'; } if ($orderBy == 'id_product' or $orderBy == 'date_add' or $orderBy == 'date_upd') { $orderByPrefix = 'p'; } elseif ($orderBy == 'name') { $orderByPrefix = 'pl'; } elseif ($orderBy == 'manufacturer') { $orderByPrefix = 'm'; $orderBy = 'name'; } elseif ($orderBy == 'position') { $orderByPrefix = 'cp'; } if ($orderBy == 'price') { $orderBy = 'orderprice'; } if (!Validate::isBool($active) or !Validate::isOrderBy($orderBy) or !Validate::isOrderWay($orderWay)) { die(Tools::displayError()); } $id_supplier = (int) Tools::getValue('id_supplier'); if ($getTotal) { $sql = ' SELECT COUNT(cp.`id_product`) AS total FROM `' . _DB_PREFIX_ . 'product` p ' . Shop::addSqlAssociation('product', 'p') . ' LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON p.`id_product` = cp.`id_product` ' . $agile_sql_parts['joins'] . ' WHERE cp.`id_category` = ' . (int) $this->id . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($active ? ' AND product_shop.`active` = 1' : '') . $agile_sql_parts['wheres'] . ($id_supplier ? 'AND p.id_supplier = ' . (int) $id_supplier : ''); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); return isset($result) ? $result['total'] : 0; } $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default, DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY)) > 0 AS new, product_shop.price AS orderprice ' . $agile_sql_parts['selects'] . ' FROM `' . _DB_PREFIX_ . 'category_product` cp LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON p.`id_product` = cp.`id_product` ' . Shop::addSqlAssociation('product', 'p') . ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product`) ' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . ' ' . Product::sqlStock('p', 'product_attribute_shop', false, $context->shop) . ' LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('cl') . ') LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . ') LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . ' LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` ' . $agile_sql_parts['joins'] . ' WHERE product_shop.`id_shop` = ' . (int) $context->shop->id . ' ' . $agile_sql_parts['wheres'] . ' AND cp.`id_category` = ' . (int) $this->id . ($active ? ' AND product_shop.`active` = 1' : '') . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($id_supplier ? ' AND p.id_supplier = ' . (int) $id_supplier : '') . ' GROUP BY product_shop.id_product'; if ($random === true) { $sql .= ' ORDER BY RAND()'; $sql .= ' LIMIT 0, ' . (int) $randomNumberProducts; } else { $sql .= ' ORDER BY ' . (isset($orderByPrefix) ? $orderByPrefix . '.' : '') . '`' . pSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n; } $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if (!$result) { return array(); } $seller = array(); $id_seller = array(); $link_seller = array(); foreach ($result as $row) { $pid = $row['id_product']; $seller[$pid] = isset($row['seller']) ? $row['seller'] : ''; $id_seller[$pid] = isset($row['id_seller']) ? intval($row['id_seller']) : 0; $link_seller[$pid] = isset($row['has_sellerlink']) ? $row['has_sellerlink'] : ''; } $resultsArray = Product::getProductsProperties((int) $id_lang, $result); for ($idx = 0; $idx < count($resultsArray); $idx++) { $pid = $resultsArray[$idx]['id_product']; $resultsArray[$idx]['seller'] = $seller[$pid]; $resultsArray[$idx]['id_seller'] = $id_seller[$pid]; $resultsArray[$idx]['has_sellerlink'] = $link_seller[$pid]; } $resultsArray = AgileSellerManager::prepareSellerRattingInfo($resultsArray); return $resultsArray; }
protected function updateWebservice($use_webservice) { $link = new Link(); $admin_folder = $this->getAdminDir(); $path = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . $admin_folder; $cron_url = $path . '/' . $link->getAdminLink('AdminCronJobs', false); $webservice_id = Configuration::get('CRONJOBS_WEBSERVICE_ID') ? '/' . Configuration::get('CRONJOBS_WEBSERVICE_ID') : null; $data = array('callback' => $link->getModuleLink($this->name, 'callback'), 'domain' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__, 'cronjob' => $cron_url . '&token=' . Configuration::getGlobalValue('CRONJOBS_EXECUTION_TOKEN'), 'cron_token' => Configuration::getGlobalValue('CRONJOBS_EXECUTION_TOKEN'), 'active' => (bool) $use_webservice); $context_options = array('http' => array('method' => is_null($webservice_id) == true ? 'POST' : 'PUT', 'content' => http_build_query($data))); $result = Tools::file_get_contents($this->webservice_url . $webservice_id, false, stream_context_create($context_options)); if ($result != false) { Configuration::updateValue('CRONJOBS_WEBSERVICE_ID', (int) $result); } if ((Tools::isSubmit('install') == true || Tools::isSubmit('reset') == true) && (bool) $result == false) { return true; } elseif ((Tools::isSubmit('install') == false || Tools::isSubmit('reset') == false) && (bool) $result == false) { return $this->setErrorMessage('An error occurred while trying to contact PrestaShop\'s cron tasks webservice.'); } elseif ($this->isLocalEnvironment() == true) { return true; } if ((bool) $use_webservice == true) { return $this->setSuccessMessage('Your cron tasks have been successfully added to PrestaShop\'s cron tasks webservice.'); } return $this->setSuccessMessage('Your cron tasks have been successfully registered using the Advanced mode.'); }
private function getExtraModulesConfiguration() { $c = Configuration::getGlobalValue('PP_INTEGRATION_EXTRA_MODULES'); if (is_string($c)) { return Tools::jsonDecode($c, true); } return null; }
public static function getPickupCentersBySellerId($id_seller, $id_lang) { $id_carrier = (int) Configuration::getGlobalValue('AGILE_PICKUPCENTER_CARRIER_ID'); $sql = 'Select l.id_location, l.id_carrier, c.name as carrier,l.location, l.active,l.address1,l.postcode,l.city,cl.name as country from ' . _DB_PREFIX_ . 'location l ' . 'INNER JOIN ' . _DB_PREFIX_ . 'carrier c on c.id_carrier=l.id_carrier ' . 'LEFT JOIN ' . _DB_PREFIX_ . 'country_lang cl ON (l.id_country = cl.id_country AND cl.id_lang = ' . (int) $id_lang . ' ) WHERE l.deleted = 0 AND l.id_seller = ' . (int) $id_seller . ' AND l.id_carrier = ' . $id_carrier; return Db::getInstance()->executeS($sql); }
public function show_status() { $table = new Cli\Table(); $table->setHeaders(array('Key', 'Configuration', 'Value')); PS_CLI_Utils::add_boolean_configuration_status($table, 'PS_SMARTY_CACHE', 'Smarty Template Cache'); PS_CLI_Utils::add_configuration_value($table, 'PS_SMARTY_CACHING_TYPE', 'Smarty Caching type', '1.6.0.11'); PS_CLI_Utils::add_configuration_value($table, 'PS_SMARTY_CONSOLE', 'Display smarty console (0 for never, 1 for URL, 2 for always)', '1.6.0.11'); PS_CLI_Utils::add_configuration_value($table, 'PS_SMARTY_CONSOLE_KEY', 'Smarty console key', '1.6.0.11'); $currentConfig = Configuration::getGlobalValue('PS_SMARTY_FORCE_COMPILE'); $line = array('PS_SMARTY_FORCE_COMPILE', 'Smarty Template Compilation (' . _PS_SMARTY_NO_COMPILE_ . ' for never, ' . _PS_SMARTY_CHECK_COMPILE_ . ' for updated, ' . _PS_SMARTY_FORCE_COMPILE_ . ' for always)'); switch ($currentConfig) { case _PS_SMARTY_NO_COMPILE_: array_push($line, $currentConfig . ' (never)'); break; case _PS_SMARTY_CHECK_COMPILE_: array_push($line, $currentConfig . ' (if updated)'); break; case _PS_SMARTY_FORCE_COMPILE_: array_push($line, $currentConfig . ' (Always)'); break; } $table->addRow($line); PS_CLI_Utils::add_boolean_configuration_status($table, 'PS_CSS_THEME_CACHE', 'Css cache'); PS_CLI_Utils::add_boolean_configuration_status($table, 'PS_JS_THEME_CACHE', 'JS cache'); PS_CLI_Utils::add_boolean_configuration_status($table, 'PS_HTACCESS_CACHE_CONTROL', 'Htaccess cache control'); PS_CLI_Utils::add_boolean_configuration_status($table, 'PS_MEDIA_SERVERS', 'Use Media Servers'); $line = array('PS_CIPHER_ALGORITHM', 'Cipher (0=blowfish, 1=rijndael)'); if (Configuration::getGlobalValue('PS_CIPHER_ALGORITHM')) { array_push($line, 'RIJNDAEL/Mcrypt'); } else { array_push($line, 'Local Blowfish'); } $table->addRow($line); $line = array('Const: _PS_CACHE_ENABLED_', 'Cache'); if (_PS_CACHE_ENABLED_) { array_push($line, 'enabled'); } else { array_push($line, 'disabled'); } $table->addRow($line); $table->addRow(array('Const: _PS_CACHING_SYSTEM_', 'Active Caching system', _PS_CACHING_SYSTEM_)); $table->display(); return; }
private function displayCronInformation() { $this->smarty->assign(array('cron_path' => dirname(__FILE__) . DIRECTORY_SEPARATOR, 'secure_key' => Configuration::getGlobalValue('MEDIAFINANZ_SECURE_KEY'))); return $this->display(__FILE__, 'views/templates/admin/cron_information.tpl'); }
/** * Load and check the Noair Cache. * returns a ready to use array for a smarty template file * return false is no progam are available, even after cache refresh * * @return array / bool */ public function getUpcoming() { if (!($nbToShow = (int) Configuration::getGlobalValue('NOAIR_UPCOMING_NB_SHOW'))) { return false; } if (!$this->_loadNoAirCache() or $this->_cacheAvailableUpcoming < $nbToShow) { $this->_updateNoAirCache(); } return $this->_cacheCurrentProgramId ? array_slice($this->_cacheData, $this->_cacheCurrentProgramId, $nbToShow) : false; }
public function getContent() { if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->_html .= '<div id="pm_backoffice_wrapper" class="pm_bo_ps_' . substr(str_replace('.', '', _PS_VERSION_), 0, 2) . '">'; } $this->_displayTitle($this->displayName); if ($this->_checkPermissions()) { if (Tools::getValue('makeUpdate')) { $this->checkIfModuleIsUpdate(true); } if (!$this->checkIfModuleIsUpdate(false)) { if (Configuration::get('PM_' . self::$_module_prefix . '_LAST_VERSION', false) !== false && version_compare(Configuration::get('PM_' . self::$_module_prefix . '_LAST_VERSION', false), '4.8', '>=') && version_compare(Configuration::get('PM_' . self::$_module_prefix . '_LAST_VERSION', false), '4.9.1', '<=')) { $this->_html .= ' <div class="warning warn clear"> ' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? ' <p>' . $this->l('You have an old version of the module, this new version has a new approach for multishop features.') . '</p> <p>' . $this->l('Because of a lot of constraints, you will not be able to associate one search engine to multiple shops anymore.') . '</p> <p>' . $this->l('If it is your case at this time, we will only associate your search engine to one shop (from all the shops it was currently associated).') . '</p> ' : '') . ' <p>' . $this->l('We really recommand you to re-index all the search engines after this update. Thank you for your comprehension.') . '</p> </div><br />'; } $this->_html .= ' <div class="warning warn clear"><p>' . $this->l('We have detected that you installed a new version of the module on your shop') . '</p> <p style="text-align: center"><a href="' . $this->_base_config_url . '&makeUpdate=1" class="button">' . $this->l('Please click here in order to finish the installation process') . '</a></p> </div>'; $this->_loadCssJsLibraries(); } else { if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && Shop::getContext() != Shop::CONTEXT_SHOP) { $this->_loadCssJsLibraries(); $this->_html .= '<div class="module_error alert error">' . $this->l('You must select a specific shop in order to continue, you can\'t create/edit a search engine from the "all shop" or "group shop" context.') . '</div>'; } else { $this->_preProcess(); $this->_loadCssJsLibraries(); $this->_postProcess(); $blocklayered_module = Module::getInstanceByName('blocklayered'); if (is_object($blocklayered_module) && isset($blocklayered_module->active) && $blocklayered_module->active == true) { if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $nbBlockLayeredFilters = (int) Db::getInstance()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'layered_filter` f JOIN `' . _DB_PREFIX_ . 'layered_filter_shop` fs ON (f.`id_layered_filter`= f.`id_layered_filter` AND fs.`id_shop`=' . $this->context->shop->id . ')'); } else { $nbBlockLayeredFilters = (int) Db::getInstance()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'layered_filter`'); } if ($nbBlockLayeredFilters) { $this->_showWarning($this->l('Block Layered is not compatible with Advanced Search 4.') . '<br />' . $this->l('You must disable it first, or remove any filters in order to prevent unexpected behaviour on your shop.')); } } $this->_showRating(true); parent::getContent(); $this->_html .= ' <script type="text/javascript"> var editTranlate = "' . $this->l('Edit') . '"; var reindexationInprogressMsg = "' . addcslashes($this->l('Another reindexing is in progress. Please wait.'), '"') . '"; var reindexingCriteriaMsg = "' . addcslashes($this->l('Reindexing criteria group'), '"') . '"; var reindexingCriteriaOfMsg = "' . addcslashes($this->l('of'), '"') . '"; $jqPm(document).ready(function() { //Initialise the second table specifying a dragClass and an onDrop function that will display an alert $jqPm("#wrapConfigTab, #wrapAsTab").tabs({cache:false}); }); </script>'; $advanced_searchs = AdvancedSearchClass::getSearchs($this->_cookie->id_lang, false); $this->_addButton(array('text' => $this->l('Add a new search'), 'href' => $this->_base_config_url . '&pm_load_function=displaySearchForm&class=AdvancedSearchClass&pm_js_callback=closeDialogIframe', 'icon_class' => 'ui-icon ui-icon-circle-plus', 'class' => 'open_on_dialog_iframe', 'rel' => '950_530_1')); $this->_html .= '<br /><br /><div id="wrapAsTab"> <ul id="asTab">'; if ($advanced_searchs && sizeof($advanced_searchs)) { foreach ($advanced_searchs as $k => $advanced_search) { $this->_html .= '<li id="TabSearchAdminPanel' . (int) $advanced_search['id_search'] . '"><a href="' . $this->_base_config_url . '&pm_load_function=displaySearchAdminPanel&id_search=' . $advanced_search['id_search'] . '"><span>' . $advanced_search['internal_name'] . '</span></a></li>'; } } $this->_html .= '</ul>'; $this->_html .= '</div><br />'; $this->_html .= '<div id="msgNoResults" style="' . ($advanced_searchs && sizeof($advanced_searchs) ? 'display:none;' : '') . '">'; $this->_showInfo($this->l('You do not have added a search engine yet. Please click on the click "Add a new search" in order to start.')); $this->_html .= '<br /></div>'; $this->_html .= '<div id="wrapConfigTab"> <ul id="configTab"> <li><a href="#config-2"><span><img src="' . $this->_path . 'img/document-code.png" /> ' . $this->l('Advanced styles') . '</span></a></li> <li><a href="#config-3"><span><img src="' . $this->_path . 'img/clock.png" /> ' . $this->l('Crontab') . '</span></a></li> <li><a href="#config-4"><span><img src="' . $this->_path . 'img/drill.png" /> ' . $this->l('Maintenance') . '</span></a></li> </ul>'; $this->_html .= '<div id="config-2">'; $this->displayAdvancedConfig(); $this->_html .= '</div>'; $this->_html .= '<div id="config-3">'; $this->_html .= '<br /><div class="conf confirm">' . $this->l('Use this URL for CRON Tasks (reindexation)') . '<br />' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? $this->context->shop->getBaseURL() : Tools::getHttpHost(true, true) . __PS_BASE_URI__) . 'modules/pm_advancedsearch4/cron.php?secure_key=' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Configuration::getGlobalValue('PM_AS4_SECURE_KEY') : Configuration::get('PM_AS4_SECURE_KEY')) . '</div>'; $this->_html .= '</div>'; $this->_html .= '<div id="config-4">'; $this->displayMaintenance(); $this->_html .= '</div>'; $this->_html .= '</div>'; } } } else { $this->_loadCssJsLibraries(); } $this->_displaySupport(); $this->_html .= '</div>'; return $this->_html; }
/** * Get configuration * @var string Configuration key * @var boolean If is global configuration * @return mixed Value of key, or false if not exists */ public static function getConfiguration($key, $global = false) { if (version_compare(_PS_VERSION_, '1.5', '>=') && $global) { $value = Configuration::getGlobalValue($key); } else { $value = Configuration::get($key); } return $value; }
public function update($autodate = true, $null_values = false) { if (!Configuration::getGlobalValue('PS_GROUP_FEATURE_ACTIVE') && $this->reduction > 0) { Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', 1); } return parent::update($autodate, $null_values); }
* * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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 info@easymarketing.de so we can send you a copy immediately. * * @author silbersaiten www.silbersaiten.de <*****@*****.**> * @copyright 2015 Mediafinanz * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require dirname(__FILE__) . '/../../config/config.inc.php'; require_once _PS_ROOT_DIR_ . '/init.php'; require_once dirname(__FILE__) . '/mediafinanz.php'; if (Tools::isPHPCLI() && isset($argc) && isset($argv)) { Tools::argvToGET($argc, $argv); } if (Tools::getValue('secure_key') != Configuration::getGlobalValue('MEDIAFINANZ_SECURE_KEY')) { die('Secure key is wrong'); } else { $module = new Mediafinanz(); $return = true; $return &= $module->sendReminders(); $log_type = 'cron'; $message = 'Return: ' . print_r($return, true); Mediafinanz::logToFile($message, $log_type); }
private function displayShopRestrictionWarning() { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(0)) > 1 && Shop::getContext() == Shop::CONTEXT_GROUP) { $this->displayAdminWarning($this->l('You have chosen a group of shops, all the changes will be set for all shops in this group')); } if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(0)) > 1 && Shop::getContext() == Shop::CONTEXT_ALL) { $this->displayAdminWarning($this->l('You have chosen all shops, all the changes will be set for all shops')); } }
protected function getOptionFieldsSettings() { $cms_pages = array(); foreach ($this->cms_pages as $cms_page) { $cms_pages[$cms_page['config']] = array('type' => 'select', 'list' => $this->getCMSPages(), 'identifier' => 'id_cms', 'title' => $cms_page['title']); } $this->option_fields_settings = array(array('title' => $this->l('Global Settings'), 'info' => $this->l('Global Settings for all shops'), 'icon' => 'icon-globe', 'fields' => array('PS_EU_PAYMENT_API' => array('type' => 'bool', 'title' => $this->l('Legal Secure checkout for EU countries'), 'desc' => $this->l('Enable EU payment mode for payment modules. Note that it requires those modules to be specially designed.'), 'auto_value' => true, 'value' => Configuration::getGlobalValue('PS_EU_PAYMENT_API'), 'no_multishop_checkbox' => true)), 'submit' => array('title' => $this->l('Save global options'), 'name' => 'submitSaveOptions')), array('title' => $this->l('General Options'), 'info' => $this->l('General settings for your shop'), 'icon' => 'icon-cog', 'fields' => array('SHOPPING_CART_TEXT_BEFORE' => array('type' => 'textareaLang', 'title' => $this->l('Shopping cart text 1'), 'desc' => $this->l('This text is displayed before the shopping cart block.')), 'SHOPPING_CART_TEXT_AFTER' => array('type' => 'textareaLang', 'title' => $this->l('Shopping cart text 2'), 'desc' => $this->l('This text is displayed after the shopping cart block.')), 'LEGAL_SHIPTAXMETH' => array('type' => 'bool', 'title' => $this->l('Shipping tax method'), 'desc' => $this->l('Calculates the average tax of all products for shipping instead of a fixed tax value.')), 'LEGAL_DELIVERY_NOW' => array('type' => 'textLang', 'title' => $this->l('Availabiliy "in stock"'), 'desc' => $this->l('Displayed text when in-stock default value. E.g.') . ' ' . $this->deliveryNowDefault), 'LEGAL_DELIVERY_LATER' => array('type' => 'textLang', 'title' => $this->l('Availabiliy "back-ordered"'), 'desc' => $this->l('Displayed text when allowed to be back-ordered default value. E.g.') . ' ' . $this->deliveryLaterDefault), 'LEGAL_SHOW_WEIGHTS' => array('type' => 'bool', 'title' => $this->l('Show product weights'), 'desc' => $this->l('Shows the product weights at your product if weight higher than zero.')), 'LEGAL_SHOW_FANCY' => array('type' => 'bool', 'title' => $this->l('Show fancybox excl. shipping'), 'desc' => $this->l('Shows a fancybox on the excl. shipping links.'))), 'submit' => array('title' => $this->l('Save general options'), 'name' => 'submitSaveOptions')), array('title' => $this->l('CMS Pages'), 'info' => $this->l('Assign your CMS pages. Below you can add cms templates to your shop if they dont exists.'), 'icon' => 'icon-pencil', 'fields' => $cms_pages, 'buttons' => array(array('title' => $this->l('Add CMS Pages'), 'name' => 'submitAddCMSPages', 'type' => 'submit', 'icon' => 'process-icon-plus')), 'submit' => array('title' => $this->l('Save CMS assignment'), 'name' => 'submitSaveOptions'))); }
public function getContent() { global $cookie; $message = ''; if (Tools::isSubmit('SubmitFilter')) { if (!Tools::getValue('layered_tpl_name')) { $message = $this->displayError($this->l('Filter template name required (cannot be empty)')); } elseif (!Tools::getValue('categoryBox')) { $message = $this->displayError($this->l('You must select at least one category.')); } else { if (Tools::getValue('id_layered_filter')) { Db::getInstance()->execute(' DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter')); $this->buildLayeredCategories(); } if (Tools::getValue('scope') == 1) { Db::getInstance()->execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'layered_filter'); $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT id_category FROM ' . _DB_PREFIX_ . 'category'); foreach ($categories as $category) { $_POST['categoryBox'][] = (int) $category['id_category']; } } $id_layered_filter = (int) Tools::getValue('id_layered_filter'); if (!$id_layered_filter) { $id_layered_filter = (int) Db::getInstance()->Insert_ID(); } $shop_list = array(); if (isset($_POST['checkBoxShopAsso_layered_filter'])) { foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_shop => $row) { $assos[] = array('id_object' => (int) $id_layered_filter, 'id_shop' => (int) $id_shop); $shop_list[] = (int) $id_shop; } } else { $shop_list = array(Context::getContext()->shop->id); } Db::getInstance()->execute(' DELETE FROM ' . _DB_PREFIX_ . 'layered_filter_shop WHERE `id_layered_filter` = ' . (int) $id_layered_filter); if (count($_POST['categoryBox'])) { /* Clean categoryBox before use */ if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) { foreach ($_POST['categoryBox'] as &$category_box_tmp) { $category_box_tmp = (int) $category_box_tmp; } } $filter_values = array(); foreach ($_POST['categoryBox'] as $idc) { $filter_values['categories'][] = (int) $idc; } $filter_values['shop_list'] = $shop_list; $values = false; foreach ($_POST['categoryBox'] as $id_category_layered) { foreach ($_POST as $key => $value) { if (substr($key, 0, 17) == 'layered_selection' && $value == 'on') { $values = true; $type = 0; $limit = 0; if (Tools::getValue($key . '_filter_type')) { $type = Tools::getValue($key . '_filter_type'); } if (Tools::getValue($key . '_filter_show_limit')) { $limit = Tools::getValue($key . '_filter_show_limit'); } $filter_values[$key] = array('filter_type' => (int) $type, 'filter_show_limit' => (int) $limit); } } } $values_to_insert = array('name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filter_values)), 'n_categories' => (int) count($filter_values['categories']), 'date_add' => date('Y-m-d H:i:s')); if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) { $values_to_insert['id_layered_filter'] = (int) Tools::getValue('id_layered_filter'); } Db::getInstance()->autoExecute(_DB_PREFIX_ . 'layered_filter', $values_to_insert, 'INSERT'); $id_layered_filter = (int) Db::getInstance()->Insert_ID(); if (isset($assos)) { foreach ($assos as $asso) { Db::getInstance()->execute(' INSERT INTO ' . _DB_PREFIX_ . 'layered_filter_shop (`id_layered_filter`, `id_shop`) VALUES(' . $id_layered_filter . ', ' . (int) $asso['id_shop'] . ')'); } } $this->buildLayeredCategories(); $message = $this->displayConfirmation($this->l('Your filter') . ' "' . Tools::safeOutput(Tools::getValue('layered_tpl_name')) . '" ' . (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'] ? $this->l('was updated successfully.') : $this->l('was added successfully.'))); } } } else { if (Tools::isSubmit('submitLayeredSettings')) { Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', (int) Tools::getValue('ps_layered_hide_0_values')); Configuration::updateValue('PS_LAYERED_SHOW_QTIES', (int) Tools::getValue('ps_layered_show_qties')); Configuration::updateValue('PS_LAYERED_FULL_TREE', (int) Tools::getValue('ps_layered_full_tree')); Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', (int) Tools::getValue('ps_layered_filter_price_usetax')); Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int) Tools::getValue('ps_layered_filter_category_depth')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', (int) Tools::getValue('ps_layered_filter_index_availability')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', (int) Tools::getValue('ps_layered_filter_index_condition')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', (int) Tools::getValue('ps_layered_filter_index_manufacturer')); Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', (int) Tools::getValue('ps_layered_filter_index_category')); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $message = '<div class="alert alert-success">' . $this->l('Settings saved successfully') . '</div>'; } else { $message = '<div class="conf">' . $this->l('Settings saved successfully') . '</div>'; } } else { if (Tools::getValue('deleteFilterTemplate')) { $layered_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT filters FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter')); if ($layered_values) { Db::getInstance()->execute(' DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter') . ' LIMIT 1'); $this->buildLayeredCategories(); $message = $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).')); } else { $message = $this->displayError($this->l('Filter template not found')); } } } } $category_box = array(); $attribute_groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n FROM ' . _DB_PREFIX_ . 'attribute_group ag LEFT JOIN ' . _DB_PREFIX_ . 'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group) LEFT JOIN ' . _DB_PREFIX_ . 'attribute a ON (a.id_attribute_group = ag.id_attribute_group) WHERE agl.id_lang = ' . (int) $cookie->id_lang . ' GROUP BY ag.id_attribute_group'); $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT fl.id_feature, fl.name, COUNT(DISTINCT(fv.id_feature_value)) n FROM ' . _DB_PREFIX_ . 'feature_lang fl LEFT JOIN ' . _DB_PREFIX_ . 'feature_value fv ON (fv.id_feature = fl.id_feature) WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = ' . (int) $cookie->id_lang . ' GROUP BY fl.id_feature'); if (Shop::isFeatureActive() && count(Shop::getShops(true, null, true)) > 1) { $helper = new HelperForm(); $helper->id = Tools::getValue('id_layered_filter', null); $helper->table = 'layered_filter'; $helper->identifier = 'id_layered_filter'; $this->context->smarty->assign('asso_shops', $helper->renderAssoShop()); } if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $tree_categories_helper = new HelperTreeCategories('categories-treeview'); $tree_categories_helper->setRootCategory(Shop::getContext() == Shop::CONTEXT_SHOP ? Category::getRootCategory()->id_category : 0)->setUseCheckBox(true); } else { if (Shop::getContext() == Shop::CONTEXT_SHOP) { $root_category = Category::getRootCategory(); $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name); } else { $root_category = array('id_category' => '0', 'name' => $this->l('Root')); } $tree_categories_helper = new Helper(); } $module_url = Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . $this->getPathUri(); if (method_exists($this->context->controller, 'addJquery')) { $this->context->controller->addJS($this->_path . 'js/blocklayered_admin.js'); if (version_compare(_PS_VERSION_, '1.6.0.3', '>=') === true) { $this->context->controller->addjqueryPlugin('sortable'); } elseif (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $this->context->controller->addJS(_PS_JS_DIR_ . 'jquery/plugins/jquery.sortable.js'); } else { $this->context->controller->addJS($this->_path . 'js/jquery.sortable.js'); } } if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $this->context->controller->addCSS($this->_path . 'css/blocklayered_admin_1.6.css'); } else { $this->context->controller->addCSS($this->_path . 'css/blocklayered_admin.css'); } if (Tools::getValue('add_new_filters_template')) { $this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => 0, 'template_name' => sprintf($this->l('My template - %s'), date('Y-m-d')), 'attribute_groups' => $attribute_groups, 'features' => $features, 'total_filters' => 6 + count($attribute_groups) + count($features))); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $this->context->smarty->assign('categories_tree', $tree_categories_helper->render()); } else { $this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, array(), 'categoryBox')); } if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl'); } else { return $this->display(__FILE__, 'views/templates/admin/add.tpl'); } } else { if (Tools::getValue('edit_filters_template')) { $template = Db::getInstance()->getRow(' SELECT * FROM `' . _DB_PREFIX_ . 'layered_filter` WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter')); $filters = unserialize($template['filters']); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { $tree_categories_helper->setSelectedCategories($filters['categories']); $this->context->smarty->assign('categories_tree', $tree_categories_helper->render()); } else { $this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, $filters['categories'], 'categoryBox')); } $select_shops = $filters['shop_list']; unset($filters['categories']); unset($filters['shop_list']); $this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => (int) Tools::getValue('id_layered_filter'), 'template_name' => $template['name'], 'attribute_groups' => $attribute_groups, 'features' => $features, 'filters' => Tools::jsonEncode($filters), 'total_filters' => 6 + count($attribute_groups) + count($features))); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl'); } else { return $this->display(__FILE__, 'views/templates/admin/add.tpl'); } } else { $this->context->smarty->assign(array('message' => $message, 'uri' => $this->getPathUri(), 'PS_LAYERED_INDEXED' => Configuration::getGlobalValue('PS_LAYERED_INDEXED'), 'current_url' => Tools::safeOutput(preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI'])), 'id_lang' => Context::getContext()->cookie->id_lang, 'token' => substr(Tools::encrypt('blocklayered/index'), 0, 10), 'base_folder' => urlencode(_PS_ADMIN_DIR_), 'price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'full_price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1', 'attribute_indexer_url' => $module_url . 'blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'url_indexer_url' => $module_url . 'blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1', 'filters_templates' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC'), 'hide_values' => Configuration::get('PS_LAYERED_HIDE_0_VALUES'), 'show_quantities' => Configuration::get('PS_LAYERED_SHOW_QTIES'), 'full_tree' => Configuration::get('PS_LAYERED_FULL_TREE'), 'category_depth' => Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH'), 'price_use_tax' => Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX'), 'index_cdt' => Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'), 'index_qty' => Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'), 'index_mnf' => Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'), 'index_cat' => Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'), 'limit_warning' => $this->displayLimitPostWarning(21 + count($attribute_groups) * 3 + count($features) * 3))); if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) { return $this->display(__FILE__, 'views/templates/admin/view_1.6.tpl'); } else { return $this->display(__FILE__, 'views/templates/admin/view.tpl'); } } } }
public function hookActionProductCoverage($params) { // if not advanced stock management, nothing to do if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { return; } // retrieves informations $id_product = (int) $params['id_product']; $id_product_attribute = (int) $params['id_product_attribute']; $warehouse = $params['warehouse']; $product = new Product($id_product); if (!Validate::isLoadedObject($product)) { return; } if (!$product->advanced_stock_management) { return; } // sets warehouse id to get the coverage if (!Validate::isLoadedObject($warehouse)) { $id_warehouse = 0; } else { $id_warehouse = (int) $warehouse->id; } // coverage of the product $warning_coverage = (int) Configuration::getGlobalValue('MA_PRODUCT_COVERAGE'); $coverage = StockManagerFactory::getManager()->getProductCoverage($id_product, $id_product_attribute, $warning_coverage, $id_warehouse); // if we need to send a notification if ($product->active == 1 && $coverage < $warning_coverage && !empty($this->merchant_mails) && Configuration::getGlobalValue('MA_MERCHANT_COVERAGE')) { $context = Context::getContext(); $id_lang = (int) $context->language->id; $id_shop = (int) $context->shop->id; $iso = Language::getIsoById($id_lang); $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); $template_vars = array('{current_coverage}' => $coverage, '{warning_coverage}' => $warning_coverage, '{product}' => pSQL($product_name)); if (file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productcoverage.txt') && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productcoverage.html')) { // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients $merchant_mails = explode(self::__MA_MAIL_DELIMITOR__, $this->merchant_mails); foreach ($merchant_mails as $merchant_mail) { Mail::Send($id_lang, 'productcoverage', Mail::l('Stock coverage', $id_lang), $template_vars, $merchant_mail, null, (string) Configuration::get('PS_SHOP_EMAIL'), (string) Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/mails/', null, $id_shop); } } } }
/** * Get the value of a persistent variable stored in the ecommerce platform * @param name the name of the variable * @return the value of the variable */ public function get($name) { return Configuration::getGlobalValue('JIRAFE_' . strtoupper($name)); }
protected function _showRating($show = false) { $dismiss = (int) (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Configuration::getGlobalValue('PM_' . self::$_module_prefix . '_DISMISS_RATING') : Configuration::get('PM_' . self::$_module_prefix . '_DISMISS_RATING')); if ($show && $dismiss != 1 && self::_getNbDaysModuleUsage() >= 3) { $this->_html .= ' <div id="addons-rating-container" class="ui-widget note"> <div style="margin-top: 20px; margin-bottom: 20px; padding: 0 .7em; text-align: center;" class="ui-state-highlight ui-corner-all"> <p class="invite">' . $this->l('You are satisfied with our module and want to encourage us to add new features ?', $this->_coreClassName) . '<br/>' . '<a href="http://addons.prestashop.com/ratings.php" target="_blank"><strong>' . $this->l('Please rate it on Prestashop Addons, and give us 5 stars !', $this->_coreClassName) . '</strong></a> </p> <p class="dismiss">' . '[<a href="javascript:void(0);">' . $this->l('No thanks, I don\'t want to help you. Close this dialog.', $this->_coreClassName) . '</a>] </p> </div> </div>'; } }
public static function getPickupCentersBySellerId($id_seller, $id_lang) { ${${"GLOBALS"}["dnlppobwfek"]} = (int) Configuration::getGlobalValue("AGILE_PICKUPCENTER_CARRIER_ID"); $liklefvxryhn = "id_carrier"; $njiypnghv = "sql"; ${$njiypnghv} = "Select l.id_location, l.id_carrier, c.name as carrier,l.location, l.active,l.address1,l.postcode,l.city,cl.name as country \n\t\t\tfrom " . _DB_PREFIX_ . "location l " . "INNER JOIN " . _DB_PREFIX_ . "carrier c on c.id_carrier=l.id_carrier " . "LEFT JOIN " . _DB_PREFIX_ . "country_lang cl ON (l.id_country = cl.id_country AND cl.id_lang = " . (int) ${${"GLOBALS"}["fnpaxtnrne"]} . " ) WHERE l.deleted = 0 AND l.id_seller = " . (int) ${${"GLOBALS"}["tpubctvvlkrd"]} . " AND l.id_carrier = " . ${$liklefvxryhn}; return Db::getInstance()->executeS(${${"GLOBALS"}["iikyewhoyyrc"]}); }
public static function update_global_value($key, $status, $successMsg, $errMsg, $leftMsg) { $curStatus = Configuration::getGlobalValue($key); if ($status == $curStatus) { echo "Success: {$leftMsg}\n"; return true; } if (Configuration::updateGlobalValue($key, $status)) { echo "Success: {$successMsg}\n"; return true; } else { echo "Error: {$errMsg}\n"; return false; } }
protected function updateCategoryReduction() { $category_reduction = Tools::getValue('category_reduction'); Db::getInstance()->execute(' DELETE FROM `' . _DB_PREFIX_ . 'group_reduction` WHERE `id_group` = ' . (int) Tools::getValue('id_group')); Db::getInstance()->execute(' DELETE FROM `' . _DB_PREFIX_ . 'product_group_reduction_cache` WHERE `id_group` = ' . (int) Tools::getValue('id_group')); if (is_array($category_reduction) && count($category_reduction)) { if (!Configuration::getGlobalValue('PS_GROUP_FEATURE_ACTIVE')) { Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', 1); } foreach ($category_reduction as $cat => $reduction) { if (!Validate::isUnsignedId($cat) || !$this->validateDiscount($reduction)) { $this->errors[] = Tools::displayError('The discount value is incorrect.'); } else { $category = new Category((int) $cat); $category->addGroupsIfNoExist((int) Tools::getValue('id_group')); $group_reduction = new GroupReduction(); $group_reduction->id_group = (int) Tools::getValue('id_group'); $group_reduction->reduction = (double) ($reduction / 100); $group_reduction->id_category = (int) $cat; if (!$group_reduction->save()) { $this->errors[] = Tools::displayError('You cannot save group reductions.'); } } } } }
public static function getPickupCentersBySellerId($id_seller, $id_lang) { ${${"GLOBALS"}["ocknvlib"]} = (int) Configuration::getGlobalValue("AGILE_PICKUPCENTER_CARRIER_ID"); ${"GLOBALS"}["vcxuryx"] = "id_lang"; $csgrwhrjfes = "id_seller"; $iqifemnv = "sql"; ${$iqifemnv} = "Select l.id_location, l.id_carrier, c.name as carrier,l.location, l.active,l.address1,l.postcode,l.city,cl.name as country \n\t\t\tfrom " . _DB_PREFIX_ . "location l " . "INNER JOIN " . _DB_PREFIX_ . "carrier c on c.id_carrier=l.id_carrier " . "LEFT JOIN " . _DB_PREFIX_ . "country_lang cl ON (l.id_country = cl.id_country AND cl.id_lang = " . (int) ${${"GLOBALS"}["vcxuryx"]} . " ) WHERE l.deleted = 0 AND l.id_seller = " . (int) ${$csgrwhrjfes} . " AND l.id_carrier = " . ${${"GLOBALS"}["ocknvlib"]}; $fltiiik = "sql"; return Db::getInstance()->executeS(${$fltiiik}); }
public static function getPSMId($module) { $key = 'PSM_ID_' . Tools::strtoupper($module->name); if (!isset(self::$s_cache[$key])) { self::$s_cache[$key] = Configuration::getGlobalValue($key); if (self::$s_cache[$key] === false) { self::$s_cache[$key] = ''; for ($i = 0; $i < 3; $i++) { self::$s_cache[$key] .= Tools::passwdGen(4, 'NUMERIC') . '-'; } self::$s_cache[$key] .= Tools::passwdGen(4, 'NUMERIC'); Configuration::updateGlobalValue($key, self::$s_cache[$key]); } } return self::$s_cache[$key]; }
public function renderList() { $this->toolbar_title = $this->l('Products list'); if (Tools::isSubmit('id_display')) { self::$currentIndex .= '&id_display=' . (int) Tools::getValue('id_display'); } if (Tools::isSubmit('id_warehouse') && Tools::getValue('id_warehouse') != '-1') { self::$currentIndex .= '&id_warehouse=' . (int) Tools::getValue('id_warehouse'); } if (Tools::isSubmit('areaFilter')) { self::$currentIndex .= '&areaFilter=' . Tools::getValue('areaFilter'); } if (Tools::isSubmit('subareaFilter')) { self::$currentIndex .= '&subareaFilter=' . Tools::getValue('subareaFilter'); } if (Tools::isSubmit('id_category') && Tools::getValue('id_category') != '-1') { self::$currentIndex .= '&id_category=' . (int) Tools::getValue('id_category'); } if (Tools::isSubmit('id_supplier') && Tools::getValue('id_supplier') != '-1') { self::$currentIndex .= '&id_supplier=' . (int) Tools::getValue('id_supplier'); } if (Tools::isSubmit('id_manufacturer') && Tools::getValue('id_manufacturer') != '-1') { self::$currentIndex .= '&id_manufacturer=' . (int) Tools::getValue('id_manufacturer'); } // Get display type $id_display = $this->getCurrentValue('id_display'); // qubquery : return the first provider reference for principal product $this->_select = ' cl.name as category_name, i.id_image, a.id_product as mvt_reason, area.name as area_name, sub_area.name as sub_area_name, wpl.location as location, a.id_product as new_quantity, ( SELECT ps.product_supplier_reference FROM ' . _DB_PREFIX_ . 'product_supplier ps WHERE ps.id_product = a.id_product AND ps.id_product_attribute = 0 LIMIT 1 )as first_supplier_ref, ( EXISTS(SELECT pa.id_product FROM ' . _DB_PREFIX_ . 'product_attribute pa WHERE pa.id_product = a.id_product LIMIT 1) ) as have_attribute, '; $this->_join = ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (pa.id_product = a.id_product)' . 'INNER JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (a.id_product = pl.id_product AND pl.id_lang = ' . (int) $this->context->language->id . ') INNER JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (a.id_category_default = cl.id_category AND cl.id_lang = ' . (int) $this->context->language->id . ') LEFT JOIN ' . _DB_PREFIX_ . 'image i ON a.id_product = i.id_product '; $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'warehouse_product_location wpl ON (wpl.id_product = a.id_product AND wpl.id_product_attribute = IFNULL(pa.id_product_attribute, 0))'; $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'erpip_warehouse_product_location ewpl ON wpl.id_warehouse_product_location = ewpl.id_warehouse_product_location '; $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'erpip_zone area ON area.id_erpip_zone = ewpl.id_zone_parent '; $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'erpip_zone sub_area ON sub_area.id_erpip_zone = ewpl.id_zone '; // Render 1 : mix products and declination to sort by area if ($id_display == 1) { $this->_select .= 'IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(DISTINCT agl.`name`, \' - \', al.name SEPARATOR \', \')),pl.name) as product_name, IFNULL((CONCAT(a.id_product, ";", pa.id_product_attribute)), a.id_product) as id_product,'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON (pac.id_product_attribute = pa.id_product_attribute) LEFT JOIN `' . _DB_PREFIX_ . 'attribute` atr ON (atr.id_attribute = pac.id_attribute) LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = ' . (int) $this->context->language->id . ') LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = ' . (int) $this->context->language->id . ') '; } else { $this->_select .= 'pl.name as product_name,'; } $this->tpl_list_vars['advanced_stock_token'] = $this->advanced_stock_token; // FILTERS // Init filters variables $this->tpl_list_vars['id_category'] = -1; $this->tpl_list_vars['id_supplier'] = -1; $this->tpl_list_vars['id_manufacturer'] = -1; $this->tpl_list_vars['id_warehouse'] = -1; $this->tpl_list_vars['areaFilter'] = -1; $this->tpl_list_vars['subareaFilter'] = -1; $this->tpl_list_vars['id_display'] = 0; // Add additional filters $this->tpl_list_vars['warehouses'] = Warehouse::getWarehouses(); $this->tpl_list_vars['categories'] = Category::getSimpleCategories((int) $this->context->language->id); $this->tpl_list_vars['suppliers'] = Supplier::getSuppliers(); $this->tpl_list_vars['manufacturers'] = Manufacturer::getManufacturers(); $this->tpl_list_vars['controller_status'] = $this->controller_status; // Get inventory containers $this->tpl_list_vars['containers'] = ErpInventory::getContainers(); // get conf stock gap $this->tpl_list_vars['gap_stock'] = Configuration::getGlobalValue('ERP_GAP_STOCK'); require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php'; $this->tpl_list_vars['erp_feature'] = ErpFeature::getFeaturesWithToken($this->context->language->iso_code); $this->tpl_list_vars['template_path'] = $this->template_path; // get default inventory reasons if ($this->context->language->iso_code == 'fr') { $this->tpl_list_vars['reason_increase'] = ErpStockMvtReason::existsByName('Augmentation d\'inventaire'); $this->tpl_list_vars['reason_decrease'] = ErpStockMvtReason::existsByName('Diminution d\'inventaire'); } else { $this->tpl_list_vars['reason_increase'] = ErpStockMvtReason::existsByName('Increase of inventory'); $this->tpl_list_vars['reason_decrease'] = ErpStockMvtReason::existsByName('Decrease of inventory'); } // specify advanced stock manager or not if ($this->advanced_stock_management) { // Get the selected warehouse, if there's not, get the first one if (($id_warehouse = $this->getCurrentValue('id_warehouse')) == false) { $id_warehouse = $this->getCookie('id_warehouse'); $this->tpl_list_vars['id_warehouse'] = $id_warehouse; } // filters warehouse location $area = $this->getCurrentValue('areaFilter'); $subarea = $this->getCurrentValue('subareaFilter'); $this->tpl_list_vars['areas'] = ErpZone::getZonesName($id_warehouse); $this->tpl_list_vars['sub_areas'] = $area ? ErpZone::getZonesName($id_warehouse, 'sub_area', $area) : array(); // if an area AND an under area are specified, we filter the area and the under area for the specified area if ($area != false && $subarea != false) { $this->_where .= ' AND wpl.id_warehouse = ' . (int) $id_warehouse . ' AND area.id_erpip_zone = "' . (int) $area . '" AND sub_area.id_erpip_zone = ' . (int) $subarea; $this->_group = 'GROUP BY a.id_product'; } elseif ($area != false) { $this->_where .= ' AND wpl.id_warehouse=' . (int) $id_warehouse . ' AND area.id_erpip_zone = ' . (int) $area; //$this->_where .= ' AND area.id_erpip_zone = '.(int)$area; if ($id_display == 1) { $this->_group = 'GROUP BY a.id_product, pa.id_product_attribute'; } else { $this->_group = 'GROUP BY a.id_product'; } } else { $this->_where .= ' AND wpl.id_warehouse = ' . (int) $id_warehouse; if ($id_display == 1) { $this->_group = 'GROUP BY a.id_product, pa.id_product_attribute'; } else { $this->_group = 'GROUP BY a.id_product'; } } } else { if ($id_display == 1) { $this->_group = 'GROUP BY a.id_product, pa.id_product_attribute'; } else { $this->_group = 'GROUP BY a.id_product'; } } // filter the query with applied filters //category filter if (($id_category = $this->getCurrentValue('id_category')) != false) { $this->_where .= ' AND a.id_product IN ( SELECT cp.id_product FROM ' . _DB_PREFIX_ . 'category_product cp WHERE cp.id_category = ' . (int) $id_category . ' )'; } // provider filter if (($id_supplier = $this->getCurrentValue('id_supplier')) != false) { $this->_where .= ' AND a.id_product IN ( SELECT ps.id_product FROM ' . _DB_PREFIX_ . 'product_supplier ps WHERE ps.id_supplier = ' . (int) $id_supplier . ' )'; } // Brand filter if (($id_manufacturer = $this->getCurrentValue('id_manufacturer')) != false) { $this->_where .= ' AND a.id_manufacturer = ' . (int) $id_manufacturer; } $this->displayInformation($this->l('Be careful, if you are using advanced [respectively simple] stock management, only products using advanced [respectively simple] stock management will be exported.')); $this->displayInformation($this->l('In advanced sotck managment, products that are not stocked in a warehouse will not appear.')); // Show information or confirm message / error at the end of the inventory /*switch(Tools::getValue('submitFilterproduct')) { case 0: $this->displayInformation($this->l('New inventory')); break; case 1: $this->confirmations[] = $this->l('Inventory completed'); break; case 2: $this->errors[] = Tools::displayError('There has been a problem while handling products'); break; default: $this->displayInformation($this->l('New inventory')); break; }*/ // Add plugin simple tooltip $this->addJqueryPlugin('cluetip', _MODULE_DIR_ . 'erpillicopresta/js/cluetip/'); // add jquery dialog $this->addJqueryUI('ui.dialog'); // add plugin validity $this->addJqueryPlugin('validity.min', _MODULE_DIR_ . 'erpillicopresta/js/validity/'); // Load JS $this->addJS(_MODULE_DIR_ . 'erpillicopresta/js/inventory_tools.js'); $this->addJS(_MODULE_DIR_ . 'erpillicopresta/js/inventory.js'); // Load CSS $this->addCSS(_MODULE_DIR_ . 'erpillicopresta/css/jquery.validity.css'); $this->addCSS(_MODULE_DIR_ . 'erpillicopresta/css/jquery.cluetip.css'); $list = parent::renderList(); return $list; }