diff --git a/classes/CartRule.php b/classes/CartRule.php index 90859cd39..74790a742 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -590,7 +590,10 @@ class CartRuleCore extends ObjectModel } if ($countMatchingProducts < $productRuleGroup['quantity']) return (!$display_error) ? false : Tools::displayError('You cannot use this voucher with these products'); + // p($matchingProductsList); + // p($eligibleProductsList); $eligibleProductsList = CartRule::array_uintersect($eligibleProductsList, $matchingProductsList); +// d($eligibleProductsList); break; case 'categories': $cartCategories = Db::getInstance()->executeS(' @@ -662,7 +665,7 @@ class CartRuleCore extends ObjectModel return $selectedProducts; return (!$display_error) ? true : false; } - + protected static function array_uintersect($array1, $array2) { $intersection = array(); @@ -675,7 +678,7 @@ class CartRuleCore extends ObjectModel } return $intersection; } - + protected static function array_uintersect_compare($a, $b) { if ($a == $b) @@ -1008,7 +1011,7 @@ class CartRuleCore extends ObjectModel WHERE id_cart = '.(int)$context->cart->id.' AND id_cart_rule = '.(int)$cartRule->id)) $context->cart->removeCartRule($cartRule->id); - + foreach ($cartRules as $cartRule) if ($cartRule->checkValidity($context, true, false)) $context->cart->addCartRule($cartRule->id); @@ -1038,4 +1041,5 @@ class CartRuleCore extends ObjectModel WHERE code LIKE \'%'.pSQL($name).'%\' '); } -} \ No newline at end of file +} + diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 9b706f493..7b58967d6 100755 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -70,6 +70,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $this->smarty->assign(array( 'order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), + 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), diff --git a/pdf/invoice.tpl b/pdf/invoice.tpl index 6993d0a8c..8264fd426 100755 --- a/pdf/invoice.tpl +++ b/pdf/invoice.tpl @@ -50,6 +50,7 @@ {else} + + {foreach $order_details as $order_detail} {cycle values='#FFF,#DDD' assign=bgcolor} @@ -165,6 +167,23 @@ {/foreach} {/foreach} {/foreach} + + + + {foreach $cart_rules as $cart_rule} + {cycle values='#FFF,#DDD' assign=bgcolor} + + + + + {/foreach} +
{l s='Billing & Delivery Address.' pdf='true'}
{$invoice_address} @@ -107,6 +108,7 @@
{l s='Qty' pdf='true'} {l s='Total' pdf='true'}
{$cart_rule.name} + {if $tax_excluded_display} + - {$cart_rule.value_tax_excl} + {else} + - {$cart_rule.value} + {/if} +
@@ -209,11 +228,11 @@ {/if}
{l s='Shipping Cost' pdf='true'} - {if $tax_excluded_display} - {displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_excl} - {else} - {displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_incl} - {/if} + {if $tax_excluded_display} + {displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_excl} + {else} + {displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_incl} + {/if}