Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#6231 by mohal_04
14 Jun 2018, 10:42
Laravel: 5.6
Aimeos: 2018.04
PHP: 7.0

Hi,

I want to show related products. So, from Admin panel I added suggested product (Product B) against a product (Product A) but when I go to front-end of that product (Product A) I get following error:

A non-recoverable error occured


I further investigated and found out that the following line of code in ./ext/ai-client-html/client/html/src/Client/Html/Catalog/Detail/Standard.php is causing the error.

Code: Select all$products = $prodCntl->getItems( array_keys( $productItem->getRefItems( 'product' ) ), $domains );


Please, advise!

Regards!
#6251 by mohal_04
21 Jun 2018, 10:59
aimeos wrote:Can you please post the error message and the stack trace for this error stored in the madmin_log table. You can also see it in the log panel of the admin interface.


Hi,

I am getting following error message:

Undefined index: date


And here is the stack trace:

#0 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Item\Standard.php(371): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', 'E:\\xampp_php7_1...', 371, Array)
#1 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Common\Item\ListRef\Base.php(140): Aimeos\MShop\Product\Item\Standard->isAvailable()
#2 E:\xampp_php7_1_18\htdocs\interloper-laravel\ext\ai-client-html\client\html\src\Client\Html\Catalog\Detail\Standard.php(484): Aimeos\MShop\Common\Item\ListRef\Base->getRefItems('product')
#3 E:\xampp_php7_1_18\htdocs\interloper-laravel\ext\ai-client-html\client\html\src\Client\Html\Catalog\Detail\Standard.php(204): Aimeos\Client\Html\Catalog\Detail\Standard->addData(Object(Aimeos\MW\View\Standard), Array, '2018-09-05 00:0...')
#4 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\aimeos\aimeos-laravel\src\Aimeos\Shop\Base\Page.php(92): Aimeos\Client\Html\Catalog\Detail\Standard->getHeader()
#5 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\aimeos\aimeos-laravel\src\Aimeos\Shop\Controller\CatalogController.php(46): Aimeos\Shop\Base\Page->getSections('catalog-detail')
#6 [internal function]: Aimeos\Shop\Controller\CatalogController->detailAction('351', 'FIC_AZ11EA', '1')
#7 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): call_user_func_array(Array, Array)
#8 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('detailAction', Array)
#9 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Aimeos\Shop\Controller\CatalogController), 'detailAction')
#10 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php(169): Illuminate\Routing\Route->runController()
#11 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(665): Illuminate\Routing\Route->run()
#12 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#13 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#14 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#15 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#16 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(67): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#20 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#21 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#23 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#26 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#29 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#32 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(667): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#33 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(642): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#34 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(608): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#35 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php(597): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#36 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#37 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#38 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#42 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#45 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#47 E:\xampp_php7_1_18\htdocs\interloper-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#48 E:\xa…


Please, advise!

Regards!
#6254 by mohal_04
21 Jun 2018, 11:49
aimeos wrote:Did you overwrite the product manager with an own version and misses the createItemBase() method of your own manager this line:
https://github.com/aimeos/aimeos-core/blob/2018.04/lib/mshoplib/src/MShop/Product/Manager/Standard.php#L780


Hi,

Thanks for the hint. It helped. I had to add that line in my overwrite method. I had createItemBase() method but it was missing

Code: Select all$values['date'] = $this->date;


So, added following lines of code

Code: Select all$context = $this->getContext();
$this->date = $context->getDateTime();
$values['date'] = $this->date;


And obviously, added

Code: Select allprivate $date;


at top.

Regards!