Base Commerce-> Point of Service menüsündeki kayıtlar StorFinder sayfasında gösterilir ancak buranın beslenmesi için ayrıca zamanlanmış görev ile kayıt atılması gerekmektedir. Buraya atılan kayıtların enlem-boylam koordinat bilgileri de olmalıdır yoksa ekranda ilgili noktalar gösterilemez. Koordinat bilgileri mevcut değil ise Backoffice-> System-> Background Processes-> Cron Jobs-> Geocode Address Job-> Run Cron Job’ı tıklarsanız Point of Service’deki adreslerin koordinat bilgilerini günceller, bu işlemi elle yapmak yerine görevi zamanlayabilirsiniz. Bu işlem Google API Key’e ihtiyaç duyacaktır bu değeri config Module-> local.properties içerisinde googleApiKey=AI…uE şeklinde tanımlamalısınız. Zamanlanmış görevi tetiklediğinizde konsolda aşağıdaki gibi çıktı görebilirsiniz. INFO [hybrisHTTP20] [PerformCronJobAction] Performing CronJob GeocodeAddressesCronJobModel (8796097020405@0) from Backoffice! /store-finder sayfasında arama sonucundaki liste varsayılan olarak KM şeklinde gelir ve uzaklık ise kuşbakışı mesafe hesaplanarak ekrana yansır. Google Maps’in yasal zorunluluğundan dolayı standartta gelen sahte servis yerine aşağıdaki gibi Google Maps Geo Service Wrapper’ı kullanabilirsiniz. Yasal zorunluluk ile ilgili SAP dokümanına aşağıdaki bağlantı adresinden ulaşabilirsiniz. https://help.sap.com/viewer/9d346683b0084da2938be8a285c0c27a/6.7.0.0/en-US/8c64c8fa86691014b0b5847235dd5a02.html SAP Commerce standartını kullanmak için aşğaıdaki değişikliklerin yapılması gerekmektedir. /y_/hybris/bin/custom/pwrtool/pwrtoolcore/resources/pwrtoolcore-spring.xml [code lang=”xml”] <!– override Storefinder service for using GoogleMapsGeoServiceWrapper –> <alias name="defaultStoreFinderService" alias="storeFinderService"/> <bean id="defaultStoreFinderService" class="de.hybris.platform.commerceservices.storefinder.impl.DefaultStoreFinderService"> <property name="pointOfServiceDao" ref="pointOfServiceDao"/> <property name="geoWebServiceWrapper" ref="googleMapsGeoServiceWrapper"/> <!– <property name="siteConfigService" ref="siteConfigService"/> –> <property name="pointOfServicePagedGenericDao" ref="pointOfServicePagedGenericDao"/> <property name="pointOfServiceGenericDao" ref="pointOfServiceGenericDao"/> </bean> <!– override GoogleMapTools for setting googleKey with googleKey and baseUrl value –> <alias name="defaultGoogleMapTools" alias="googleMapTools"/> <bean id="defaultGoogleMapTools" class="de.hybris.platform.storelocator.impl.GoogleMapTools" scope="prototype"> <property name="addressLocationParser" ref="firstPlacemarkWinsGoogleResponseParser"/> <property name="routeDataParser" ref="routeDataGoogleResponseParser"/> <property name="directionsUrlBuilder" ref="geolocationDirectionsUrlBuilder"/> <property name="googleKey" value="#{configurationService.configuration.getProperty(‘googleApiKey’)}"/> <property name="baseUrl" value="#{configurationService.configuration.getProperty(‘google.geocoding.url’)}"/> </bean> [/code] Bean property değerini beslemek için properties dosyasından yararlanabilirsiniz. /y_/hybris/bin/custom/pwrtool/pwrtoolstorefront/project.properties [code lang=”xml”] googleApiKey=AI-uE #geolocation properties google.geocoding.url=https://maps.googleapis.com/maps/api/geocode/ [/code] Bu şekilde Mock servisi ezdiğimizde Google kütüphanesine aşağıdaki gibi sorgu gider. Bu sorgular Google tarafından ücretlendirilebilir, şu an her ay 300 Amerikan Doları ücretsiz sorgu sunmaktadır. https://maps.googleapis.com/maps/api/geocode/xml?address=postalcode+43700+TR&sensor=true&key=AI-uE Ayrıca JSON sorgusu da aşağıdaki gibidir ancak XML sorgusu kullanılmaktadır. https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY https://maps.googleapis.com/maps/api/geocode/xml?address=posta+kodu+43700+TR&sensor=true&key=AI–uE sorgusuna cevap aşağıdaki gibi gelecektir. Burada posta kodu ile arama yapıldığı görüleblir. [code lang=”xml”] <GeocodeResponse> <status>OK</status> <result> <type>postal_code</type> <formatted_address>43700 Emet/Kütahya, Türkiye</formatted_address> <address_component> <long_name>43700</long_name> <short_name>43700</short_name> <type>postal_code</type> </address_component> <address_component> <long_name>Emet</long_name> <short_name>Emet</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Kütahya</long_name> <short_name>Kütahya</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Türkiye</long_name> <short_name>TR</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>39.3340975</lat> <lng>29.2785638</lng> </location> <location_type>APPROXIMATE</location_type> <viewport> <southwest> <lat>39.1864260</lat> <lng>29.0273711</lng> </southwest> <northeast> <lat>39.5197860</lat> <lng>29.6485089</lng> </northeast> </viewport> <bounds> <southwest> <lat>39.1864260</lat> <lng>29.0273711</lng> </southwest> <northeast> <lat>39.5197860</lat> <lng>29.6485089</lng> </northeast> </bounds> </geometry> <place_id>ChIJ-zai76lSyBQRKjP8SdIZ3SM</place_id> </result> </GeocodeResponse> [/code] Bir başka sorgu örneği ise aşağıdaki gibidir. Burada İl/İlçe ile arama yapıldığı görüleblir. https://maps.googleapis.com/maps/api/geocode/xml?address=A%C4%9ERI+TR&key=AIzaSyDsqOu4dTyHD-NjXXeH6ASz8c0swFMGnuE [code lang=”xml”] <GeocodeResponse> <status>OK</status> <result> <type>establishment</type> <type>point_of_interest</type> <type>university</type> <formatted_address> Erzurum Yolu 5. Km, 04000 Ağrı Merkez/Ağrı, Türkiye </formatted_address> <address_component> <long_name>Erzurum Yolu 5. Km</long_name> <short_name>Erzurum Yolu 5. Km</short_name> <type>route</type> </address_component> <address_component> <long_name>Ağrı Merkez</long_name> <short_name>Ağrı Merkez</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>Ağrı</long_name> <short_name>Ağrı</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>Türkiye</long_name> <short_name>TR</short_name> <type>country</type> <type>political</type> </address_component> <address_component> <long_name>04000</long_name> <short_name>04000</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>39.7219315</lat> <lng>42.9924428</lng> </location> <location_type>GEOMETRIC_CENTER</location_type> <viewport> <southwest> <lat>39.7205825</lat> <lng>42.9910938</lng> </southwest> <northeast> <lat>39.7232805</lat> <lng>42.9937918</lng> </northeast> </viewport> </geometry> <place_id>ChIJN_JPUcuGbEARst5WYYy9QRM</place_id> <plus_code> <global_code>8HF4PXCR+QX</global_code> <compound_code>PXCR+QX Ağrı, Ağrı Merkez/Ağrı, Türkiye</compound_code> </plus_code> </result> </GeocodeResponse> [/code]]]>