Skip to content

Error during work of Distance based source selection algorithm in PR #1866 #1931

Closed
@smoskaluk

Description

@smoskaluk

Preconditions

1.Set Distance based source selection algorithm settings on configuration page in admin (Catalog -> Inventory), select 'Google Map' as provider for distance based SSA, set proper Google API key
2. Create Test stock with two test sources with proper location data and assign it to Main website as sales channel
3. Create simple product and assign it to both of test sources
4. Place order with created simple product

Steps to reproduce

  1. Open order in admin and start to create shipment for it
  2. On source selection page try to apply Distance based source selection algorithm

Expected result

  1. [Screenshots, logs or description]
  2. Distance based source selection algorithm works properly

Actual result

  1. [Screenshots, logs or description]
  2. Error "A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later."

image

1 exception(s):
Exception #0 (Exception): Notice: Undefined index: distance in /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/DistanceProvider/GoogleMap/GetDistance.php on line 110

Exception #0 (Exception): Notice: Undefined index: distance in /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/DistanceProvider/GoogleMap/GetDistance.php on line 110
#0 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/DistanceProvider/GoogleMap/GetDistance.php(110): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/home/slava/Php...', 110, Array)
#1 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/DistanceProvider/GeoReferenceProvider.php(72): Magento\InventorySourceSelection\Model\DistanceProvider\GoogleMap\GetDistance->execute(Object(Magento\InventorySourceSelection\Model\Request\LatLngRequest), Object(Magento\InventorySourceSelection\Model\Request\LatLngRequest))
#2 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/Algorithms/DistanceBasedAlgorithm.php(104): Magento\InventorySourceSelection\Model\DistanceProvider\GeoReferenceProvider->getDistance(Object(Magento\Inventory\Model\Source), Object(Magento\InventorySourceSelection\Model\Request\AddressRequest))
#3 [internal function]: Magento\InventorySourceSelection\Model\Algorithms\DistanceBasedAlgorithm->Magento\InventorySourceSelection\Model\Algorithms{closure}(Object(Magento\Inventory\Model\Source), Object(Magento\Inventory\Model\Source))
#4 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/Algorithms/DistanceBasedAlgorithm.php(108): uasort(Array, Object(Closure))
#5 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/Algorithms/DistanceBasedAlgorithm.php(72): Magento\InventorySourceSelection\Model\Algorithms\DistanceBasedAlgorithm->getEnabledSourcesOrderedByDistanceByStockId(2, Object(Magento\InventorySourceSelection\Model\Request\AddressRequest))
#6 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventorySourceSelection/Model/SourceSelectionService.php(61): Magento\InventorySourceSelection\Model\Algorithms\DistanceBasedAlgorithm->execute(Object(Magento\InventorySourceSelection\Model\Request\InventoryRequest))
#7 /home/slava/PhpstormProjects/pr1/app/code/Magento/InventoryShippingAdminUi/Controller/Adminhtml/SourceSelection/ProcessAlgorithm.php(145): Magento\InventorySourceSelection\Model\SourceSelectionService->execute(Object(Magento\InventorySourceSelection\Model\Request\InventoryRequest), 'distance')
#8 /home/slava/PhpstormProjects/pr1/generated/code/Magento/InventoryShippingAdminUi/Controller/Adminhtml/SourceSelection/ProcessAlgorithm/Interceptor.php(24): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm->execute()
#9 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/App/Action/Action.php(107): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->execute()
#10 /home/slava/PhpstormProjects/pr1/app/code/Magento/Backend/App/AbstractAction.php(231): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#11 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#12 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->___callParent('dispatch', Array)
#13 /home/slava/PhpstormProjects/pr1/app/code/Magento/Backend/App/Action/Plugin/Authentication.php(143): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))
#14 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#15 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))
#16 /home/slava/PhpstormProjects/pr1/generated/code/Magento/InventoryShippingAdminUi/Controller/Adminhtml/SourceSelection/ProcessAlgorithm/Interceptor.php(52): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->___callPlugins('dispatch', Array, NULL)
#17 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/App/FrontController.php(159): Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#18 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/App/FrontController.php(99): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\InventoryShippingAdminUi\Controller\Adminhtml\SourceSelection\ProcessAlgorithm\Interceptor))
#19 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#20 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#21 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))
#22 /home/slava/PhpstormProjects/pr1/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#23 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /home/slava/PhpstormProjects/pr1/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#25 /home/slava/PhpstormProjects/pr1/lib/internal/Magento/Framework/App/Bootstrap.php(257): Magento\Framework\App\Http\Interceptor->launch()
#26 /home/slava/PhpstormProjects/pr1/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#27 {main}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions