Skip to content

[Bug]: Sorting is not supported #139

@roszpun

Description

@roszpun

Expected Behavior

So the getCategoryProducts do not support sort param or rather order in PrestaShop.

Actual Behavior

When providing sort options on the frontend, the server-api skips sort parameter while using: search method from useFacet composable. This means that sorting is not possible. Additionally, getSortOptions from facetGetters do not produce proper sorting options, but this is easy to solve with code like this:

    const sortByOptions = result.value.data.sort_orders.map(order => ({ value: order.urlParameter, label: order.label }))
    const route = useRoute()
    const selectedSort = ref(route.value?.query?.sort || sortByOptions.find(order => order.label === result.value.data.sort_selected).value)

Possible Solution

Sot the solution would be adding an order parameter to the getCategoryProducts API call params.

Steps to reproduce

No response

What version of PrestaShop integration are you using?

1.0.0

What version of Node.js are you using?

14

What browser (and version) are you using?

Brave

What operating system (and version) are you using?

macOS

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions