Jump to content

[SOLVED] how to set product sort in shopping cart (sort by name)


Recommended Posts

 
Hi!
I use prestashop 1.5.6.1

I have in my store about 15,000 goods and when a customer makes an order for maybe 400 items it is difficult for him to verify the order in the cart (i mean shopping-cart.tpl) because the products are sorted by id.
How to sort products in cart by name?
Is it possible maybe to use standart product-sort.tpl in the cart summary?
 
Thank you for any answers!

 

Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

  • 7 months later...

Is that possible to use a solution like this to order the products in cart, order and invoice by REFERENCE number (SKU), instead of PRODUCT_ID or NAME (pl.name)?

 

It works with:

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

 

PS vs. 1.5.5.0

Edited by gabiatti (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Is that possible to use a solution like this to order the products in cart, order and invoice by REFERENCE number (SKU), instead of PRODUCT_ID or NAME (pl.name)?

 

It works with:

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

 

PS vs. 1.5.5.0

use unique_id instead of pl.name

Link to comment
Share on other sites

  • 9 months later...

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

 

That is by far the simplest solution, but of course changing the core code can give you problems when updating PrestaShop.

 

Overriding, of course, can also give you problems, but the chances are not as great, my post on how to sort by original date add can be modified to do the same without changing the core code.

Link to comment
Share on other sites

  • 3 months later...

Hello everyone. It is possible sort the products order by EAN-13 or UPC field??

 

I dont use this fields and I would like sort the orders invoice because my store and stock is too big. 

 

Reference numbers and another fields are disordered. I need a new field to sort.

 

Thanks and regards

Link to comment
Share on other sites

  • 5 months later...

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

will this work with ps 1.6.1.6 as well?

Link to comment
Share on other sites

  • 5 months later...

how about when adding products to the cart it ads the product to the bottom of the cart and the coustomer needs to scroll to se the last added product. can i add the latest on the på in the ajax cart animation. our cartblock is alwas open.  ? 

Link to comment
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...