Hello,
I'm afraid that the algorithm for the selection of the discount do not handle the negative prices because it uses a sorting key which is a string.
In the HikaShop currency class, you will find the function "selectDiscount" and in there, a line for the sorting key definition
$value = sprintf('%09.2f',$discount->discount_flat_amount).'_'.sprintf('%09.4f',$discount->discount_percent_amount);
Near the end of the function, there is a selection of the "best" discount and the discounts are sorted by that "value".
The thing is, because the key is a string, the symbol "-" will be used a character and not as a number.
See :
php.net/manual/en/function.krsort.php
By default the sorting is using the REGULAR mode ; but in your specific case, a natural sorting would be better.
So you'll need to change the flag for the krsort call to set that "SORT_NATURAL" flag (cf:
php.net/manual/en/function.sort.php
)
But I can't guarantee that it will work fine because it is based on a string and I don't know how it will react with the other half of the key...
Regards,