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