Jump to content

category Page as home page


wallybz

Recommended Posts

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

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

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

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