It's probably trivial, but I'm new at this. Does this module execute when a product page is loaded? Or are the attributes filtered out and stored when stock levels are adjusted and saved?

Comments

bsorrells’s picture

The php code in the module builds a JavaScript array and adds it to the output with drupal_add_js. Then, when you change a select box for an attribute, it fires and looks at all other select boxes to check all combination possibilities for inventory.

The drupal_add_js adds a variable that looks like this:

var uc_asf_AvailableOptions = {"6":["32"],"32":["6","7","10"],"7":["32","31"],"31":["7","12","10"],"12":["31"],"10":["32","31"]}

I know all this because I was getting errors. This line:

if (typeof uc_asf_AvailableOptions[parentNode][selected] != 'undefined') { // Avoid triggering a JS error

was giving me hell! I kept getting an undefined error in the Firebug console. I ended up having to change it to:

if (typeof uc_asf_AvailableOptions[selected] != 'undefined') { // Avoid triggering a JS error

I'm using drupal 6.19 and UC 6.x-2.4. The parent node was the node id of the product and was not represented anywhere in the uc_asf_AvailableOptions variable. I took it out and everything works perfect now!