Missing route parameter error
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!
Missing route parameter error
In my multi shop multi language installation. I am getting this error after I change the routes in shop.php
Missing required parameter for [Route: aimeos_shop_jsonapi_options] [URI: {site}/{locale}/jsonapi/{resource?}] [Missing parameter: locale].
I am using :
Laravel 8
PHP 7.4
Aimeos 2020.10
My Controller code is :
and blade file is (unnecessary part removed):
shop.php file :
What extra needs to be done. Please help.
Missing required parameter for [Route: aimeos_shop_jsonapi_options] [URI: {site}/{locale}/jsonapi/{resource?}] [Missing parameter: locale].
I am using :
Laravel 8
PHP 7.4
Aimeos 2020.10
My Controller code is :
Code: Select all
public function indexAction(Request $request)
{
foreach( config( 'shop.page.catalog-detail' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->getHeader();
$params['aibody'][$name] = Shop::get( $name )->getBody();
}
// do some more stuff
return \View::make('welcome', $params);
}
Code: Select all
@extends('shop::base')
@section('aimeos_header')
<?= $aiheader['basket/mini'] ?>
<?= $aiheader['locale/select'] ?>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
@stop
@section('aimeos_head')
<?= $aibody['locale/select'] ?>
<?= $aibody['basket/mini'] ?>
@stop
Code: Select all
<?php
return [
'apc_enabled' => false, // enable for maximum performance if APCu is availalbe
'apc_prefix' => 'laravel:', // prefix for caching config and translation in APCu
'pcntl_max' => 4, // maximum number of parallel command line processes when starting jobs
'routes' => [
// Docs: https://aimeos.org/docs/Laravel/Custom_routes
// Multi-sites: https://aimeos.org/docs/Laravel/Configure_multiple_shops
// 'admin' => ['prefix' => 'admin', 'middleware' => ['web']],
// 'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth']],
// 'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth']],
'jsonapi' => ['prefix' => '{site}/{locale}/jsonapi', 'middleware' => ['web', 'api']],
'account' => ['prefix' => '{site}/{locale}/profile', 'middleware' => ['web', 'auth']],
'default' => ['prefix' => '{site}/{locale}/shop', 'middleware' => ['web']],
// 'update' => [],
],
'page' => [
// Docs: https://aimeos.org/docs/Laravel/Adapt_pages
// Hint: catalog/filter is also available as single 'catalog/search', 'catalog/tree', 'catalog/price', 'catalog/supplier' and 'catalog/attribute'
'account-index' => [ 'account/profile','account/review','account/subscription','account/history','account/favorite','account/watch','basket/mini','catalog/session' ],
'basket-index' => [ 'basket/bulk', 'basket/standard','basket/related' ],
'catalog-count' => [ 'catalog/count' ],
'catalog-detail' => [ 'basket/mini','locale/select','catalog/stage','catalog/detail','catalog/session','catalog/filter','catalog/lists' ],
'catalog-home' => [ 'basket/mini','catalog/search','catalog/tree','catalog/home' ],
'catalog-list' => [ 'basket/mini','catalog/filter','catalog/lists' ],
'catalog-stock' => [ 'catalog/stock' ],
'catalog-suggest' => [ 'catalog/suggest' ],
'catalog-tree' => [ 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ],
'checkout-confirm' => [ 'checkout/confirm' ],
'checkout-index' => [ 'checkout/standard' ],
'checkout-update' => [ 'checkout/update' ],
],
'admin' => [],
'client' => [
'html' => [
'locale' => [
'select' => [
'currency' => [
'param-name' => 'currency',
],
'language' => [
'param-name' => 'locale',
],
],
],
'basket' => [
'cache' => [
// 'enable' => false, // Disable basket content caching for development
],
],
'common' => [
'template' => [
// 'baseurl' => 'packages/aimeos/shop/themes/elegance',
],
],
],
],
'controller' => [
],
'i18n' => [
],
'madmin' => [
'cache' => [
'manager' => [
'name' => 'None', // Disable caching for development
],
],
'log' => [
'manager' => [
'standard' => [
// 'loglevel' => 7, // Enable debug logging into madmin_log table
],
],
],
],
'command' => [
],
'frontend' => [
],
'backend' => [
],
];
Last edited by zaheer on 13 Jan 2021, 10:40, edited 2 times in total.
Re: Missing route parameter error
You've configured the "jsonapi" route to require a "locale" parameter which leads to the error when the locale parameter isn't present:
You should remove it from the route and add it as "?locale=en" to the URL if necessary.
Code: Select all
'jsonapi' => ['prefix' => '{site}/{locale}/jsonapi', 'middleware' => ['web', 'api']],
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Missing route parameter error
Thanks for the reply.
My site is multilingual. Removing locale from jsonapi does solve the issue for main page, but shop pages are not working.
Leaving locale intact and adding ?locale=en works. But is there some other way because I need to display home page from main url.
In local machine :
http://localhost:8000 generates error
http://localhost:8000/?locale=en works
Problem is in this controller code :
foreach( config( 'shop.page.catalog-detail' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->getHeader();
$params['aibody'][$name] = Shop::get( $name )->getBody();
}
How can I add locale parameter in this code ?
My site is multilingual. Removing locale from jsonapi does solve the issue for main page, but shop pages are not working.
Leaving locale intact and adding ?locale=en works. But is there some other way because I need to display home page from main url.
In local machine :
http://localhost:8000 generates error
http://localhost:8000/?locale=en works
Problem is in this controller code :
foreach( config( 'shop.page.catalog-detail' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->getHeader();
$params['aibody'][$name] = Shop::get( $name )->getBody();
}
How can I add locale parameter in this code ?
Re: Missing route parameter error
Sorry for irrelevant question.
I think it was related to Laravel not Aimeos
Solved it by adding this to controller :
$request->request->add(['locale' => 'en']);
Is this the right way ?
I think it was related to Laravel not Aimeos
Solved it by adding this to controller :
$request->request->add(['locale' => 'en']);
Is this the right way ?