Merge branch 'ticket-11557-FixLinkSaleCategory'
This commit is contained in:
commit
e71c932a21
@ -9,6 +9,7 @@ require_once(PS_ADMIN_DIR . '/helpers/HelperList.php');
|
||||
class AdminAntConfigurations extends AdminTab
|
||||
{
|
||||
public function postProcess() {
|
||||
global $cookie;
|
||||
if(Tools::isSubmit('submitProductSaleCache')) {
|
||||
$hour = (int) date('H');
|
||||
$min = (int) date('i');
|
||||
@ -38,6 +39,7 @@ class AdminAntConfigurations extends AdminTab
|
||||
WHERE p.`id_product` >= '.$min_id_product.'
|
||||
)
|
||||
');
|
||||
mail('marion@antadis.com', '[BBB] Re Associate products to sale', 'Date : '.date("d/m/Y H:i").' - Employee : '.$cookie->id_employee); // check for bad behaviour
|
||||
echo '<p class="conf">'.$this->l('Produits associés aux ventes depuis le produit #').$min_id_product.'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Pas de produit ajouté depuis 10 jours').'</p><br />';
|
||||
@ -45,6 +47,7 @@ class AdminAntConfigurations extends AdminTab
|
||||
}
|
||||
} elseif(Tools::isSubmit('submitCategorySaleCache')) {
|
||||
$id_sale = Tools::getValue('id_sale');
|
||||
mail('marion@antadis.com', '[BBB] Re Associate category to sale - buildCategoryCache', 'Date : '.date("d/m/Y H:i").' - Sale : '.$id_sale.' - Employee : '.$cookie->id_employee); // check for bad behaviour
|
||||
if($id_sale) {
|
||||
$sale = new Sale((int)$id_sale);
|
||||
$sale->buildCategoryCache();
|
||||
|
@ -1653,6 +1653,7 @@ class Sale {
|
||||
|
||||
public function buildCategoryCache() {
|
||||
$categories = Sale::flatRecurseCategory($this->id_category);
|
||||
mail('marion@antadis.com', '[BBB] Creation category - buildCategoryCache', http_build_query($categories,'',', ')); // check for bad behaviour
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'privatesale_category`
|
||||
WHERE `id_sale` = '.$this->id
|
||||
@ -1718,17 +1719,17 @@ class Sale {
|
||||
if ($this->id_category == 1) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'privatesale`
|
||||
SET `enabled` = 0
|
||||
WHERE `id_sale` = '.(int) $this->id.'
|
||||
LIMIT 1
|
||||
');
|
||||
|
||||
|
||||
// $this->enabled = FALSE;
|
||||
// $this->save();
|
||||
|
||||
|
||||
$categories = Sale::flatRecurseCategory($this->id_category);
|
||||
|
||||
$products = $this->getProducts();
|
||||
@ -1833,10 +1834,10 @@ class Sale {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the percentage or amount in a promotion string
|
||||
* Update the percentage or amount in a promotion string
|
||||
* for each sale with the maximum reduction percentage or amount
|
||||
* of its products.
|
||||
*
|
||||
*
|
||||
* @param string $date_day the sales starting day (to express in "Y-m-d")
|
||||
*/
|
||||
public static function updateSalesReductionAtDate()
|
||||
@ -1848,15 +1849,15 @@ class Sale {
|
||||
$sql = "SELECT MAX(sp.reduction) as reduc,
|
||||
s.id_sale, sf.value, sf.id_field, sf.id_lang
|
||||
FROM `"._DB_PREFIX_."specific_price` sp
|
||||
JOIN `"._DB_PREFIX_."category_product` cp
|
||||
JOIN `"._DB_PREFIX_."category_product` cp
|
||||
ON cp.id_product = sp.id_product
|
||||
JOIN `"._DB_PREFIX_."privatesale_category` psc
|
||||
JOIN `"._DB_PREFIX_."privatesale_category` psc
|
||||
ON psc.id_category = cp.id_category
|
||||
JOIN `"._DB_PREFIX_."privatesale` s
|
||||
ON s.id_sale = psc.id_sale
|
||||
JOIN `"._DB_PREFIX_."privatesale_extrafield_sale` sf
|
||||
ON sf.id_sale = s.id_sale
|
||||
WHERE
|
||||
WHERE
|
||||
sp.reduction_type='percentage'
|
||||
AND CAST(s.date_start AS DATE) = CAST(NOW() AS DATE)
|
||||
AND sf.id_field = ".$id_field."
|
||||
@ -1874,8 +1875,8 @@ class Sale {
|
||||
|
||||
$reduction_in_percent = round($result['reduc']*100);
|
||||
$new_value = preg_replace(
|
||||
'/\d+\s*%/',
|
||||
$reduction_in_percent."%",
|
||||
'/\d+\s*%/',
|
||||
$reduction_in_percent."%",
|
||||
$result['value']
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user