Jump to content

Pagination: Default order by


Recommended Posts

Hi Everyone,

 

I'm trying to to set the default sort for products by Product ID. But none of the back office options seem to allow this functionality.

 

I'm sure this must've cropped up before, but I can't find any information that relates to the latest version of PS.

 

I was wondering if anyone knew of a way to add this?

 

Cheers,

 

Rob.

Link to comment
Share on other sites

Apologies. This does appear to be functioning correctly when viewed by "Category" and selecting "Position Inside Category" from back office.

 

However, this order does not function on products are view under "Manufacturer". The list is ordered by product name. How can this view be changed to sort by product ID?

Link to comment
Share on other sites

Thanks but unfortunately, this does not work. Some products were added after others, so they have a sequential ID, but appear later in the list. Changing date_add in SQL is a work around I guess, but I'd like to nail this one.

 

I was hoping there would be a bit of code that could be swapped out. PS is getting the default order from somewhere. Any ideas where $orderbydefault is set?

Link to comment
Share on other sites

exactly there ;) in backoffice preferences > products

if you want to change order by for manufacturers, open manufactureres class: /classes/manufacturers.php

 

there is a function:

public static function getProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
 $get_total = false, $active = true, $active_category = true, Context $context = null)
{

 

you can set up own order method there manually

Link to comment
Share on other sites

Thanks, vekia.

 

I tried swapping out several variables and adding id_product, but clearly my lack of SQL understanding is hampering my efforts. (SQL is on my to learn list).

 

I realise this is perhaps asking a bit too much in the way of good natured support, but would you be able give me a bit of assistance?

Link to comment
Share on other sites

  • 11 months later...

exactly there ;) in backoffice preferences > products

if you want to change order by for manufacturers, open manufactureres class: /classes/manufacturers.php

 

there is a function:

public static function getProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
  $get_total = false, $active = true, $active_category = true, Context $context = null)
{
you can set up own order method there manually

 

 

Link to comment
Share on other sites

Dear Vekia and all the users,

 

Could you please explain how to set default sorting of In Stock items fist in search result of Tag and Search section. I am using prestashop 1.5.6.0.

 

 

Best Regards

Admin fashionstore18.com 

Link to comment
Share on other sites

  • 2 years later...

hi sir,

i want to add the pagination in my prestashop page,so guide me by using admin pannel,how i use pagination.

 

thanks in advance

 

prestashop by default has pagination

if you dont have it, it is probably a matter of:

1) you've got not enough product to make pagination

2) your theme does not have this feature

Link to comment
Share on other sites

×
×
  • Create New...