Jump to content

Verification ATTRIBUT -> ADD_CART -> ajax-cart.js


arthurbinz

Recommended Posts

Bonjour,
Depuis ma prise en main de PS je cherche une solution pour forcer le client à choisir sa taille. Information nécessaire dans bien des domaines. Dans mon cas GROUPE = TAILLES et ATTRIBUT = du 38 au 50 + "Choisir" et avec pour valeur par defaut -> "Choisir"
J’ai fini par trouver une solution dans le fichier prestashop\modules\blockcart\ajax-cart.js ligne 136 afin d'afficher une alert JAVASCRIPT (si taille = choisir afficher l’alert)
// add a product in the cart via ajax
add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist){
// ajout pour vérification
var elementVal = document.getElementById('group_6'); //group_6 pour moi
var elementTxt = elementVal.options[elementVal.selectedIndex].text;
if(elementTxt == 'Choisir'){
alert('Merci de spécifier votre TAILLE');
return ;
}
// fin ajout
Il me faut trouver comment remplacer ‘group_6 ‘ par la variable le but étant de trouver le motif "Choisir"

Si ça peut aider certains...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...