Cart order by Product Name

Hello everyone,
I would like to ORDER my products in cart alphabetically. For example for now I a have:

  1. Drawing Pad for Kids A4 40 sheets
  2. Correction Tape
  3. Notebook A4

How could I order them like this:

  1. Correction Tape
  2. Drawing Pad for Kids A4 40 sheets
  3. Notebook A4

Inside app/functions/fn.cart.php I was trying to add somehow ORDER BY cscart_product_descriptions.product ASC inside fn_get_cart_product_data function but without luck…

Any suggestions or help?

thanks in advance

Please try the following solution

Just instead of ‘company_id’ type ‘product’

thank you for your time! Unfortunately, nothing changed! Inside mode === 'cart'… clear cache and everything, but still no change. Maybe the solution is not in checkout.php file controller ? It does not make sense though

I am using 4.13.2 SP2 cs-cart version. Any ideas, please? Thanks in advance

1 Like

ok I found it, actually your answer is working, I just addde the variable of array products again! Didn’t know that: Thus, I have this now and working:

**$cart_products =** fn_sort_array_by_key($cart_products, 'product', SORT_ASC);

Thanks again!