Hey Dirk, here is a solution. If implemented then any quantity stop coupon will always work this way:
Version 1.4.1
in www/administrator/components/com_awocoupon/assets/ps_coupon_process.php around line 874, after this
<?php
$qty = $qty_distinct = $total = 0;
?>
add this
<?php
if(!empty($max_qty)) {
$coupon_row->cart_items = sortmulti($coupon_row->cart_items,'product_price','desc');
}
?>
Then around line 16, after
<?php
if(!function_exists('printrx')) { function printrx($a) { echo '<pre>'.print_r($a,1).'</pre>'; exit; } }
?>
add this
<?php
function sortmulti ($array, $index, $order, $natsort=FALSE, $case_sensitive=FALSE) {
if(is_array($array) && count($array)>0) {
foreach(array_keys($array) as $key)
$temp[$key]=$array[$key][$index];
if(!$natsort) {
if ($order=='asc')
asort($temp);
else
arsort($temp);
}
else
{
if ($case_sensitive===true)
natsort($temp);
else
natcasesort($temp);
if($order!='asc')
$temp=array_reverse($temp,TRUE);
}
foreach(array_keys($temp) as $key)
if (is_numeric($key))
$sorted[]=$array[$key];
else
$sorted[$key]=$array[$key];
return $sorted;
}
return $sorted;
}
?>
This will sort the items in the cart based on price and the most expensive will be processed first