pawciak Posted April 14, 2013 Share Posted April 14, 2013 Hej, używam wersji 1.5.3.1. Chcę w kategorii posortować produkty wedle własnego uznania. WIem, że wcześniej była metoda ze strzałkami/przeciągnij i upuść. Natomiast w tej wersji ps tego nie ma;/ co robię źle? W ustawieniach odpaliłem sortowanie wg wewnętrznego podziału w kategorii. dzięki! Link to comment Share on other sites More sharing options...
mentalspot Posted August 29, 2013 Share Posted August 29, 2013 (edited) Chciałbym sie podczepić pod temat, czy jest możłiwe ustawienie sortowania dla kategroii randomowo ? Edited August 29, 2013 by mentalspot (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2013 Share Posted August 29, 2013 Wszystko robisz dobrze, to błąd prestashop w wersji 1.5.3.1, niestety. polecałbym zaktualizowanie sklepu, o ile to możliwe. Zawsze można się pomęczyć w bazie danych, ale wiem że to będzie "katorga"... Chciałbym sie podczepić pod temat, czy jest możłiwe ustawienie sortowania dla kategroii randomowo ? jest możliwie ale szczerze mówiąc nie widzę sensu, jak produkty będą wyświetlane "randomowo" wówczas na kolejnych podstronach możemy widzieć te same produkty które już widzieliśmy, oraz co najważniejsze: wiele produktów może zostać pominiętych. Wyeliminowanie tego problemu wiązało by się z olbrzymimi przeróbkami core, aż odechciewa mi się o tym myśleć chyba, że chciałbyś np. dla każdej podstrony wymieszać produkty, ale to nie będzie taki zupełny random Link to comment Share on other sites More sharing options...
mentalspot Posted September 9, 2013 Share Posted September 9, 2013 A jak mozna to robić ? Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 pytasz o wymieszanie kolejności produktów? Link to comment Share on other sites More sharing options...
mentalspot Posted September 9, 2013 Share Posted September 9, 2013 tak Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 no to otwieramy kontrolera kategorii: /controllers/front/CategoryController.php i dodajemy shuffle($this->cat_products); do: if (!$hookExecuted){ $this->context->smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); shuffle($this->cat_products); } 1 Link to comment Share on other sites More sharing options...
vekia Posted September 9, 2013 Share Posted September 9, 2013 zaznaczam, że kod ten "miesza" produkty tylko w obrębie podstrony kategorii (nie miesza wszystkich produktów z bazy tylko te które zostały pobrane do wyświetlenia) Link to comment Share on other sites More sharing options...
mentalspot Posted September 9, 2013 Share Posted September 9, 2013 zaznaczam, że kod ten "miesza" produkty tylko w obrębie podstrony kategorii (nie miesza wszystkich produktów z bazy tylko te które zostały pobrane do wyświetlenia) czyli jak jest dużo produktów o tej samej nazwie a innym atrybucie, to to nic zbytnio nie da. Link to comment Share on other sites More sharing options...
mentalspot Posted October 14, 2013 Share Posted October 14, 2013 zaznaczam, że kod ten "miesza" produkty tylko w obrębie podstrony kategorii (nie miesza wszystkich produktów z bazy tylko te które zostały pobrane do wyświetlenia) Vekia a co jeżeli na stronie mamy 18 produktów z tej samej kategorii z tą samą nazwą, czyli to mieszkanie nie przyda sie w tym wypadku, czy można wymieszać dla całej kategroii i dopiero wtedy wyświetlić wyniki ? Link to comment Share on other sites More sharing options...
mentalspot Posted October 19, 2013 Share Posted October 19, 2013 Ewentulanie czy ktoś coś takiego robił, lub czy ktoś chciałby się podjąc napisania takiej przeróbki ? I za ile ? Link to comment Share on other sites More sharing options...
vekia Posted October 19, 2013 Share Posted October 19, 2013 wyobraź sobie sytuację: - masz 20 produktów - na podstronach wyświetlasz 5 produktów Klient wchodzi na stronę kategorii - przed wyświetleniem produktów "mieszamy" produkty w całej kategorii tj. pobieramy losowe z bazy. Następnie klient przechodzi na stronę numer 2 aby przeglądnąć kolejne produkty. Produkty mieszają się i klient widzi ponownie np. 3 te same produkty, które widział wcześniej (wszak system nie wie co wyświetlał i jakie produkty ma pominąć podczas pobierania z bazy danych) wiele produktów zostało pominiętych i nie zostały wyświetlone. Tak to mieszanie będzie wyglądać w praktyce. Link to comment Share on other sites More sharing options...
mentalspot Posted October 20, 2013 Share Posted October 20, 2013 Tak ja w 100% rozumiem co chcesz powiedzieć, ale cały czas upieram się przy swoim. Link to comment Share on other sites More sharing options...
vekia Posted October 20, 2013 Share Posted October 20, 2013 ok zatem w pliki classes/Category.php jest funkcja: /** * Return current category products * * @param integer $id_lang Language ID * @param integer $p Page number * @param integer $n Number of products per page * @param boolean $get_total return the number of results instead of the results themself * @param boolean $active return only active products * @param boolean $random active a random filter for returned products * @param int $random_number_products number of products to return if random is activated * @param boolean $check_access set to false to return all products (even if customer hasn't access) * @return mixed Products or number of products */ public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) Jak widzisz jest tam zmienna $random która domyslnie jest wyłączona, zatem musimy ją właczyć w tym celu otwieramy plik controllers/front/CategoryController.php linię: $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); zmieniamy na: $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay,false,true,true); (dodałem trzy parametry na koncu wywołania funkcji: dalse, true, true ten ostatni odpowiada za włączenie funkcji mieszania 1 Link to comment Share on other sites More sharing options...
pavomils Posted November 6, 2013 Share Posted November 6, 2013 U mnie znowu jest jakoś na odwrót. W ver 1.5.3 miałem możliwość przesuwania kategorii i produktów wedle uznania, a po aktualizacji do 1.5.6 już niestety takiej opcji nie posiadam. Największym problemem są kategorie, które muszą być rozmieszczone w logicznej kolejności (czyli wg mnie Czy ktoś spotkał się z podobnym problemem? Link to comment Share on other sites More sharing options...
marcelluka Posted March 4, 2014 Share Posted March 4, 2014 czy ktoś rozwiązał problem sortowania wewnątrz kategorii według własnego uznania, tak jak było w starszych wersjach presty? Link to comment Share on other sites More sharing options...
marcelluka Posted March 4, 2014 Share Posted March 4, 2014 Już wiem jak to zrobić. Najpierw trzeba zaznaczyć "Filtruj według kategorii". Następnie wybrać kategorie, potem kliknąć "Pozycje" i można przesuwać strzałkami w górę, dół Link to comment Share on other sites More sharing options...
mentalspot Posted March 5, 2014 Share Posted March 5, 2014 no to otwieramy kontrolera kategorii: /controllers/front/CategoryController.php i dodajemy shuffle($this->cat_products); do: if (!$hookExecuted){ $this->context->smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); shuffle($this->cat_products); } dziękuję działa jak powinno Link to comment Share on other sites More sharing options...
mrbino Posted March 13, 2015 Share Posted March 13, 2015 (edited) Witam dodałem te dwie opcje i tak się składa że w nowych kategoriach które tworzyłem po dodaniu tych linijek mają problem ponieważ wyświetlany jest tylko 1 produkt który po odświeżeniu się zmiania. A miała się zmieniać kolejność wszystkich i miały być widoczne wszystkie produkty a nie tylko jeden. Edit : ok po usunięciu ,false,true,true zaczęło działać . Edited March 13, 2015 by mrbino (see edit history) Link to comment Share on other sites More sharing options...
grzegorzol1 Posted December 13, 2016 Share Posted December 13, 2016 Proszę niech kto mi pomoże z tematem ustawienia wyświetlania produktów w danej kategorii. Chcę sobie nadać własną kolejność wyświetlania produktów niestety nie wiem jak to zrobić bo produkty były różnie dodawane. I mają różne nie następujące po sobie numery id. Proszę o pomoc. Link to comment Share on other sites More sharing options...
Piotr K. Posted December 13, 2016 Share Posted December 13, 2016 Jak w kategorii posortujesz wg pozycji to będziesz mógł przesuwać kolejność. Link to comment Share on other sites More sharing options...
kwiatuszek Posted February 15, 2018 Share Posted February 15, 2018 Przesuwanie produktów w kategorii jest łatwe (tak jak powyżej wytłumaczył to marcelluka (post z March 4, 2014). Jednak mam inne pytanie: jak posortować produkty według marki. Jak kliknę w producenta to pokazują mi się wszystkie produkty tego producenta. Ok., jednak wyświetlają się one wtedy już alfabetycznie (to sortowanie wg kategorii dotyczy tylko sortowania wg kategorii). Jak można posortować produkty danej marki? W kluczowym producencie akurat na "A" mam same 'Akcesoria' i słabo jak wyskakują one na samej górze. Link to comment Share on other sites More sharing options...
pawellewap Posted June 22, 2021 Share Posted June 22, 2021 On 9/9/2013 at 11:26 AM, vekia said: no to otwieramy kontrolera kategorii: /controllers/front/CategoryController.php i dodajemy shuffle($this->cat_products); do: if (!$hookExecuted){ $this->context->smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay); shuffle($this->cat_products); } Witam czy wiesz może gdzie znajdę podobne ustawienie w wersji 1.7.7.4? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now