Add translations for OmniPrice module in French and Italian, and update upgrade scripts
- Added French translations for the OmniPrice module (fr.php). - Added Italian translations for the OmniPrice module (it.php). - Created empty Dutch translation file (nl.php). - Implemented upgrade script for version 1.1.11 to update configuration for showing real discount. - Implemented upgrade script for version 1.2.0 to update configuration for indexing inactive products. - Implemented upgrade script for version 1.2.3 to update configuration for ignoring non-EU countries.
This commit is contained in:
126
modules/gm_omniprice/controllers/front/cron.php
Normal file
126
modules/gm_omniprice/controllers/front/cron.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
class Gm_OmniPriceCronModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
$this->displayTemplate();
|
||||
$token = Tools::getValue('token');
|
||||
$omni = $this->module;
|
||||
$comparedToken = $omni->getTokenForScripts();
|
||||
if ($token != $comparedToken) {
|
||||
die('invalid token');
|
||||
}
|
||||
$action = Tools::getValue('action');
|
||||
$verbose = !Tools::isSubmit('silent');
|
||||
switch ($action) {
|
||||
case 'index' :
|
||||
$start = microtime(true);
|
||||
echo 'PS '._PS_VERSION_.'<br/>';
|
||||
echo 'OmniPrice '.$omni->version.'<br/>';
|
||||
if (Tools::isSubmit('reset')) {
|
||||
$omni->resetIndex();
|
||||
echo 'RESET</br>';
|
||||
}
|
||||
$productId = null;
|
||||
if (Tools::isSubmit('pid')) {
|
||||
$productId = (int) Tools::getValue('pid');
|
||||
$omni->removeProductFromTodaysIndex($productId);
|
||||
$omni->removeProductFromTodaysHistory($productId);
|
||||
}
|
||||
$omni->savePrices(true, $productId);
|
||||
echo 'FINISH<br/>';
|
||||
if (Tools::isSubmit('debug')) {
|
||||
echo 'DEBUG:<br/>';
|
||||
$debug = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'gm_omniprice_history` WHERE `id_product` = '.$productId);
|
||||
if ($debug) {
|
||||
echo $omni->displayTable($debug, array_keys($debug[0]));
|
||||
}
|
||||
$debug = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'gm_omniprice_cache` WHERE `id_product` = '.$productId);
|
||||
if ($debug) {
|
||||
echo $omni->displayTable($debug, array_keys($debug[0]));
|
||||
}
|
||||
}
|
||||
$timeElapsedSeconds = microtime(true) - $start;
|
||||
echo round($timeElapsedSeconds, 4).' s<br/>';
|
||||
break;
|
||||
case 'cleanup' :
|
||||
$omni->cleanUp($verbose);
|
||||
echo 'FINISH<br/>';
|
||||
break;
|
||||
case 'fill' :
|
||||
$omni->fillMissingCache($verbose);
|
||||
echo 'FINISH<br/>';
|
||||
break;
|
||||
default:
|
||||
echo $omni->l('Unknown action').'<br/>';
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
protected function displayTemplate()
|
||||
{
|
||||
echo '<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
.alert {
|
||||
position: relative;
|
||||
padding: 0.75rem 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.alert-success {
|
||||
color: #155724;
|
||||
background-color: #d4edda;
|
||||
border-color: #c3e6cb;
|
||||
}
|
||||
table {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.75rem;
|
||||
border: none!important;
|
||||
background: none;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table td, table th {
|
||||
padding: 0.375rem 0.75rem;
|
||||
vertical-align: middle;
|
||||
border: none;
|
||||
}
|
||||
table th {
|
||||
vertical-align: middle;
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
}
|
||||
table tr:nth-of-type(odd) {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
table tr:hover {
|
||||
color: #212529;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.alert {
|
||||
position: relative;
|
||||
padding: 0.75rem 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.alert-success {
|
||||
color: #155724;
|
||||
background-color: #d4edda;
|
||||
border-color: #c3e6cb;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">';
|
||||
}
|
||||
}
|
||||
35
modules/gm_omniprice/controllers/front/index.php
Normal file
35
modules/gm_omniprice/controllers/front/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user