Jump to content
  • 0

[Prestashop 1.7] Dodatkowe opcje sortowania


kzelazny

Question

Cześć wszystkim,

Potrzebuję dodać kilka dodatkowych opcji sortowania w sklepie. Znalazłem 2 pliki odpowiedzialne za sortowanie, a przynajmniej tak mi się wydaję. Wprowadziłem zmiany ale niestety na stronie nic się nie zmienia... Jest ktoś w stanie pomóc?

 

image.png.94f1668169b95ccc61ab5cb47968e6c8.png

 

SearchProvider.php

ŚCIEŻKA: /public_html/modules/ps_facetedsearch/src/Product/SearchProvider.php

    private function getAvailableSortOrders()
    {
        $sortNameAsc = new SortOrder('product', 'name', 'asc');
        $sortNameDesc = new SortOrder('product', 'name', 'desc');
        $sortDelivery24h = new SortOrder('product', 'price', 'desc');
        $sortDelivery48h = new SortOrder('product', 'price', 'desc');
        $sortDelivery3d = new SortOrder('product', 'price', 'desc');
        $sortDelivery7d = new SortOrder('product', 'price', 'desc');
        $sortPriceAsc = new SortOrder('product', 'price', 'asc');
        $sortPriceDesc = new SortOrder('product', 'price', 'desc');
        $translator = $this->module->getTranslator();

        return [
            $sortNameAsc->setLabel(
                $translator->trans('Nazwa, A do Z', [], 'Shop.Theme.Catalog')
            ),
            $sortNameDesc->setLabel(
                $translator->trans('Nazwa, Z do A', [], 'Shop.Theme.Catalog')
            ),
            $sortDelivery24h->setLabel(
                $translator->trans('Dostępność, wysyłka 24h', [], 'Modules.Facetedsearch.Shop')
            ),
            $sortDelivery48h->setLabel(
                $translator->trans('Dostępność, wysyłka 48h', [], 'Modules.Facetedsearch.Shop')
            ),
            $sortDelivery3d->setLabel(
                $translator->trans('Dostępność, wysyłka 3 dni', [], 'Modules.Facetedsearch.Shop')
            ),
            $sortDelivery7d->setLabel(
                $translator->trans('Dostępność, wysyłka 7 dni', [], 'Modules.Facetedsearch.Shop')
            ),
            $sortPriceAsc->setLabel(
                $translator->trans('Cena, rosnąco', [], 'Shop.Theme.Catalog')
            ),
            $sortPriceDesc->setLabel(
                $translator->trans('Cena, malejąco', [], 'Shop.Theme.Catalog')
            ),
        ];
    }

 

SortOrdersColletion.php

ŚCIEŻKA: /public_html/src/Core/Product/Search/SortOrdersCollection.php

public function getDefaults()
    {
        return [
            (new SortOrder('product', 'name', 'asc'))->setLabel(
                $this->translator->trans('Nazwa, A do Z', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->translator->trans('Nazwa, Z do A', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->translator->trans('Dostępność, wysyłka 24h', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->translator->trans('Dostępność, wysyłka 48h', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->translator->trans('Dostępność, wysyłka 3 dni', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->translator->trans('Dostępność, wysyłka 7 dni', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'price', 'asc'))->setLabel(
                $this->translator->trans('Cena, rosnąco', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'price', 'desc'))->setLabel(
                $this->translator->trans('Cena, malejąco', array(), 'Shop.Theme.Catalog')
            ),
        ];
    }

 

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

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...