Product Sort Order in Email Confirmation
Could someone please tell me where to add an "ORDER BY products_name" clause to the SELECT that grabs the products for an order that goes into the "Order Confirmation" email. As it is the products are either ordered randomly or by how they were put in the cart.
Re: Product Sort Order in Email Confirmation
I added "ORDER BY products_name"; on line 163 in /includes/classes/order.php which looks like it should work but the products_ordered is still displaying in random order.
Re: Product Sort Order in Email Confirmation
I suspect you'll need to do a sort on the array prior to this loop inside the create_add_products() function/element in that class:
Code:
for ($i=0, $n=sizeof($this->products); $i<$n; $i++) {
Re: Product Sort Order in Email Confirmation
Hi
I want to do the same, except sort it by product model. At first I couldn't figure out why the SQL ORDER BY solution did not work from the previous poster, but with some more investigation I think I figured out why.
The order seems to be determined, not by any SQL query in the order.php class, but by the shopping_cart.php class via the $products = $_SESSION['cart']->get_products(); on line #424 in order.php
Correct me if I'm wrong.
I'm fairly OK with PHP, but I don't have any experience with the sorting functions. Could someone assist me in sorting the output by products model?
Thanks for any assistance.
Re: Product Sort Order in Email Confirmation
On a side note, I figured out it was easier to adjust the order in the invoice or packing slip in the admin, which is helpful on the larger orders, but the way our system is set up I still need the email confirmations to be ordered.