PrestaDesigner10 Posted June 8, 2017 Share Posted June 8, 2017 Hello, how can I reorder the links in the the native module "Widget link" (folder module/ps_linklist) I'm using prestashop 1.7.1. Thanks! 1 Link to comment Share on other sites More sharing options...
PrestaDesigner10 Posted June 22, 2017 Author Share Posted June 22, 2017 Up... Link to comment Share on other sites More sharing options...
netvico Posted April 19, 2018 Share Posted April 19, 2018 Up... Link to comment Share on other sites More sharing options...
jgamio Posted April 20, 2018 Share Posted April 20, 2018 No the best way I do direct on database check ps_link_block you see something like these {"cms":["1","2","3","4","5"],"product":[false],"static":["contact","sitemap","stores"]} the numeber are the id of the content just change the number {"cms":["2","1","3","4","5"],"product":[false],"static":["contact","sitemap","stores"]} 1 1 Link to comment Share on other sites More sharing options...
Juke29 Posted January 15, 2021 Share Posted January 15, 2021 This is the only solution I know today and we are in 2021. 1 1 Link to comment Share on other sites More sharing options...
Luigi Donato Posted April 22, 2021 Share Posted April 22, 2021 Is a solution.. 😐 1 Link to comment Share on other sites More sharing options...
jfdt Posted September 29, 2021 Share Posted September 29, 2021 Hello. First of all thank you very much for the attention and disinterested help. According to what you have indicated, how should I indicate to display first the categories and then the "product" part:{"1": "new-products", "2": "best-sales"} {"cms":[false],"static":[false],"product":{"1":"new-products","2":"best-sales"},"category":["10","3","9","11","12","6","13","1","15","14"]} Thank you very much Link to comment Share on other sites More sharing options...
chopemp Posted May 29, 2023 Share Posted May 29, 2023 You need to modify the ps_linklist module as below: in modules/ps_linklist/src/Presenter/LinkBlockPresenter.php around line 126, change the makeCmsLinks function as below: /** * @param array $cmsIds * * @return array * * @throws \PrestaShopDatabaseException * @throws \PrestaShopException */ private function makeCmsLinks($cmsIds) { $cmsLinks = []; foreach ($cmsIds as $cmsId) { $cms = new \CMS((int) $cmsId); if (null !== $cms->id && $cms->active) { $cmsLinks[] = [ 'id' => 'link-cms-page-' . $cms->id, 'class' => 'cms-page-link', 'title' => $cms->meta_title[(int) $this->language->id], 'description' => $cms->meta_description[(int) $this->language->id], 'url' => $this->link->getCMSLink($cms), 'position' => $cms->position, ]; } } // Extract the 'position' attribute values into a separate array $positions = array_column($cmsLinks, 'position'); // Sort the array of cmsLinks based on the 'position' attribute array_multisort($positions, $cmsLinks); return $cmsLinks; } This will sort the links according to their "position" attribute. 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