Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort order of products on email/invoice/packing slip


ecomeal

Recommended Posts

Posted

Is it possible to sort products on email confirmation and invoice in alphabetical, or any other order?

Products are listed in the order they were added to shopping cart.

 

I found contribution 'Alphabetical Order Product Listing' that claims changing $orders_products_query in includes/classes/order.php ( by adding ORDER BY in select) should do the trick, but not for me.

 

Did anyone try?

 

Thank you for your help

 

V

Posted

I think I figured it out.

 

If you would like to sort email order confirmation, or shopping cart in any order use:

 

function compare($x, $y) {

$retval = strnatcmp($x['quantity'], $y['quantity']);

if(!$retval) return strnatcmp($x['name'], $y['name']);

return $retval;

}

 

usort($products, 'compare');

 

 

Let me know if you have any questions.

 

www.OrganicDirect.com

  • 3 months later...
Posted

hello ecomeal,

 

where did you include the code exactly?

 

thanks,

oliver

 

(...)

 

function compare($x, $y) {

$retval = strnatcmp($x['quantity'], $y['quantity']);

if(!$retval) return strnatcmp($x['name'], $y['name']);

return $retval;

}

 

usort($products, 'compare');

  • 9 months later...
Posted

I've tried to make the changes posted on the German oscommerce forum (although my german is not very good.....) but there doesn't seem to make any difference to the order of the products in the shoppingcart at all when I make an order. And when I come to 'checkout_process.php' I get an error:

 

 

Warning: usort() [function.usort]: The argument should be an array in xxxxxx/checkout_process.php on line 306

(One warning for every item)

 

Warning: Cannot modify header information - headers already sent by (output started at xxxxxxx/checkout_process.php:306) in xxxxxx/includes/functions/general.php on line 33

 

Any idea of what to do?

Posted
I've tried to make the changes posted on the German oscommerce forum (although my german is not very good.....) but there doesn't seem to make any difference to the order of the products in the shoppingcart at all when I make an order. And when I come to 'checkout_process.php' I get an error:

Warning: usort() [function.usort]: The argument should be an array in xxxxxx/checkout_process.php on line 306

(One warning for every item)

 

Warning: Cannot modify header information - headers already sent by (output started at xxxxxxx/checkout_process.php:306) in xxxxxx/includes/functions/general.php on line 33

 

Any idea of what to do?

Have a look in the knowledgebase for Cannot modify header information - headers already sent by

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...