[-] FO : Fix bug #PSCFV-8623 : Cart rule without code is applied automatically
This commit is contained in:
@@ -1079,12 +1079,12 @@ class CartRuleCore extends ObjectModel
|
||||
if (!CartRule::isFeatureActive() || !Validate::isLoadedObject($context->cart))
|
||||
return;
|
||||
|
||||
$result = Db::getInstance()->executeS('
|
||||
$sql = '
|
||||
SELECT cr.*
|
||||
FROM '._DB_PREFIX_.'cart_rule cr
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_shop crs ON cr.id_cart_rule = crs.id_cart_rule
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_carrier crca ON cr.id_cart_rule = crca.id_cart_rule
|
||||
'.($context->cart->id_carrier ? 'INNER JOIN '._DB_PREFIX_.'carrier c ON (c.id_reference = crca.id_carrier AND c.deleted = 0)' : '').'
|
||||
'.($context->cart->id_carrier ? 'LEFT JOIN '._DB_PREFIX_.'carrier c ON (c.id_reference = crca.id_carrier AND c.deleted = 0)' : '').'
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_country crco ON cr.id_cart_rule = crco.id_cart_rule
|
||||
WHERE cr.active = 1
|
||||
AND cr.code = ""
|
||||
@@ -1108,9 +1108,9 @@ class CartRuleCore extends ObjectModel
|
||||
'.($context->customer->id ? 'OR 0 < (
|
||||
SELECT cg.id_group
|
||||
FROM '._DB_PREFIX_.'customer_group cg
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON cg.id_group = crg.id_group
|
||||
LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON (cg.id_group = crg.id_group AND cg.id_group = '.(int)$context->customer->id_default_group.')
|
||||
WHERE cr.id_cart_rule = crg.id_cart_rule
|
||||
AND cg.id_customer = '.(int)$context->customer->id.' LIMIT 1
|
||||
AND cg.id_customer = '.(int)$context->customer->id.' LMIT 1
|
||||
)' : '').'
|
||||
)
|
||||
AND (
|
||||
@@ -1122,8 +1122,8 @@ class CartRuleCore extends ObjectModel
|
||||
)
|
||||
)
|
||||
AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.')
|
||||
ORDER BY priority');
|
||||
|
||||
ORDER BY priority';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
if ($result)
|
||||
{
|
||||
$cart_rules = ObjectModel::hydrateCollection('CartRule', $result);
|
||||
|
||||
@@ -116,8 +116,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
|
||||
</dl>
|
||||
{/if}
|
||||
<p {if $products}class="hidden"{/if} id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
|
||||
{if $discounts|@count > 0}
|
||||
<table id="vouchers">
|
||||
<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
|
||||
<tbody>
|
||||
{foreach from=$discounts item=discount}
|
||||
{if $discount.value_real > 0}
|
||||
@@ -132,11 +131,9 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<p id="cart-prices">
|
||||
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
|
||||
<span>{l s='Shipping' mod='blockcart'}</span>
|
||||
|
||||
@@ -116,27 +116,24 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
|
||||
</dl>
|
||||
{/if}
|
||||
<p class="cart_block_no_products{if $products} hidden{/if}" id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
|
||||
{if $discounts|@count > 0}
|
||||
<table id="vouchers">
|
||||
<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
|
||||
<tbody>
|
||||
{foreach from=$discounts item=discount}
|
||||
{if $discount.value_real > 0}
|
||||
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
|
||||
<td class="quantity">1x</td>
|
||||
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
|
||||
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
|
||||
<td class="delete">
|
||||
{if strlen($discount.code)}
|
||||
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach from=$discounts item=discount}
|
||||
{if $discount.value_real > 0}
|
||||
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
|
||||
<td class="quantity">1x</td>
|
||||
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
|
||||
<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
|
||||
<td class="delete">
|
||||
{if strlen($discount.code)}
|
||||
<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
<p id="cart-prices">
|
||||
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
|
||||
<span>{l s='Shipping' mod='blockcart'}</span>
|
||||
|
||||
Reference in New Issue
Block a user