How to Customize Product and Category URL Routes in Bagisto?
-
Hello Bagisto Community,
I’m working on a Bagisto 2.2 project and need to modify the default URL structure for products and categories. Currently, the URLs are structured as:
Products: domain.com/{product-slug}
Categories: domain.com/{category-slug}
Goal:
I’d like to restructure them to:-
Products: domain.com/{category-slug}/products/{product-slug}
-
list itemCategories: domain.com/category/{category-slug}
Is there a built-in way to customize product/category routes in Bagisto?
How can I ensure breadcrumbs reflect the new URL hierarchy (Home > Category > Product)?
Any guidance, code snippets, or references to existing modules would be greatly appreciated!
Environment:
Bagisto 2.2.0
PHP 8.1
MySQL 8.0
Thank you!
-
-
Hello @olivexy
You can manage this from routes currently we are managing with the ID if you want you can add the global parameter slug and pass that into the route and controller accordingly.
File path for Category Admin
packages >> Webkul >> Admin >> src >> Routes >> catalog-routes.php
packages >> Webkul >> Admin >> src >> Http >> Controllers >> Catalog >> CategoryController.php
Product Controller File Path
packages >> Webkul >> Admin >> src >> Http >> Controllers >> Catalog >> ProductController.php
Thanks & Regards
-
@Rishabh-Webkul said in How to Customize Product and Category URL Routes in Bagisto?:
You can manage this from routes currently we are managing with the ID if you want you can add the global parameter slug and pass that into the route and controller accordingly.
your awnser for admin routes? i think question about store routes. not admin routes.
-
@Rishabh-Webkul this going to be reflected in the frontend?