@josemanuel
yes, there is a way to sort the attributes in alphabetical or reverse order..
this is a little array manipulation, just insert this code between the if and for..
if ( ($k = sizeof($order->products[$i]['attributes'])) > 0) {
// begin insert
// Obtain a list of columns
// option
// value
// price
// prefix
$sort_options = array();
$sort_values = array();
$sort_prices = array();
$sort_prefixes = array();
foreach ($order->products[$i]['attributes'] as $key => $row) {
$sort_options[$key] = $row['option'];
$sort_values[$key] = $row['value'];
$sort_prices[$key] = $row['price'];
$sort_prefixes[$key] = $row['prefix'];
}
// Sort the data with descending, ascending, etc.
// Add $data as the last parameter, to sort by the common key
array_multisort(
$sort_options, SORT_DESC,
$sort_values, SORT_ASC,
$sort_prices, SORT_ASC,
$sort_prefixes, SORT_ASC,
$order->products[$i]['attributes']);
// end insert
for ($j = 0; $j < $k; $j++) {
$attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
if ($order->products[$i]['attributes'][$j]['price'] != '0') {
$attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] .
$currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
}
$attrib_string .= '</i>';
you can change the SORT_ASC or SORT_DESC to suit your needs..
:thumbsup: