You get an order (100$), where the customer had a 10% off voucher.
The customer decides to cancel the order, so you have to generate an order slip.
Obviously you only want to give him, what he paid (90$). So you select to subtract the cart rule value from the total.
Up to here everything looks clean. But what the system does, is very messy. It saves the total (100$) to order_slip table. There is no column for id_cart_rule or cart_rule_value or so. Instead the only thing it does it saves "order_slip_type" to 1.
This has a lot of drawbacks.
The system always need to check order_slip_type and then call $order->getCartRules();
It means that AdminSlipController just shows a value of 100$, which is just wrong.
In fact the substraction happens in the tpl file {displayPrice currency=$order->id_currency price=($order_slip->total_products_tax_incl + $order_slip->total_shipping_tax_incl - $total_cart_rule)}.
I wonder, if it would work, if we just join ps_orders and use total_discounts_tax_incl / total_disconts_tax_excl? Instead of going for $order->getCartRules()?
Case:
Up to here everything looks clean. But what the system does, is very messy. It saves the total (100$) to order_slip table. There is no column for id_cart_rule or cart_rule_value or so. Instead the only thing it does it saves "order_slip_type" to 1.
This has a lot of drawbacks.
{displayPrice currency=$order->id_currency price=($order_slip->total_products_tax_incl + $order_slip->total_shipping_tax_incl - $total_cart_rule)}
.Any proposal what would be the right way?
https://github.com/thirtybees/thirtybees/blob/main/classes/pdf/HTMLTemplateOrderSlip.php#L166-L190
I wonder, if it would work, if we just join ps_orders and use total_discounts_tax_incl / total_disconts_tax_excl? Instead of going for $order->getCartRules()?