-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set different sort direction per category? #3184
Comments
Hello @ioweb-gr, There is already a similar issue #3179, so you can take some inspiration from there. As Roma already said:
Check our Wiki about how you could customize the product sorting. BR, |
Hi @ioweb-gr I don't understand your Use Case. If you want to get back your existing positions, you can insert them in the "smile_virtualcategory_catalog_category_product_position" table. You're willing to sort by position "DESC" instead of "ASC" ? You could probably consider adding a plugin here : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-core/Search/Request/SortOrderInterface.php#L65 |
Hi my use case is fairly simple. My whole website needs to sort products by created_at descending and we did that. It works perfectly. However for a few categories we need to change sort on demand by the admin to use sort by position and ascending direction. With smile elastic suite enabled this is impossible now because we can switch the attribute to position for this category by default but the direction will stay descending. The admin cannot change it Without smile this would not be a problem because he could position the products inverse and due to descending order he could show what he wants. However with smile enabled, the products using manual sort will be pushed to the top only (when sort direction is ascending). But in our case direction is descending so they appear in the last page instead of the top of the first page |
Let's say I have products 1-5 I want to sort like this in one category
This is the default sorting order based on the
When using smile elastic suite if I manually set position for Products 1,4 they will appear in the backend on the top. However on the frontend because the sort order is descending, the end result will be
On the old magento, I could set the position number in inverse to accommodate the descending order, in smile it's not possible so we lose functionality I hope these examples make it clear now |
In terms of possible solutions, would it be possible to add a custom attribute in categories for the sort direction (by default) and have smile elastic suite solution honor this? |
Hello @ioweb-gr According to your use case, I think it's more suitable to allow "Created At" to be sortable. This way, you'd be able to chose this attribute as the default sort order for categories. So @vahonc can you try to :
And check if this can then be used for sorting categories or if it requires additional work by our side. regards |
I think you missed the point the problem is not to add created at descending as the sorting. We did that. The problem is changing one category to position ascending We can't set the default direction per category |
@ioweb-gr the default sorting is "position ascending". You mean you want to change it to "position descending" for a particular category, don't you ? We could allow to edit the sort direction per category, this could be interesting. Regards |
Yes exactly adding this option solves the issue. But I want to make clear this was possible in default M2. The ability was lost due to the drag and drop ui of elastic. I have already a way we can simplify this example. Can you now using smile elastic suite push 1 product to the bottom of the list if you sort by position? In order to do that you have to set all products to manual sort order and drag and drop to end when sorted by position ascending. In default M2 it's easy because you set the product position as a high number and it will move to bottom |
Ok @ioweb-gr now I understand more.
So the answer is "No" until you are able to set the sort direction per category. @vahonc in parallel of the previous comment about the dates, can you work on a PR to add the ability to change the sort direction per category ? The idea is :
Regards |
@romainruaud Great :) |
This new functionality was breaking my Magento 2.4.5-p7 shop. I set the version to 2.10.19.3 for now. It's a related commit 7d54338 TypeError: Return value of Smile\ElasticsuiteVirtualCategory\Model\Preview::getSortBy() must be of the type string, null returned in /vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php:224 Updated from 2.10.19.1 to 2.10.20.1 |
@mdesplenter can you please create a separated issue for this ? Regards |
This is an awesome feature, unfortionatly it defaults to ASC and we need DESC as the default. I wrote a quick patch because I'm busy. But having a default sort direction in the config below 'Product Listing Sort by" and adding a use default check box on the category would be perfect. |
@jesse-thomas could you write a new issue with your needs ? I agree it would be great, we'll gladly implement it. But I'd like to close this old issue because the purpose of this ticket has been implemented. Regards |
@romainruaud will do, thanks! I added a feature request #3333 |
I close this ticket since it's been implement. Let's follow the new feature request on #3333 |
Is your question related to a problem? Please describe.
Since installing smile elastic suite we lost the ability to sort in both directions by position. On our store, we have by default set up so that products are ordered by date created_at descending so that the newest products are on top. However for some categories like sales categories, we would like to manually sort some products by position not all of them.
After installing the module though, the position field is no longer appearing. Instead we have to disable automatic sort from the products one by one and then they will be inserted in the bottom instead of the top. However we cannot change the sort direction for the category to invert the ordering. We have to manually reorder all products and move them in the inverse direction.
And we can't for example push the product after the automatic sorted ones to change the direction
So we have no way to control the direction itself between mixed manual and automatic products.
Now imagine a category with 2000 products where the user has to manually click every one of them to make them manual and then rearrange them manually one by one in the inverse way.
This is really problematic, is there a workaround or a recommended way to fix this on category level?
Additional context
The text was updated successfully, but these errors were encountered: