tastyigniter / TastyIgniter

:fire: Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
https://tastyigniter.com
MIT License
3.03k stars 994 forks source link

Error on add item into cart #493

Closed ideohk closed 4 years ago

ideohk commented 4 years ago

Expected behavior: Item add into cart

Actual behavior: No item is added with error: ""Trying to get property 'mealtime_name' of non-object" on line 290"

Reproduce steps: Add item into cart

Version: v3.0.4-beta.23

ryanmitchell commented 4 years ago

@ideokh can you provide a full stack trace and I will look into it

ideohk commented 4 years ago

2020-09-22 15:49:08 ErrorException: Trying to get property 'mealtime_name' of non-object in /home/somedirectory/public_html/restaurant.somedomain.net/extensions/igniter/cart/classes/CartManager.php:290 Stack trace:

0 /home/somedirectory/public_html/restaurant.somedomain.net/extensions/igniter/cart/classes/CartManager.php(290): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', '/home/somedirectory/...', 290, Array)

1 /home/somedirectory/public_html/restaurant.somedomain.net/extensions/igniter/cart/components/CartBox.php(152): Igniter\Cart\Classes\CartManager->validateMenuItem(Object(Igniter\Cart\Models\Menus_model))

2 /home/somedirectory/public_html/restaurant.somedomain.net/app/system/classes/BaseComponent.php(135): Igniter\Cart\Components\CartBox->onLoadItemPopup()

3 /home/somedirectory/public_html/restaurant.somedomain.net/app/main/classes/MainController.php(415): System\Classes\BaseComponent->runEventHandler('onLoadItemPopup')

4 /home/somedirectory/public_html/restaurant.somedomain.net/app/main/classes/MainController.php(368): Main\Classes\MainController->runHandler('cartBox::onLoad...')

5 /home/somedirectory/public_html/restaurant.somedomain.net/app/main/classes/MainController.php(258): Main\Classes\MainController->processHandlers()

6 /home/somedirectory/public_html/restaurant.somedomain.net/app/main/classes/MainController.php(199): Main\Classes\MainController->runPage(Object(Main\Template\Page))

7 /home/somedirectory/public_html/restaurant.somedomain.net/app/system/classes/Controller.php(85): Main\Classes\MainController->remap('central/menus')

8 [internal function]: System\Classes\Controller->run('central/menus')

9 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)

10 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('run', Array)

11 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(System\Classes\Controller), 'run')

12 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()

13 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Route->run()

14 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))

15 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(77): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

16 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))

17 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/tastyigniter/flame/src/Currency/Middleware/CurrencyMiddleware.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

18 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Igniter\Flame\Currency\Middleware\CurrencyMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))

19 /home/somedirectory/public_html/restaurant.somedomain.net/extensions/igniter/cart/middleware/CartMiddleware.php(12): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

20 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Igniter\Cart\Middleware\CartMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))

21 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/tastyigniter/flame/src/Translation/Middleware/Localization.php(40): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

22 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Igniter\Flame\Translation\Middleware\Localization->handle(Object(Illuminate\Http\Request), Object(Closure))

23 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

24 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))

25 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

26 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))

27 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

28 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))

29 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

30 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))

31 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

32 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))

33 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

34 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then(Object(Closure))

35 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

36 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

37 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

38 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))

39 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))

40 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/tastyigniter/flame/src/Setting/Middleware/SaveSetting.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

41 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Igniter\Flame\Setting\Middleware\SaveSetting->handle(Object(Illuminate\Http\Request), Object(Closure))

42 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

43 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

44 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

45 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

46 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

47 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

48 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

49 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))

50 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

51 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then(Object(Closure))

52 /home/somedirectory/public_html/restaurant.somedomain.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

53 /home/somedirectory/public_html/restaurant.somedomain.net/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

54 {main}

ryanmitchell commented 4 years ago

Thanks, here's a PR with an initial fix: https://github.com/tastyigniter/ti-ext-cart/pull/25