filter obsolete rules "paniers abandonnés" and "parrainage" in admin cart rules form
This commit is contained in:
parent
b6eb40a22b
commit
204e699b3f
@ -79,25 +79,25 @@
|
||||
<div class="col-lg-7">
|
||||
<p class="radio">
|
||||
<label for="apply_discount_to_order">
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_order" value="order"{if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == 0} checked="checked"{/if} />
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_order" value="order" {if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == 0} checked="checked"{/if} />
|
||||
{l s='Order (without shipping)'}
|
||||
</label>
|
||||
</p>
|
||||
<p class="radio">
|
||||
<label for="apply_discount_to_product">
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_product" value="specific"{if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval > 0} checked="checked"{/if} />
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_product" value="specific" {if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval > 0} checked="checked"{/if} />
|
||||
{l s='Specific product'}
|
||||
</label>
|
||||
</p>
|
||||
<p class="radio">
|
||||
<label for="apply_discount_to_cheapest">
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_cheapest" value="cheapest"{if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == -1} checked="checked"{/if} />
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_cheapest" value="cheapest" {if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == -1} checked="checked"{/if} />
|
||||
{l s='Cheapest product'}
|
||||
</label>
|
||||
</p>
|
||||
<p class="radio">
|
||||
<label for="apply_discount_to_selection">
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_selection" value="selection"{if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == -2} checked="checked"{/if}{if $product_rule_groups|@count == 0}disabled="disabled"{/if} />
|
||||
<input type="radio" name="apply_discount_to" id="apply_discount_to_selection" value="selection" {if $currentTab->getFieldValue($currentObject, 'reduction_product')|intval == -2} checked="checked"{/if}{if $product_rule_groups|@count == 0}disabled="disabled"{/if} />
|
||||
{l s='Selected product(s)'}{if $product_rule_groups|@count == 0} <span id="apply_discount_to_selection_warning" class="text-muted clearfix"><i class="icon-warning-sign"></i> <a href="#" id="apply_discount_to_selection_shortcut">{l s='You must select some products before'}</a></span>{/if}
|
||||
</label>
|
||||
</p>
|
||||
|
@ -486,4 +486,50 @@ class CartRule extends CartRuleCore
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getCartRuleCombinations()
|
||||
{
|
||||
$date_max = new DateTime('last month');
|
||||
|
||||
$array = array();
|
||||
$array['selected'] = Db::getInstance()->executeS('
|
||||
SELECT cr.*, crl.*, 1 as selected
|
||||
FROM '._DB_PREFIX_.'cart_rule cr
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)Context::getContext()->language->id.')
|
||||
WHERE cr.id_cart_rule != '.(int)$this->id.'
|
||||
AND (
|
||||
cr.cart_rule_restriction = 0
|
||||
OR cr.id_cart_rule IN (
|
||||
SELECT IF(id_cart_rule_1 = '.(int)$this->id.', id_cart_rule_2, id_cart_rule_1)
|
||||
FROM '._DB_PREFIX_.'cart_rule_combination
|
||||
WHERE '.(int)$this->id.' = id_cart_rule_1
|
||||
OR '.(int)$this->id.' = id_cart_rule_2
|
||||
)
|
||||
)
|
||||
AND (
|
||||
cr.id_cart_rule NOT IN (
|
||||
SELECT cr.`id_cart_rule`
|
||||
FROM `'._DB_PREFIX_.'cart_rule` cr
|
||||
JOIN `'._DB_PREFIX_.'cart_rule_lang` crl ON crl.`id_cart_rule` = cr.`id_cart_rule`
|
||||
WHERE
|
||||
(crl.`name` LIKE \'%panier abandon%\' OR crl.`name` LIKE \'%parrainage%\')
|
||||
AND cr.`date_to` < \''.$date_max->format('Y-m-d').'\'
|
||||
ORDER BY cr.`date_to` DESC
|
||||
)
|
||||
)
|
||||
');
|
||||
|
||||
$array['unselected'] = Db::getInstance()->executeS('
|
||||
SELECT cr.*, crl.*, 1 as selected
|
||||
FROM '._DB_PREFIX_.'cart_rule cr
|
||||
INNER JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)Context::getContext()->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_combination crc1 ON (cr.id_cart_rule = crc1.id_cart_rule_1 AND crc1.id_cart_rule_2 = '.(int)$this->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_combination crc2 ON (cr.id_cart_rule = crc2.id_cart_rule_2 AND crc2.id_cart_rule_1 = '.(int)$this->id.')
|
||||
WHERE cr.cart_rule_restriction = 1
|
||||
AND cr.id_cart_rule != '.(int)$this->id.'
|
||||
AND crc1.id_cart_rule_1 IS NULL
|
||||
AND crc2.id_cart_rule_1 IS NULL');
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user