Choisir un point relais en cliquant sur la map
-
Bonjour Harasse et merci pour ce super plugin.
J’ai une question concernant le choix du point relais :
– Est-il prévu dans une future version du plugin de permettre à l’utilisateur de sélectionner directement son point relais en cliquant sur l’ic?ne de la map ?
Merci d’avance pour votre retour,
Isaac
-
Hello,
I am sorry, but I do not consider a selection directly from the map, and this to preserve the possibilities of customizations that everyone can do with the filters. However, in a future version, I will put in the sample file a model of this kind of customization which you could modify or take as it is.Bonjour,
Je suis désolé, mais je n’envisage pas de sélection directement depuis la carte, et cela pour préserver les possibilités de personnalisations que chacun peut faire avec les filtres. Toutefois, dans une prochaine version, je mettrai dans le fichier exemple un modèle de ce type de personnalisation dont vous pourrez vous inspirer ou prendre en l’état.Merci de votre retour.
Bonjour,
Je me posais justement la même question de la sélection du point de retrait directement depuis la carte. D’un point de vue ergonomique ?a serait pas mal non ? Par contre, vous parlez de personnalisation avec des filtres. Pouvez-vous me donner plus de précision ? Ce sont des filtres graphiques pour la map ?
Merci beaucoup,
MathiasHello,
No, I’m talking about “hooks” (filters and actions) in the sense of wordpress. Look at the examples file in includes where you will find different filters to change the CDI presentations.
To select pickup locations directly from the Google map, to give you an idea of what is possible, put the code below in the functions.php file of your theme.Bonjour,
Non, je parle des ??hooks?? (filtres et actions) au sens de wordpress. Regardez le fichier exemples dans includes où vous trouverez différents filtres pour changer les présentations de CDI.
Pour la sélection des points retrait directement depuis la carte Google, pour vous donner une idée de ce qui est possible, mettez le code ci-dessous dans le fichier functions.php de votre thème.[code language="php"]
//
// *** Example to have a pickup location select from the google maps (need 3 hooks)
////****** Display of the selected location data with a select button
add_filter( 'cdi_filterhtml_retrait_descpickup', 'example_cdi_filterhtml_retrait_descpickup', 10, 2) ;
function example_cdi_filterhtml_retrait_descpickup ($description, $PointRetrait) {
$return = '<div id="selretrait" data-value="' . $PointRetrait->identifiant . '">' ;
$return .= '<p style="color:red; width:100%; display:inline-block;">(' . $PointRetrait->identifiant . ') Sélectionner</p>' ;
$return .= '<div id="selretraithidden" style="display:none;"><p style="text-align:center;">Point Retrait sélectionné</p></div>' ;
$return .= '<p style="color:green; margin-bottom:0px;">' . $PointRetrait->nom . '</p>' ;
$return .= '<p style="color:green; margin-bottom:0px;">' . $PointRetrait->adresse1 . ' ' . $PointRetrait->adresse2 . '</p>' ;
$return .= '<p style="color:green;">' . $PointRetrait->codePostal . ' ' . $PointRetrait->localite . '</p>' ;
$return .= '<p style="color:black;">Distance: ' . $PointRetrait->distanceEnMetre . 'm</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Lundi ' . $PointRetrait->horairesOuvertureLundi . '</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Mardi ' . $PointRetrait->horairesOuvertureMardi . '</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Mercredi ' . $PointRetrait->horairesOuvertureMercredi . '</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Jeudi ' . $PointRetrait->horairesOuvertureJeudi . '</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Vendredi ' . $PointRetrait->horairesOuvertureVendredi . '</p>' ;
$return .= '<p style="color:black; margin-bottom:0px;"> Samedi ' . $PointRetrait->horairesOuvertureSamedi . '</p>' ;
$return .= '<p style="color:black;"> Dimanche ' . $PointRetrait->horairesOuvertureDimanche . '</p>' ;
$return .= '<p style="color:black;">GPS: ' . $PointRetrait->coordGeolocalisationLatitude . ' ' . $PointRetrait->coordGeolocalisationLongitude . '</p>' ;
if ($PointRetrait->parking) $return .= '<p style="color:black ; margin-bottom:0px;">Parking: ' . $PointRetrait->parking . '</p>' ;
if ($PointRetrait->accesPersonneMobiliteReduite) $return .= '<p style="color:black ; margin-bottom:0px;">Mobilité réduite: ' . $PointRetrait->accesPersonneMobiliteReduite . '</p>' ;
if ($PointRetrait->langue) $return .= '<p style="color:black ; margin-bottom:0px;">Langue: ' . $PointRetrait->langue . '</p>' ;
if ($PointRetrait->poidsMaxi) $return .= '<p style="color:black ; margin-bottom:0px;">Poids maxi: ' . $PointRetrait->poidsMaxi . '</p>' ;
if ($PointRetrait->loanOfHandlingTool) $return .= '<p style="color:black ; margin-bottom:0px;">Equipements de manipulation: ' . $PointRetrait->loanOfHandlingTool . '</p>' ;
$return .= '</div>' ;
return $return ;
}
//****** Processthe choice when the select button is pressed, and some clean html
add_action('wp_footer','example_cdi_filterhtml_retrait_descpickup_js');
function example_cdi_filterhtml_retrait_descpickup_js() {
if (is_checkout()) {
?><script type="text/javascript">
jQuery("#order_review").on("click", "a.selretrait.button", function(detailselret){
document.getElementById("selretraithidden").style.display = "inline";
document.getElementById("selretraitshown").style.display = "none";
var idret = document.getElementById("selretrait").getAttribute('data-value') ;
var options = document.querySelector("#pickupselect").options;
for (var i = 0; i < options.length; i++) {
if (options[i].value == idret) {
var pickupselectvalue = options[i].value;
var pickupselecttext = options[i].text;
options[i].selected = true;
var sel = document.getElementById('pickupselect');
fireEvent(sel,'change'); // Force a change event to resume the CDI process
break;
}
}
function fireEvent(element,event){
if (document.createEventObject){ // dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
}else{ // dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
}
}
});
</script><?php
// Optional - Suppress of the no used display
?> <style>
#zoneiconmap {display: none;}
/* #pickupselect {display: none;} */
</style><?php
}
}
//****** >Suppress of the return data display which is no use in that case
add_filter( 'cdi_filterhtml_retrait_displayselected', 'example_cdi_filterhtml_retrait_displayselected', 10, 2) ;
function example_cdi_filterhtml_retrait_displayselected ($pickupdetail, $PointRetrait) {
return '' ;
}
[/code]-
This reply was modified 8 years ago by
Halyra.
Sorry, but I am not sure my code will pass the support forum.
But you will see this example at the next CDI version.Hello,
In the new 1.18.2 version, you will find an example in examples/CDI-selectfromgooglemap-example.php . You can test it by doing an include at the bottom of the colissimo-delivery-integration.php file.Bonjour,
Dans la nouvelle version 1.18.2?, vous trouverez un exemple dans examples/CDI-selectfromgooglemap-example.php . Vous pouvez le tester en faisant un include dans le bas du fichier colissimo-delivery-integration.php .Testé, ?a marche très bien.
I ran a test, it’s working fine.
Thank you
-
This reply was modified 8 years ago by
- The topic ‘Choisir un point relais en cliquant sur la map’ is closed to new replies.