hello
in checkout_confirmation file, i find the code nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']))
i want to use max() for my attributes values (all my attributes avlues are numbers)
i tried echo max(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']))
and echo max(array(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])))
they don't work
any ideas?
each product has only one attribute, all the attribute values are numbers
ex.
product A with attribute value 6
product B with attribute value 3
product C with attribute value 8
if i add <? php echo zen_output_string_protected($order->products[$i]['attributes'][$j]['value']); ?> to tpl_checkout_confirmation_default
it displays
638
if i add <? php echo zen_output_string_protected($order->products[$i]['attributes'][$j]['value']) . '<p>'; ?>
it displays
6
3
8
now i want to get the max number from 6, 3, 8
the code below doesn't work
max(array(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])))
max(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']))
[PHP]$attrib_max = 0;
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
$attrib_max = ($attrib_max > $order->products[$i]['attributes'][$j]['value'])? $attrib_max: $order->products[$i]['attributes'][$j]['value'];
}
}[/PHP] $attrib_max will end up as the max of the attribute values.
A simpler version of the comparison uses the PHP max() function:[PHP]
$attrib_max = max($attrib_max, $order->products[$i]['attributes'][$j]['value']); [/PHP]
Moderation
Destination thread ID and reason are required when shown.
Report Post
Tell staff why this post should be reviewed.
Manage cookie preferences
Our cookie policy has been updated, so we need you to review your preferences and consent again.