Hello,

First, excellent module, top notch, top notch! We couldn't operate without it.

Second, as of last week one particular node stopped functioning as expected.

Brief Explanation:
A node has an attribute that has some positive stock level. When the attribute is selected, the 'Add to Cart' button appears. When the user clicks the 'Add to Cart' button, a Drupal message box appears [via the AJAX Cart module (https://drupal.org/project/uc_ajax_cart)], however, instead of a message notifying the user that the attribute was added to her cart, the 'You will be notified when the product comes back into stock.' message appears -- yes in the AJAX popup, not at the top of a new page load as normally expected. After a few seconds the AJAX popup disappears and nothing else happens. The page does not reload, the cart is not altered, and the user is not added to `uc_stock_notify`.

This is of course very strange for many reasons. It's like a hybrid is happening: Part of the AJAX Cart features and part of the Stock Notify features have somehow merged.

Full Explanation:
Please see my forum post here: https://drupal.org/node/2042537#comment-7648571

Discovering The Issue:
After some troubleshooting I have discovered the issue, as posted here https://drupal.org/node/2042537#comment-7652219:

if (!empty($form_state['post']['attributes'])) {

This fails because $form_state['post'] does not exist, rather $form_state['values'] exists. I even verified this is the case for other nodes that do function correctly.

Of course if that is empty, then the only remaining $model to pull data from is the default data of the node itself, minus any attribute data, as defined a few lines down by:

    if (!$model) {
      $model = $form['node']['#value']->model;
    }

What was happening with this one particular node was that it was pulling the default SKU, not the SKU of the attribute ... where the default SKU was previously configured to be out of stock while the attribute SKU had stock, resulting in a giant conflict.

My Temporary Solution:
I simply copied the first IF statement to include checking for ['values'], as so:

    // Is ['post']['attributes'] empty?
    if (!empty($form_state['post']['attributes'])) {
      pull attribute data

    // Is ['values']['attributes'] empty? (also only check if the above fails)
    if (!$model && !empty($form_state['values']['attributes'])) {
      pull attribute data

    // If we are here then there must be no attributes present
    if (!$model) {
      pull default node data

So you can see I am simply changing to ['values'], as well as one additional edit within the function (see my above forum post for full details), so that if the ['post'] method fails, then try a ['values'] method BEFORE we resort to the default node info.

For now I am only labeling this as a temporary solution and I don't have enough knowledge on $form_state to proceed any further.

Please let me know what you think and if this helps anyone out there then I am glad I posted it up!

Regards,
BigMike