Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
root 2017-04-27 10:35:36 +02:00
commit 890c0bede4
2 changed files with 17 additions and 5 deletions

View File

@ -30,14 +30,21 @@ class Catalog
public function setContent($version = 'fr')
{
$test_for_tomorrow = (int)Tools::getValue('tomorrow',0);
$sales_today = array();
$sales_last_day = array();
$sale_current = array();
$id_lang = (int) $this->versions[$version];
$sales_today = Sale::getSales(TRUE, NULL, NULL, 'today', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sales_last_day = Sale::getSales(TRUE, NULL, NULL, 'last', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sale_current = self::getSales(TRUE, NULL, NULL, 'forward', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
if($test_for_tomorrow) {
$sales_today = Sale::getSales(TRUE, NULL, NULL, 'tomorrow', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sales_last_day = Sale::getSales(TRUE, NULL, NULL, 'ended_tomorrow', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sale_current = self::getSales(TRUE, NULL, NULL, 'forward_tomorrow', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
} else {
$sales_today = Sale::getSales(TRUE, NULL, NULL, 'today', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sales_last_day = Sale::getSales(TRUE, NULL, NULL, 'last', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
$sale_current = self::getSales(TRUE, NULL, NULL, 'forward', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`position` DESC', NULL, NULL, $version);
}
foreach ($sales_today as &$sale) {
$sql = '
@ -407,6 +414,8 @@ class Catalog
$where[] = '`date_end` > NOW()';
} elseif($future === 'forward') {
$where[] = '`date_start` < NOW() AND `date_end` > NOW() AND forward_news = 1';
} elseif($future === 'forward_tomorrow') {
$where[] = '`date_start` < NOW() AND `date_end` > DATE_ADD(NOW(), INTERVAL 1 DAY) AND forward_news = 1';
} elseif($future === 'all') {
$where[] = ' 1 = 1';
} elseif ($future === 'today') {
@ -432,7 +441,6 @@ class Catalog
if($limit !== NULL) {
$query .= ' LIMIT '.$limit;
}
if($sales = Db::getInstance()->ExecuteS($query)) {
if($lite) {
foreach($sales AS $sale) {

View File

@ -1530,8 +1530,12 @@ class Sale {
$where[] = ' 1 = 1';
} elseif ($future === 'today') {
$where[] = 'CAST(`date_start` AS DATE) = CAST(NOW() AS DATE)';
} elseif ($future === 'tomorrow') {
$where[] = 'CAST(`date_start` AS DATE) = CAST(DATE_ADD(NOW(), INTERVAL 1 DAY) AS DATE)';
} elseif ($future === 'last') {
$where[] = 'CAST(`date_end` AS DATE) = CAST(NOW() AS DATE)';
} elseif ($future === 'ended_tomorrow') {
$where[] = 'CAST(`date_end` AS DATE) = CAST(DATE_ADD(NOW(), INTERVAL 1 DAY) AS DATE)';
} elseif(is_int($future)) {
$where[] = '(`date_start` > NOW() AND `date_start` < DATE_ADD(NOW(), INTERVAL '.$future.' DAY))';
} elseif($future === TRUE) {