Skip to content

Commit

Permalink
fix: Default location not working in vendor dashboard issue fixed (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamgircsebd authored Jun 11, 2020
1 parent f00a424 commit 231930d
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions templates/maps/dokan-maps-with-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,53 @@

$map_address = ! empty( $map_address ) ? $map_address : 'Dhaka';

if ( empty( $map_location ) && function_exists( 'dokan_geo_get_default_location' ) && ! empty( dokan_geo_get_default_location() ) ) {
$default_location = dokan_geo_get_default_location();

$map_address = ! empty( $default_location['address'] ) ? $default_location['address'] : 'Dhaka';
$longitude = ! empty( $default_location['longitude'] ) ? $default_location['longitude'] : 90.40714300000002;
$latitude = ! empty( $default_location['latitude'] ) ? $default_location['latitude'] : 23.709921;
$map_location = $latitude . ',' . $longitude;
} else {
$longitude = ! empty( $location[1] ) ? $location[1] : 90.40714300000002;
$latitude = ! empty( $location[0] ) ? $location[0] : 23.709921;
}

dokan_get_template( 'maps/mapbox-with-search.php', array(
'map_location' => $map_location,
'map_address' => $map_address,
'access_token' => $access_token,
'map_id' => $map_id,
'location' => array(
'address' => $map_address,
'longitude' => ! empty( $location[1] ) ? $location[1] : 90.40714300000002,
'latitude' => ! empty( $location[0] ) ? $location[0] : 23.709921,
'zoom' => 10,
'longitude' => $longitude,
'latitude' => $latitude,
'zoom' => 12,
),
) );
} else {
$location = explode( ',', $map_location );
$location = explode( ',', $map_location );
$map_address = ! empty( $map_address ) ? $map_address : 'Dhaka';

if ( empty( $map_location ) && function_exists( 'dokan_geo_get_default_location' ) && ! empty( dokan_geo_get_default_location() ) ) {
$default_location = dokan_geo_get_default_location();

$map_address = ! empty( $default_location['address'] ) ? $default_location['address'] : 'Dhaka';
$longitude = ! empty( $default_location['longitude'] ) ? $default_location['longitude'] : 90.40714300000002;
$latitude = ! empty( $default_location['latitude'] ) ? $default_location['latitude'] : 23.709921;
$map_location = $latitude . ',' . $longitude;
} else {
$longitude = ! empty( $location[1] ) ? $location[1] : 90.40714300000002;
$latitude = ! empty( $location[0] ) ? $location[0] : 23.709921;
}

dokan_get_template( 'maps/google-maps-with-search.php', array(
'map_location' => $map_location,
'map_address' => $map_address,
'location' => array(
'address' => $map_address,
'longitude' => ! empty( $location[1] ) ? $location[1] : 90.40714300000002,
'latitude' => ! empty( $location[0] ) ? $location[0] : 23.709921,
'longitude' => $longitude,
'latitude' => $latitude,
'zoom' => 12,
),
) );
Expand Down

0 comments on commit 231930d

Please sign in to comment.