WebSite X5Help Center

 
Alberto B.
Alberto B.
User

Codice aggiuntivo per carrello non funziona più  it

Auteur : Alberto B.
Visité 65, Followers 1, Partagé 0  

Ciao a tutti anche se l'a persona interessata è KOL

Tempo fa mi hai suggerito questo codice blocc-carrello, ho notato che non mi funziona più:

<script>
$( document ).ready(function() {/*K>*/;
ritardoK = 3; // secondi di ritardo da valutare
avvisoK = "Attenzione! la prenotazione è sospesa fino al 6 gennaio 2025";
//--- sezione -- preloader by KolAsim ---K
imgPreK = "https://www.microtronics.it/images/tail-spin.svg";
preK='<div id="loaderK" style="position:fixed;top:0px;left:0px;width:100%;height:100%;z-index:1000000; background-color:rgba(0,0,0,0.5);background-image: url('+imgPreK+');background-repeat: no-repeat; background-attachment: fixed; background-position: center center;background-size:20%"> </div>';
$("body").append(preK);
//--------------------------------K
setTimeout(function(){//K1>
K = $(".imProductListButton");
$(K[0]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[1]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[2]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[3]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[4]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[5]).prop("onclick", false).click(function() { alert(avvisoK)});
$('#loaderK').hide();
}, ritardoK * 1000); //K1<<
}); /*K<<*/;
</script>

questa è la pagina incriminata: https://www.microtronics.it/taratura_strumento_blueforce.php

Posté le
5 RéPONSES
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... ho corretto; ...così disabiliti tutti gli Aggiungi (come avverrebbe adesso):

<script>
$( document ).ready(function() {/*K>*/;
ritardoK = 3; // secondi di ritardo da valutare
avvisoK = "Attenzione! la prenotazione è sospesa fino al 25 agosto";
//--- sezione -- preloader by KolAsim ---K
imgPreK = "https://www.microtronics.it/images/tail-spin.svg";
preK ='<div id="loaderK" style="position:fixed;top:0px;left:0px;width:100%;height:100%;z-index:1000000; background-color:rgba(0,0,0,0.5);background-image: url('+imgPreK+');background-repeat: no-repeat; background-attachment: fixed; background-position: center center;background-size:20%"> </div>';
$("body").append(preK);
//--------------------------------K
setTimeout(function(){//K1>
K = $(".im-cc-products-button");
$(K).prop("onclick", false).click(function() { alert(avvisoK)});
//$(K[1]).prop("onclick", false).click(function() { alert(avvisoK)});
$('#loaderK').hide();
}, ritardoK * 1000); //K1<<
}); /*K<<*/;
</script>

----------------------------------------

... invece modificando queste stringhe così, disabiliti solo l'Aggiungi della seconda [1] scheda:
//$(K).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[1]).prop("onclick", false).click(function() { alert(avvisoK)});

...................................

...l'ID [0] è la prima scheda e l'ID [5]  è la sesta  scheda...

... quindi puoi disabilitare le schede in modo alternato selettivo, come preferisci, aggiungendo le relative stringe con il proprio ID...

.

... ah! ... ho tolto l'anno da ALERT ...

.

ciao

.

.

Lire plus
Posté le de  ‪ KolAsim ‪ ‪
Alberto B.
Alberto B.
User
Auteur

Ok KOL grazie,  l'ho inserito come [1] e [5] ma funziona con tutti...

Lire plus
Posté le de Alberto B.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... quello che hai fatto adesso è diverso da quel che ti ho detto e postato prima...
... adesso hai messo le stringe di codice per tutte le schede (1)[0]<>(6)[5], e quinti il codice si attiverà su tutti gli [Aggiungi]...
... così com'è adesso, se per esempio vuoi che per la scheda (2)[3] il pulsante [Aggiungi] sia attivo e quindi non far avviare l'ALERT, ...anteponi due barrette (//)  all'inizio della relativa stringa, così:
// $(K[3]).prop("onclick", false).click(function() { alert(avvisoK)});
... la stessa cosa varrebbe per selezionare/abilitare altre schede in modo selettivo...
.

ciao

.

Lire plus
Posté le de  ‪ KolAsim ‪ ‪
Alberto B.
Alberto B.
User
Auteur

Quindi se desidero bloccare l'acquisto del settore 3 e 6 devo inserire queste righe...

//$(K[0]).prop("onclick", false).click(function() { alert(avvisoK)});
//$(K[1]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[2]).prop("onclick", false).click(function() { alert(avvisoK)});
//$(K[3]).prop("onclick", false).click(function() { alert(avvisoK)});
//$(K[4]).prop("onclick", false).click(function() { alert(avvisoK)});
$(K[5]).prop("onclick", false).click(function() { alert(avvisoK)});

Lire plus
Posté le de Alberto B.
Alberto B.
Alberto B.
User
Auteur

ho provato dopo aver pubblicato e con i tuoi chiarimenti è ok smile

Lire plus
Posté le de Alberto B.