Jump to content

Product Order on the Home Page


Recommended Posts

I have done the following thanks to Pascal who gave me these instructions earlier this year:

 

Q:  In Catalog > Products, Is there a way to changing the ID order? For instance, I want the item #12 listed as #2?

A:  Go to catalog->Products, and select just above the products list on the left the option filter by category. Then select a category for which you want to change the order. Some arrows will appear in the products list on the right (just next to 'action' column)
Then drag/click the products, using these arrows, to the desired position.

Also check: Preferences->Products: Pagination block: Default order by: Set this to 'Position inside category'

 

I have done this but the products do not move on the home page.  Am I missing something?  

 

Thanks in advance for your help!

 

Link to comment
Share on other sites

I am using Kinro's Agile Multi Seller modules and will potentially have many, hopefully hundreds of different sellers selling their art.  I have one requirement for them and it is that they only put up a couple of items at a time so that one artist does not dominate the entire front page for instance.  I do need the ability however to re-sort the front page products in case someone puts too many, etc.

Link to comment
Share on other sites

I want the artists who list to fall into line, latest at the top and so on BUT I do want the ability to re-sort when I need to in the back office.

 

I went to all categories, there is only one called "artist creations" and "home" and re-sorted them but nothing changed on the home page.  

Link to comment
Share on other sites

I made an error.  The code was never added:

 

open homefeatured.php file and change:
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));to:

 

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));
$products = array_reverse($products);
i just added one line: $products = array_reverse($products); 

 

I added it with your suggestion, adding the //.

 

So after adding the code above, I was able to move the products around BUT the products are not being added by date created, or latest entry on the top of the list.   :(

 

So I am back to square one.  I have my settings in Preferences > Products > Pagination > Product Add Date > and either ascending or descending, nothing changes.  It is like that feature is dead.

 

Please help....

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

Thanks PrestaNinja.  It did not seem to do anything.  I can move the products around in the back office but nothing changes on the front page.  I have someone put the code in for me, I am not able.  So to clarify, when you said "Put this instead..."  Could you clarify instead of what?   I appreciate your help very much.

Link to comment
Share on other sites

hello,

by default products are sorted "by position" that you defined in "home" category (catalog > products > filter by category "home")

 

if you open homefeatured.php file, you can find there code:

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));

instead of this code use code mentioned above by PrestaNinja

  • Like 2
Link to comment
Share on other sites

My friend is trying to make this work.  He said, "There was never a number 8 in the original code. There was a 10 in the code. That's why I'm thinking there's another location with the same file name?"  Any thoughts?

The number 8 comes from the topic you mentioned (http://www.prestashop.com/forums/topic/269904-solved-featured-products-order/?do=findComment&comment=1420922).

 

But the 8 is not really important, you can put 10 instead. This number is just the default number of products in category if nothing is mentioned in back office. There is only one location for this file, so you can safely make the modification! ;)

  • Like 1
Link to comment
Share on other sites

Ok. Thank you.  Sadly, it did not solve the problem.  This is what he did:

 

 

Where you see:  $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));
 
Add this instead:  $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'date_add', 'DESC'); //$products = array_reverse($products);
Link to comment
Share on other sites

They are in the order of date added: latest first.  

 

I notice that if I set the Preferences >Products: Pagination block: Default order by: Set this to 'Position inside category' and I go to the search by category, the changes I made in re-sorting work.  

 

It is just the featured products area where they are not working.

Link to comment
Share on other sites

I'm not sure what you really want to do anymore...

If you want to sort them by latest added and still be able to sort them by position, then the code provided by Vekia in the last thread was good. But you just needed to sort them from the end of the list. 

 

For example:

  1. product1
  2. product2
  3. product3
  4. product4

Will display

  1. product4
  2. product3
  3. product2
  4. product1

If for example, you want to put product1 at the second place, then you have to start from the end of the list:

order in admin back office:

  1. product2
  2. product3
  3. product1 (second position from end of the list)
  4. product4
  • Like 1
Link to comment
Share on other sites

open homefeatured.php file and change:

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));to:

 

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));

$products = array_reverse($products);

 

i just added one line: $products = array_reverse($products);

 

Ok, so if we put the above code, the latest added product will be at the top of the list AND I will be able to reposition any of them AND that will be effective on the Featured/Home page? We did this before and it did sort it properly, meaning the latest added was at the top, so that worked BUT it would not reflect any moves I made in the back office. They remained in the order placed. As per your example, I would move #2 to position #4 but the Featured page did not reflect that change.

 

Thank you for your patience with me :-)

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

  • 5 months later...

Hello everybody, 

 

I did - product in category order and I have clicked on filter to filter only products on home page, but there are so many that drug and drop is unusefull, it takes forever to go from the product which is in the end ( for example has numb.300) to put it as a firts one by drag and drop...using the arrows - I do not even think about it, it is even worse..does anybody know how to order by myself the products on home page in an easier way?? Thank you very much for your help!

Link to comment
Share on other sites

×
×
  • Create New...