
Originally Posted by
dvtalk
Did a lot of digging but still cannot figure out. It sems that is pointing to this section of the ais_init() function:
Code:
case "radio":
if (document.getElementById(theForm.elements[i].id).checked) {
theForm.elements[i].onclick();
}
break;
All attributes get populated properly, just not the image swap.
Had looked into this issue/situation (not only yesterday but I seem to recall some time ago as well). So here's the thing(s).
AIS applies actions only to applicable attributes that are to cause an image swap, and this is done when generating the attribute list. Therefore, it is possible that a product having attributes may not have an attribute image swap update request for all attributes. I saw two central ways to address/prevent this as far as just this plugin is concerned, one is to move the application of the action to outside of the attribute generation and into more of the ajax arena which should then also make that initial call more adaptable to only try to update the element(s) that are a part of the image swap. The other is to apply some action of some type to all attributes, whether the action causes an update or not.
Considering that DPU is also installed, the second option is relatively present assuming that the load/execution sequence of the javascript can be "controlled" if by nothing than alphabetical sorting. Might I suggest attempting to rename includes/modules/pages/product_info/on_load_ais.js to something like on_load_zais.js and seeing if that resolves the issue for now?
Another option which would involve minimal redevelopment would be to use try/catch style code in the ais_init function (prevents the need to identify/lookup the event(s) to see if they exist against the element.)
Ie. in includes/modules/pages/product_info/jscript_ais.php change:
Code:
switch (theForm.elements[i].type) {
case "select":
case "select-one":
theForm.elements[i].onchange();
break;
case "text":
theForm.elements[i].onkeyup();
break;
case "checkbox":
case "radio":
if (document.getElementById(theForm.elements[i].id).checked) {
theForm.elements[i].onclick();
}
break;
case "number":
theForm.elements[i].onchange();
theForm.elements[i].onkeyup();
theForm.elements[i].oninput();
break;
}
to:
Code:
switch (theForm.elements[i].type) {
case "select":
case "select-one":
try {
theForm.elements[i].onchange();
} catch(err) {
// Action not associated with element.
}
break;
case "text":
try {
theForm.elements[i].onkeyup();
} catch(err) {
// Action not associated with element.
}
break;
case "checkbox":
case "radio":
if (document.getElementById(theForm.elements[i].id).checked) {
try {
theForm.elements[i].onclick();
} catch(err) {
// Action not associated with element.
}
}
break;
case "number":
try {
theForm.elements[i].onchange();
} catch(err) {
// Action not associated with element.
}
try {
theForm.elements[i].onkeyup();
} catch(err) {
// Action not associated with element.
}
try {
theForm.elements[i].oninput();
} catch(err) {
// Action not associated with element.
}
break;
}
Bookmarks