Wenn ich im Shop einen Artikel mit Optionen habe und einfach auf "in den Warenkorb" klicke, ohne eine Option ausgewählt zu haben, dann wird der Artikel ohne weitere Ansage nicht in den Korb gelegt.
Da wäre es natürlich schön, einen Hinweis zu bekommen, dass noch die Auswahl fehlt...
Wie könnte man das erreichen? Jemand ne Idee?
Shop: Alert box when no option is selected
Shop: Alert box when no option is selected
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
- Oliver Georgi
- Site Admin
- Posts: 9892
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Re: Shop: Alert box when no option is selected
per JavaScript abfangen, benötigt sinnvollerweise aktuellen Commit (https://github.com/slackero/phpwcms/commits/dev-1.x)
Code: Select all
$(function() {
$('form.product-cart-option').submit(function(event) {
event.preventDefault();
var $this = $(this);
var opt1 = $('select.product-option-1', $this);
var opt2 = $('select.product-option-2', $this);
if(opt1.length && opt2.length) {
var opt1_value = opt1.val();
var opt2_value = opt2.val();
if(!opt1_value || opt1_value == '0' || !opt2_value || opt2_value == '0') {
alert('Select product options');
return false;
}
} else if(opt1.length) {
var opt1_value = opt1.val();
if(!opt1_value || opt1_value == '0') {
alert('Select product option 1');
return false;
}
} else if(opt2.length) {
var opt2_value = opt2.val();
if(!opt2_value || opt2_value == '0') {
alert('Select product option 2');
return false;
}
}
$this.submit();
});
});
Re: Shop: Alert box when no option is selected
hab's leider nicht hinbekommen. Wo genau gehört das JS denn hin?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
- Oliver Georgi
- Site Admin
- Posts: 9892
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Re: Shop: Alert box when no option is selected
egal wo, gebraucht in Produktliste/-detail.