wallybz Posted April 14, 2023 Share Posted April 14, 2023 Hi all. I'm using PS 1.7.6.3. I have a multishop with 3 shops. Each shop has his own domain. I would like to start each shop not with the classic homepage but with the main category page of each multishop. Any suggestion on how to do this? Thanks Walter Link to comment Share on other sites More sharing options...
Mian Waqas Posted April 15, 2023 Share Posted April 15, 2023 To start each shop with the main category page of the respective multishop, you can modify the Dispatcher.php file of Prestashop. Here are the steps: Make a backup of the Dispatcher.php file located in the classes folder of your Prestashop installation. Open the Dispatcher.php file and find the dispatch() method. Inside the dispatch() method, you'll find the code that determines which page to display based on the URL. You can modify this code to redirect to the main category page of the respective multishop. To redirect to the main category page of a multishop, you can use the following code: Tools::redirect('index.php?controller=category&id_category=' . (int) Configuration::get('PS_HOME_CATEGORY'), null, null, 'http://' . $domain . __PS_BASE_URI__); Replace $domain with the domain name of the respective shop. This code will redirect to the main category page of the multishop. Repeat step 4 for each shop, replacing $domain with the domain name of each shop. Save the modified Dispatcher.php file. Clear the Prestashop cache. After these steps, when a user visits the homepage of any shop, they will be redirected to the main category page of the respective multishop. Link to comment Share on other sites More sharing options...
prestaotop Posted April 16, 2023 Share Posted April 16, 2023 Hi @wallybz, Is it possible to mark the ticket as « resolved » ? Regards, Link to comment Share on other sites More sharing options...
wallybz Posted April 17, 2023 Author Share Posted April 17, 2023 8 hours ago, prestaotop said: Hi @wallybz, Is it possible to mark the ticket as « resolved » ? Regards, Hi @prestaotop, first let me try if it works. Link to comment Share on other sites More sharing options...
wallybz Posted April 17, 2023 Author Share Posted April 17, 2023 On 4/15/2023 at 10:42 PM, Mian Waqas said: To start each shop with the main category page of the respective multishop, you can modify the Dispatcher.php file of Prestashop. Here are the steps: Make a backup of the Dispatcher.php file located in the classes folder of your Prestashop installation. Open the Dispatcher.php file and find the dispatch() method. Inside the dispatch() method, you'll find the code that determines which page to display based on the URL. You can modify this code to redirect to the main category page of the respective multishop. To redirect to the main category page of a multishop, you can use the following code: Tools::redirect('index.php?controller=category&id_category=' . (int) Configuration::get('PS_HOME_CATEGORY'), null, null, 'http://' . $domain . __PS_BASE_URI__); Replace $domain with the domain name of the respective shop. This code will redirect to the main category page of the multishop. Repeat step 4 for each shop, replacing $domain with the domain name of each shop. Save the modified Dispatcher.php file. Clear the Prestashop cache. After these steps, when a user visits the homepage of any shop, they will be redirected to the main category page of the respective multishop. thanks @Mian Waqas that's exactly what I need. I tried to modify but it does not work. I obtain a "ERR_TOO_MANY_REDIRECTS" error from the browser. The url changes to: https://mydomain/it/index.php?controller=category?id_category=2169 I added the line just before the // Instantiate controller step of the dispatch() method Any idea ? Thanks Link to comment Share on other sites More sharing options...
Mian Waqas Posted April 17, 2023 Share Posted April 17, 2023 46 minutes ago, wallybz said: thanks @Mian Waqas that's exactly what I need. i guess, clear your cookies, regenerate .htaccess file . this one is related to friendly url/url_rewrite stuff. just play with it around 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