Want To Change Category Url
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 86
- Joined: 12 Jan 2019, 15:17
Want To Change Category Url
Default category url is http://......com/catgegoryname~categoryid
want to change it to only category name means
http://......com/catgegoryname
Please guide how can i do that
Thanks
want to change it to only category name means
http://......com/catgegoryname
Please guide how can i do that
Thanks
Re: Want To Change Category Url
That will be difficult because the category name must be unique then and this is only rarely the case. Furthermore, things get more complicated if category names should translated into several languages.
For products, we've added a resolve() method to the product frontend controller that is used in the HTML client and which finds the product by its name:
https://github.com/aimeos/ai-controller ... #L294-L310
For products, we've added a resolve() method to the product frontend controller that is used in the HTML client and which finds the product by its name:
https://github.com/aimeos/ai-controller ... #L294-L310
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 86
- Joined: 12 Jan 2019, 15:17
Re: Want To Change Category Url
Can i replace this "~" with forward slash if yes then where i have to do the changesaimeos wrote: ↑14 Jan 2020, 15:02 That will be difficult because the category name must be unique then and this is only rarely the case. Furthermore, things get more complicated if category names should translated into several languages.
For products, we've added a resolve() method to the product frontend controller that is used in the HTML client and which finds the product by its name:
https://github.com/aimeos/ai-controller ... #L294-L310
Re: Want To Change Category Url
Only if you change the product detail routes too because they already use a "/" for separating name and id and/or pos. Otherwise, the Laravel router won't be able to distingish which route to use.
You can add a prefix like /category_name/c/123 to make routes unique.
You can add a prefix like /category_name/c/123 to make routes unique.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Want To Change Category Url
Is is possible to create a custom route for instance /mytestpage/{f_catid} for category view? If so how I would disable required f_name param?
I've tried a similar approach, created a router but w/o f_name i'm getting an error handling the request
Error --
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}] [Missing parameter: f_name].
URL: http://localhost:8000/category/2
Route: Route::get('category/{f_catid}/{f_name?}', '\Aimeos\Shop\Controller\CatalogController@treeAction');
Also same results with route: 'category/{f_catid}'
I've tried a similar approach, created a router but w/o f_name i'm getting an error handling the request
Error --
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}] [Missing parameter: f_name].
URL: http://localhost:8000/category/2
Route: Route::get('category/{f_catid}/{f_name?}', '\Aimeos\Shop\Controller\CatalogController@treeAction');
Also same results with route: 'category/{f_catid}'
Re: Want To Change Category Url
You can overwrite existing Laravel routes by their name in ./routes/web.php, e.g.:
Because the f_name parameter is added when the URL is generated in the template, it will be part of the URL as
Code: Select all
Route::match( array( 'GET', 'POST' ), 'mytestpage/{f_catid}', array(
'as' => 'aimeos_shop_tree',
'uses' => 'Aimeos\Shop\Controller\CatalogController@treeAction'
) )->where( ['site' => '[a-z0-9\.\-]+' );
Code: Select all
/mytestpage/123?f_name=test
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Want To Change Category Url
Thanks, adding name for the route did the trick!