Product search function problems - possible bug?
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!
Product search function problems - possible bug?
Firstly, I ran into the same problems as other users with the search function not searching across the entire product catalog. I had set a default category for the home page to "Catering Pickup Menu" because of Covid19 changing peoples buying behavior. However they could not find products in other categories (Bakery for example) and I know there's been a huge thread devoted to this topic. As a work around, I changed the home page to redirect to this category.
Issue 1)
However, if now for example I search for "croissant" I can see the type ahead dropdown list of products with that word. If I click on Chocolate Croissant I get the detail page for that product. BUT if I just hit the "GO" Submit button on the search I get a 500 server error - with this error dialog:
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}].
https://shop.thefrenchgourmet.com/shop? ... =croissant
--------------------------------------------------------------------------------------------------------------------------
Illuminate\Routing\Exceptions\UrlGenerationException::forMissingParameters
:17
vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php:17
Issue 2) The problem is further complicated on mobile devices. If I search for say "croissant" while in any category and then clear the search using the X on the search field and then switch to any other category, the work croissant returns and no matter how many times I try to clear it or try to go to any other category the word "croissant" keeps coming back and filtering the products in that category.
Note that I am testing this on an iPhone 6 plus. This behavior (issue 2) doesn't happen on my development Windows PC running Chrome browser.
I have not changed any of the standard catalog function - just cosmetic changes, mainly in CSS. You can test on shop.thefrenchgourmet.com
Is this a bug or something wrong with my configuration?
Issue 1)
However, if now for example I search for "croissant" I can see the type ahead dropdown list of products with that word. If I click on Chocolate Croissant I get the detail page for that product. BUT if I just hit the "GO" Submit button on the search I get a 500 server error - with this error dialog:
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}].
https://shop.thefrenchgourmet.com/shop? ... =croissant
--------------------------------------------------------------------------------------------------------------------------
Illuminate\Routing\Exceptions\UrlGenerationException::forMissingParameters
:17
vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php:17
Code: Select all
<?php
namespace Illuminate\Routing\Exceptions;
use Exception;
class UrlGenerationException extends Exception
{
/**
* Create a new exception for missing route parameters.
*
* @param \Illuminate\Routing\Route $route
* @return static
*/
public static function forMissingParameters($route)
{
return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].");
}
}
Note that I am testing this on an iPhone 6 plus. This behavior (issue 2) doesn't happen on my development Windows PC running Chrome browser.
I have not changed any of the standard catalog function - just cosmetic changes, mainly in CSS. You can test on shop.thefrenchgourmet.com
Is this a bug or something wrong with my configuration?
Re: Product search function problems - possible bug?
The problem with setting a default category globaly is exactly that problem:xarga wrote: ↑02 Apr 2020, 00:24 Firstly, I ran into the same problems as other users with the search function not searching across the entire product catalog. I had set a default category for the home page to "Catering Pickup Menu" because of Covid19 changing peoples buying behavior. However they could not find products in other categories (Bakery for example) and I know there's been a huge thread devoted to this topic. As a work around, I changed the home page to redirect to this category.
It's used in all list views and limits the products to exactly this category.
The better approach is to copy these lines to your HomeController class for the home page:
https://github.com/aimeos/aimeos-larave ... hp#L70-L77
There you can add this additional line in front:
Code: Select all
app( 'aimeos.context' )->getConfig()->set( 'client/html/catalog/lists/catid-default', '...' );
Maybe it solves this issue too.xarga wrote: ↑02 Apr 2020, 00:24 Issue 1)
However, if now for example I search for "croissant" I can see the type ahead dropdown list of products with that word. If I click on Chocolate Croissant I get the detail page for that product. BUT if I just hit the "GO" Submit button on the search I get a 500 server error - with this error dialog:
Hard to say. Most likely, Safari behaves differently then Chrome. If it's related to the HTML and you find a solution, please create a PR on Github so we can fix it.xarga wrote: ↑02 Apr 2020, 00:24 Issue 2) The problem is further complicated on mobile devices. If I search for say "croissant" while in any category and then clear the search using the X on the search field and then switch to any other category, the work croissant returns and no matter how many times I try to clear it or try to go to any other category the word "croissant" keeps coming back and filtering the products in that category.
Note that I am testing this on an iPhone 6 plus. This behavior (issue 2) doesn't happen on my development Windows PC running Chrome browser.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Product search function problems - possible bug?
this doesn't work it just defaults to the root category
Per your suggestion in app/Http/Controllers/HomeController.php I have:
I don't have a default category defined in config/shop.php
I did have the following in routes/web.php which was my workaround for the problem and that was functioning OK::
I found that the search problems are not just limited to safari and mobile
Please try this to see the behavior for yourself - using Chrome
1) Go to https://shop.thefrenchgourmet.com
2) Search for the word "croissant" and press GO
3) You should get results because there are products with this term on the root page
4) Clear the word from the search box and select the category "Individual Meals"
5) Notice the word returns to the search box and clearing it does not clear the filter from the URL so no products can be seen in that category
6) If I clear the word "croissant" again AND press GO now I get the error page as before
Shouldn't clearing the search box also regenerate the URL?
Per your suggestion in app/Http/Controllers/HomeController.php I have:
Code: Select all
public function index()
{
app( 'aimeos.context' )->getConfig()->set( 'client/html/catalog/lists/catid-default', '21' );
return view('home');
}
I did have the following in routes/web.php which was my workaround for the problem and that was functioning OK::
Code: Select all
Route::get('/', function () {
return redirect('shop/Catering_Pick_Up_Menu~21');
});
Auth::routes();
Please try this to see the behavior for yourself - using Chrome
1) Go to https://shop.thefrenchgourmet.com
2) Search for the word "croissant" and press GO
3) You should get results because there are products with this term on the root page
4) Clear the word from the search box and select the category "Individual Meals"
5) Notice the word returns to the search box and clearing it does not clear the filter from the URL so no products can be seen in that category
6) If I clear the word "croissant" again AND press GO now I get the error page as before
Shouldn't clearing the search box also regenerate the URL?
Re: Product search function problems - possible bug?
You've not copied the lines from the catalog controller we've linked to, so it doesn't work.xarga wrote: ↑03 Apr 2020, 20:26 Per your suggestion in app/Http/Controllers/HomeController.php I have:Code: Select all
public function index() { app( 'aimeos.context' )->getConfig()->set( 'client/html/catalog/lists/catid-default', '21' ); return view('home'); }
Clearing the search box only clears the search box up to now but doesn't reload the page. When comparing to Magento, they keep the value of the search field too when you select a category so the behavior is exactly the same.
Aimeos contains an option to enforce the category in full text search (https://github.com/aimeos/ai-client-htm ... hp#L18-L34) but not an option to skip the full text search if you click on a category. You can do that by unsetting the "f_search" parameter in the tree partial:
https://github.com/aimeos/ai-client-htm ... d.php#L111
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Product search function problems - possible bug?
I now have in /ext/myshop/client/html/templates/catalog/filter/tree-partial-standard
in app/Http/Controllers/HomeController.php I have:
But after clearing cache nothing has changed.
The search function still unusable in a production environment.
Any search for a product leaves the search term in the box. Clearing the search and changing categories brings the search term back and nothing is found if the category doesn't contain it. Clearing the search in the new category and pressing GO in an attempt to show all products in the category causes an error:
Finally if I search for a word that doesn't exist in the category I get a normal "No articles found for "keyword". Please try again with a different keyword" but if I search for a word that is in the category but instead of selecting from the pre-emptive dropdown options I just hit GO I get a similar error also
Code: Select all
<?php /* MOD RMP <a class="cat-item" href="<?= $enc->attr( $this->url( ( $item->getTarget() ?: $target ), $controller, $action, $params, [], $config ) ); ?>"> END MOD RMP */?>
<a class="cat-item" href="<?= $enc->attr( $this->url( $item->getTarget() ?: $target, $controller, $action, array_merge( $this->get( 'params', [] ), ['f_name' => $item->getName( 'url' ), 'f_catid' => $item->getId()] ), [], $config ) ); ?>"><!--
--><div class="media-list"><!--
Code: Select all
public function index()
{
app( 'aimeos.context' )->getConfig()->set( 'client/html/catalog/lists/catid-default', '21' );
foreach( app( 'config' )->get( 'shop.page.catalog-list' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->getHeader();
$params['aibody'][$name] = Shop::get( $name )->getBody();
}
return Response::view( 'shop::catalog.list', $params )
->header( 'Cache-Control', 'private, max-age=10' );
// return view('home');
}
The search function still unusable in a production environment.
Any search for a product leaves the search term in the box. Clearing the search and changing categories brings the search term back and nothing is found if the category doesn't contain it. Clearing the search in the new category and pressing GO in an attempt to show all products in the category causes an error:
Code: Select all
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}].
http://localhost:8000/shop?_token=QHse5vY42gCJYpjaG3al1ZDJblBUUn59PysnXtZQ&f_catid=14&f_search=
Illuminate\Routing\Exceptions\UrlGenerationException::forMissingParameters
:17
C:\xampp\htdocs\shop\vendor\laravel\framework\src\Illuminate\Routing\Exceptions\UrlGenerationException.php:17
<?php
namespace Illuminate\Routing\Exceptions;
use Exception;
class UrlGenerationException extends Exception
{
/**
* Create a new exception for missing route parameters.
*
* @param \Illuminate\Routing\Route $route
* @return static
*/
public static function forMissingParameters($route)
{
return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].");
}
}
Code: Select all
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}].
http://localhost:8000/shop?_token=QHse5vY42gCJYpjaG3al1ZDJblBUUn59PysnXtZQ&f_catid=11&f_search=chocolate
Re: Product search function problems - possible bug?
This doesn't remove the f_search parameter because it's still in $this->get( 'params', [] )xarga wrote: ↑09 Apr 2020, 02:04 I now have in /ext/myshop/client/html/templates/catalog/filter/tree-partial-standard
Code: Select all
<?php /* MOD RMP <a class="cat-item" href="<?= $enc->attr( $this->url( ( $item->getTarget() ?: $target ), $controller, $action, $params, [], $config ) ); ?>"> END MOD RMP */?> <a class="cat-item" href="<?= $enc->attr( $this->url( $item->getTarget() ?: $target, $controller, $action, array_merge( $this->get( 'params', [] ), ['f_name' => $item->getName( 'url' ), 'f_catid' => $item->getId()] ), [], $config ) ); ?>"><!-- --><div class="media-list"><!--
Here's working code for app/Http/Controllers/HomeController.php:
Code: Select all
namespace App\Http\Controllers;
use Aimeos\Shop\Facades\Shop;
use Illuminate\Support\Facades\Response;
class HomeController extends Controller
{
public function index()
{
app( 'aimeos.context' )->get()->getConfig()->set( 'client/html/catalog/lists/catid-default', '21' );
foreach( app( 'config' )->get( 'shop.page.catalog-list' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->getHeader();
$params['aibody'][$name] = Shop::get( $name )->getBody();
}
return Response::view( 'shop::catalog.list', $params )
->header( 'Cache-Control', 'private, max-age=10' );
}
}
Code: Select all
Route::get('/', 'HomeController@index')->name('home');
The standard setup doesn't behave like that. What's the complete stack trace?xarga wrote: ↑09 Apr 2020, 02:04 Finally if I search for a word that doesn't exist in the category I get a normal "No articles found for "keyword". Please try again with a different keyword" but if I search for a word that is in the category but instead of selecting from the pre-emptive dropdown options I just hit GO I get a similar error also
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Product search function problems - possible bug?
Here's the request and stack trace
Request
URL
http://localhost:8000/shop?_token=Ob4l9 ... cheesecake
Method
GET
--------------------------------------------------------------------
__________________________________________
Request
URL
http://localhost:8000/shop?_token=Ob4l9 ... cheesecake
Method
GET
--------------------------------------------------------------------
Code: Select all
C:\xampp\htdocs\shop\
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: aimeos_shop_tree] [URI: shop/{f_name}~{f_catid}].
http://localhost:8000/shop?_token=Ob4l9IMW2uHtcM29MnLGfJ47ivN0gQpEb9vyat7N&f_catid=11&f_search=cheesecake
Stack trace
Request
App
User
Context
Debug
Share
Collapse vendor frames
53
C:\xampp\htdocs\shop\vendor\laravel\framework\src\Illuminate\Routing\Exceptions\UrlGenerationException.php
Illuminate\Routing\Exceptions\UrlGenerationException
:17
52
C:\xampp\htdocs\shop\vendor\laravel\framework\src\Illuminate\Routing\RouteUrlGenerator.php
Illuminate\Routing\RouteUrlGenerator
:91
51
Illuminate\Routing\UrlGenerator
:436
50
Illuminate\Routing\UrlGenerator
:417
49
Aimeos\MW\View\Helper\Url\Laravel5
:61
1 unknown frame
47
C:\xampp\htdocs\shop\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\View\Standard.php
Aimeos\MW\View\Standard
:88
46
:150
45
Aimeos\MW\View\Standard
:257
44
Aimeos\MW\View\Standard
:239
43
Aimeos\Client\Html\Catalog\Lists\Standard
:207
42
Aimeos\Shop\Controller\CatalogController
:73
1 unknown frame
40
C:\xampp\htdocs\shop\vendor\laravel\framework\src\Illuminate\Routing\Controller.php
Illuminate\Routing\Controller
:54
39
Illuminate\Routing\ControllerDispatcher
:45
38
Illuminate\Routing\Route
:219
37
Illuminate\Routing\Route
:176
36
Illuminate\Routing\Router
:681
35
Illuminate\Pipeline\Pipeline
:130
34
Illuminate\Routing\Middleware\SubstituteBindings
:41
33
Illuminate\Pipeline\Pipeline
:171
32
Illuminate\Foundation\Http\Middleware\VerifyCsrfToken
:76
31
Illuminate\Pipeline\Pipeline
:171
30
Illuminate\View\Middleware\ShareErrorsFromSession
:49
29
Illuminate\Pipeline\Pipeline
:171
28
Illuminate\Session\Middleware\StartSession
:56
27
Illuminate\Pipeline\Pipeline
:171
26
Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
:37
25
Illuminate\Pipeline\Pipeline
:171
24
Illuminate\Cookie\Middleware\EncryptCookies
:66
23
Illuminate\Pipeline\Pipeline
:171
22
Illuminate\Pipeline\Pipeline
:105
21
Illuminate\Routing\Router
:683
20
Illuminate\Routing\Router
:658
19
Illuminate\Routing\Router
:624
18
Illuminate\Routing\Router
:613
17
Illuminate\Foundation\Http\Kernel
:170
16
Illuminate\Pipeline\Pipeline
:130
15
Illuminate\Foundation\Http\Middleware\TransformsRequest
:21
14
Illuminate\Pipeline\Pipeline
:171
13
Illuminate\Foundation\Http\Middleware\TransformsRequest
:21
12
Illuminate\Pipeline\Pipeline
:171
11
Illuminate\Foundation\Http\Middleware\ValidatePostSize
:27
10
Illuminate\Pipeline\Pipeline
:171
9
Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode
:63
8
Illuminate\Pipeline\Pipeline
:171
7
Fideloper\Proxy\TrustProxies
:57
6
Illuminate\Pipeline\Pipeline
:171
5
Illuminate\Pipeline\Pipeline
:105
4
Illuminate\Foundation\Http\Kernel
:145
3
Illuminate\Foundation\Http\Kernel
:110
2
:55
1
:21
Illuminate\Routing\Exceptions\UrlGenerationException::forMissingParameters
:17
C:\xampp\htdocs\shop\vendor\laravel\framework\src\Illuminate\Routing\Exceptions\UrlGenerationException.php:17
<?php
namespace Illuminate\Routing\Exceptions;
use Exception;
class UrlGenerationException extends Exception
{
/**
* Create a new exception for missing route parameters.
*
* @param \Illuminate\Routing\Route $route
* @return static
*/
public static function forMissingParameters($route)
{
return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].");
}
}
Re: Product search function problems - possible bug?
Unfortunately, the stack strace is incomplete. We need the stack trace as generated by PHP, not displayed by Laravel.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
