13013 - let product gift in cart when product belongs to a closed sale
This commit is contained in:
parent
5eb9da95b9
commit
fe9943a9c2
@ -996,7 +996,8 @@ class SaleCore extends ObjectModel{
|
||||
$sales = self::getSalesByIdProduct((int)$id_product);
|
||||
if (is_array($sales)) {
|
||||
foreach ($sales as $sale) {
|
||||
if ($sale instanceof SaleCore && !$sale->otherdelay) {
|
||||
if ($sale instanceof SaleCore && $sale->isOpen()) {
|
||||
if (!$sale->otherdelay) {
|
||||
if ($date_delivery === null) {
|
||||
$date_delivery = $sale->date_shipping;
|
||||
}
|
||||
@ -1010,6 +1011,7 @@ class SaleCore extends ObjectModel{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($delivery_date_range === self::DATE_RANGE_UNKNOWN &&
|
||||
$date_delivery !== null) {
|
||||
@ -1035,7 +1037,6 @@ class SaleCore extends ObjectModel{
|
||||
$date_range = SaleCore::DATE_RANGE_UNKNOWN;
|
||||
|
||||
$products = $cart->getProducts();
|
||||
|
||||
$sale = new SaleCore();
|
||||
|
||||
if (is_array($products)) {
|
||||
|
@ -468,9 +468,16 @@ class Privatesales extends Module {
|
||||
Tools::redirect( $url . (strpos($url, '?') ? '&' : '?' ) . $redirect_string );
|
||||
}
|
||||
|
||||
$cart_rules = $this->context->cart->getCartRules();
|
||||
$products = $this->context->cart->getProducts();
|
||||
$deletedprod = 0;
|
||||
foreach ($products as $product){
|
||||
foreach ($cart_rules as $cart_rule) {
|
||||
if ($cart_rule['gift_product'] === $product['id_product']) {
|
||||
continue(2);
|
||||
}
|
||||
}
|
||||
|
||||
$id_category = (int)$product['id_category_default'];
|
||||
$privatesale = SaleCore::loadSaleFromCategoryId($id_category, (int) $this->context->cookie->id_lang);
|
||||
if ($privatesale) {
|
||||
@ -493,6 +500,7 @@ class Privatesales extends Module {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$privatesale)
|
||||
continue;
|
||||
if( strtotime($privatesale->date_start) > time() || strtotime($privatesale->date_end) < time() || !$privatesale->active || count(array_intersect(
|
||||
|
@ -808,14 +808,14 @@ class Cart extends CartCore
|
||||
$count = 0;
|
||||
foreach ($this->getProducts() as $product) {
|
||||
$sale = SaleCore::getSaleByIdProduct($product['id_product']);
|
||||
if ($sale) {
|
||||
if ($sale && $sale->isOpen()) {
|
||||
if ($sale->otherdelay){
|
||||
$otherdelay[$sale->id_privatesales] = $sale->otherdelay_title[1];
|
||||
$title = $sale->otherdelay_title[1];
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($force_return_otherdelay && !empty($title)) {
|
||||
return $title;
|
||||
|
@ -199,12 +199,12 @@
|
||||
{foreach $cart_rules as $cart_rule}
|
||||
{cycle values='#FFF,#DDD' assign=bgcolor}
|
||||
<tr style="line-height:6px;background-color:{$bgcolor};text-align:left;">
|
||||
<td style="line-height:3px;text-align:left;width:60%;vertical-align:top" colspan="{if !$tax_excluded_display}5{else}4{/if}">{$cart_rule.name}</td>
|
||||
<td>
|
||||
<td style="text-align:left;" colspan="{if !$tax_excluded_display}5{else}4{/if}">{$cart_rule.name}</td>
|
||||
<td style="width: 15%; text-align: right;">
|
||||
{if $tax_excluded_display}
|
||||
- {$cart_rule.value_tax_excl}
|
||||
- {displayPrice currency=$order->id_currency price=$cart_rule.value_tax_excl}
|
||||
{else}
|
||||
- {$cart_rule.value}
|
||||
- {displayPrice currency=$order->id_currency price=$cart_rule.value}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user