Jump to content

Sort productlist in Cart and Order


Recommended Posts

Hello,

 

I want to sort my products in Cart en the order by product-name instead of id_product.

Some customers order 100 products. All these products are sorted by id. That's is terrible for me. 

So I want to sort by name

 

I know i have to change something in the file cart.php  map classes

 

// Build ORDER BY
$sql->orderBy('p.id_product,cp.id_product_attribute, cp.date_add ASC');
 
But what do I have to change to sort the cart by product name.
 
Prestashop 1.5.6

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 1 year later...

Hello

 

you must change add  pl.`name` if you are in prestashop 1.6 like that.

 

    $sql->orderBy(' pl.`name`,p.`id_product`, cp.`id_product_attribute`, cp.`date_add` ASC');

bye bye

Will this work with PS 1.6.1.6 

 

"change order by clause in

$sql->orderBy('p.id_product, cp.id_product_attribute, cp.date_add ASC');

to

 

$sql->orderBy('pl.name ASC, cp.id_product_attribute, cp.date_add ASC'); 

your list will be sortted by product name ASCENDING (pl.name ASC)

 

it's a part of classes/Cart.php (getProducts()) funciton"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More