di.xml 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  10. <preference for="Magento\InventoryDistanceBasedSourceSelectionApi\Api\GetDistanceProviderCodeInterface"
  11. type="Magento\InventoryDistanceBasedSourceSelection\Model\GetDistanceProviderCode"/>
  12. <preference for="Magento\InventoryDistanceBasedSourceSelectionApi\Api\Data\LatLngInterface"
  13. type="Magento\InventoryDistanceBasedSourceSelection\Model\LatLng"/>
  14. <type name="Magento\InventorySourceSelectionApi\Model\SourceSelectionService">
  15. <arguments>
  16. <argument name="sourceSelectionMethods" xsi:type="array">
  17. <item name="distance"
  18. xsi:type="string">Magento\InventoryDistanceBasedSourceSelection\Model\Algorithms\DistanceBasedAlgorithm</item>
  19. </argument>
  20. </arguments>
  21. </type>
  22. <type name="Magento\InventorySourceSelectionApi\Model\GetSourceSelectionAlgorithmList">
  23. <arguments>
  24. <argument name="availableAlgorithms" xsi:type="array">
  25. <item name="distance" xsi:type="array">
  26. <item xsi:type="string" name="code">distance</item>
  27. <item xsi:type="string" name="title" translatable="true">Distance Priority</item>
  28. <item xsi:type="string" name="description" translatable="true">Algorithm which provides Source Selections based on shipping address distance from the source</item>
  29. </item>
  30. </argument>
  31. </arguments>
  32. </type>
  33. <type name="Magento\InventoryDistanceBasedSourceSelectionApi\Model\GetDistance">
  34. <arguments>
  35. <argument name="providers" xsi:type="array">
  36. <item name="google" xsi:type="object">Magento\InventoryDistanceBasedSourceSelection\Model\DistanceProvider\GoogleMap\GetDistance</item>
  37. <item name="offline" xsi:type="object">Magento\InventoryDistanceBasedSourceSelection\Model\DistanceProvider\Offline\GetDistance</item>
  38. </argument>
  39. </arguments>
  40. </type>
  41. <type name="Magento\InventoryDistanceBasedSourceSelectionApi\Model\GetLatLngFromAddress">
  42. <arguments>
  43. <argument name="providers" xsi:type="array">
  44. <item name="google" xsi:type="object">Magento\InventoryDistanceBasedSourceSelection\Model\DistanceProvider\GoogleMap\GetLatLngFromAddress</item>
  45. <item name="offline" xsi:type="object">Magento\InventoryDistanceBasedSourceSelection\Model\DistanceProvider\Offline\GetLatLngFromAddress</item>
  46. </argument>
  47. </arguments>
  48. </type>
  49. <type name="Magento\InventoryApi\Api\SourceRepositoryInterface">
  50. <plugin sortOrder="10" name="updateSourceLatitudeAndLongitude"
  51. type="Magento\InventoryDistanceBasedSourceSelection\Plugin\FillSourceLatitudeAndLongitude"/>
  52. </type>
  53. <type name="Magento\Config\Model\Config\TypePool">
  54. <arguments>
  55. <argument name="sensitive" xsi:type="array">
  56. <item name="cataloginventory/source_selection_distance_based_google/api_key" xsi:type="string">1</item>
  57. </argument>
  58. <argument name="environment" xsi:type="array">
  59. <item name="cataloginventory/source_selection_distance_based_google/api_key" xsi:type="string">1</item>
  60. </argument>
  61. </arguments>
  62. </type>
  63. <type name="Magento\InventoryDistanceBasedSourceSelection\Model\ImportGeoNames">
  64. <arguments>
  65. <argument name="geoNamesBaseUrl" xsi:type="string">http://download.geonames.org/export/zip/</argument>
  66. </arguments>
  67. </type>
  68. <type name="Magento\Framework\Console\CommandListInterface">
  69. <arguments>
  70. <argument name="commands" xsi:type="array">
  71. <item name="importGeoNames" xsi:type="object">Magento\InventoryDistanceBasedSourceSelection\Console\Command\ImportGeoNamesCommand</item>
  72. </argument>
  73. </arguments>
  74. </type>
  75. </config>