Hi,
I've been hunting on the forum and in the code but I haven't found a way to do this:
I need to order the products in the confirmation email by products_id rather than the order in which they were added to the card which is the way it seems to be by default.
My colleagues fulfilling the orders have a very precise setup in the warehouse and I'm trying to list them in exactly the order they have them stored.
Thanks!
Latest News: (loading..)
Confirmation email: Change order of products
Started by paulc1, Oct 15 2009, 12:01
3 replies to this topic
#1
Posted 15 October 2009, 12:01
#2
Posted 15 October 2009, 22:25
In checkout_process.php, find
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {and add before it function cmp_order_product_id($a, $B) {
return ($a['id'] - $b['id']);
}
usort($order->products, 'cmp_order_product_id');and see if that does what you want.
Always backup before making changes.
#3
Posted 16 October 2009, 08:48
Hi, thanks for that. That seems to just reverse the first 2 items. Do you have any idea how to sort them by id?
As far as I can understand, they are stored in the session rather than selected from the DB each time.
As far as I can understand, they are stored in the session rather than selected from the DB each time.
ecartz, on 15 October 2009, 22:25, said:
In checkout_process.php, find
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {and add before it function cmp_order_product_id($a, $B) {
return ($a['id'] - $b['id']);
}
usort($order->products, 'cmp_order_product_id');and see if that does what you want.#4
Posted 16 October 2009, 19:50
There is a bug in that code. $B should be $b. It looks like the forum is mangling it.
function cmp_order_product_id($a, $b ) {
return ($a['id'] - $b['id']);
}
usort($order->products, 'cmp_order_product_id');Adding a space between the b and the ) seems to work.
Always backup before making changes.














