Ajax Cart and the Out of Stock Notification are two great modules, so it would be great to get them to work together. Out of Stock Notification works until Ajax Cart is installed, but I'm not sure what module is causing the error.
Here are the issues I see with both 6.x-2.0-rc2 or 6.x-2.x-dev of Ajax Cart, and 6.x-1.x-dev version of Out of Stock Notification (the stable version is from 2009)
- With Ajax Cart enabled, a user can add-to-cart more product that is in stock (using the qty field and attributes).
- Then once the products (that are not really in stock) are in the cart, the user is trapped via a popup error out-of-stock message when they try to change qty (even to qty that is in-stock), OR try to remove the product from the cart. The error message stating something like "There are only x number of xyz product available" references another product in the cart, not the product trying to remove (see screenshot).
- The user cannot even checkout with an error message stating the products are not in stock. Sometimes the checkout page is presented un-themed (see screenshot), if they try to checkout right after trying to remove the product from the cart.
- Basically, by allowing the user to add more product than is available traps them, unable to make any changes to their cart, or checkout.
Thanks... I'm available immediately to test any updates.
Image1 - show what happend when I click to remove the "Medium" size, note the message references the "Small"
Image2 - screenshot after I try to remove product from cart, get the error message popup, then try to checkout.
Comment | File | Size | Author |
---|---|---|---|
#14 | 1213574-14-send-click-button.patch | 1.2 KB | hanoii |
#10 | 1213574-send-clicked-button-js.patch | 1.23 KB | hanoii |
ajax-cart2.png | 56.81 KB | nelslynn | |
ajax-cart1.png | 68.23 KB | nelslynn |
Comments
Comment #1
nelslynn CreditAttribution: nelslynn commentedThe above seems only an issue when you have two models (or SKUs: ie: small, medium) of the same product in the shopping cart.
Comment #2
tunicThanks for your detailed report and your availability to test. I'll try to have look soon.
Comment #3
marcus178 CreditAttribution: marcus178 commentedI'm experiencing the same problem as well. Even when only adding one product to the cart it seem to completely ignore uc_out_of_stock and still allow the user to add the item to their cart
Comment #4
tunicI'm afraid but it seems that there's something wrong with UC Out of Stock Notification module. I've trid to enable uc_stock and uc_out_of_stock and disable uc_ajax_cart and you can add as many items as you want without error (using Ubercart 2.4 and 2.6).
Also I couldn't reproduce your first screenshot error. Are you using antoher Ubercart and stock related modules?
Comment #5
nvl.sateesh CreditAttribution: nvl.sateesh commentedDear nelslynn et all,
I experienced the same issue and tried debugging. Here is what I found.
In the uc_out_of_stock.module file, in uc_out_of_stock_validate_form_addtocart() function, there is a condition that checks for the class of the button from which the add to cart is triggered.
and performs stock validation only on specific classes
I noticed that when Ubercart Ajax Cart is installed, the $form_state['clicked_button'] is not passing any values and hence the if condition is return false, and no stock validation is being done.
I did not have time to check why it is not returning the clicked_button variable. For time being, i just removed that if condition and it works fine.
Comment #6
nvl.sateesh CreditAttribution: nvl.sateesh commentedI am not sure if this issue is applicable for the Drupal 6 also, but a mention is here about the $form_state['clicked_button'] with ajax submissions: http://drupal.org/node/1049462
Comment #7
tunicThanks sateesh.nvl, I'll have a look to this issue ASAIC.
Comment #8
hanoiiMaintainer of the uc_out_of_stock module here. I am about to try a site with both modules enabled, so I might try to sort this out.
Comment #9
hanoiiI have looked into this, however, this is not a straightforward fix.
Attach is a patch that adds clicked_button to the submitted form as explained in #5. Although this now prevents the form to be added because of uc_out_of_stock validation, it doesn't give any indication of doing so. And this is not something I can fix easily on this module or mine. Actually is more of a fix to this module than mine.
I will, however, post related thoughts about this on #837176: Less Intrusive Status Update for Customer, because it has to do with proper status messages.
As far as the original report of this issue, I'd like to comment on each of the issues:
As explained, this should be now fixed.
I believe this is because of how the ajax thing works. Basically if you remove the actual product that is out of stock and you reload the page, this remove the out of stock errors because the item is actually removed from the cart, but there are issues here that I haven't followed in detail, but I think it should work fine if you try to work the cart in a non-ajax way, even with out of stock items in the cart.
Comment #10
hanoiiAha, forgot the patch.
I'd suggest to mark this one as fixed and continue status message discussions later. But maybe leave this one open for references as it's not 100% fixed.
Comment #11
tunicThanks for your help hanoii, your patch seems ok and allows uc_out_of_stock to perform its validation.
I thought is was incomplete because you can still add more items that available using the cart page form, but I you can do it without Ajax cart, so I suppose is not an Ajax Cart issue.
I close this issue an d let discuss notifications in the other issue:
#837176: Less Intrusive Status Update for Customer
I've tested this patch very quickly, don't hestiate to corect me if there's something wrong.
Comment #13
ledom CreditAttribution: ledom commentedThank you for the patch hanoii, just tested and it works like a charm.
A status message would be good when buyer add more products than stock level and none are added to cart, or just add the maximum quantity.
I think we could open a new issue for this, no? because it is much specific than "less intrusive status update..."
Comment #14
hanoiiThis is also an issue on the D7 branch. This got accepted on D6 a while ago but it's not on D7 and now that uc_out_of_stock is for D7 as well, the same issue is there.
Attached is the same patched rolled out for D7.
Comment #15
hanoiiComment #16
Neo13 CreditAttribution: Neo13 commentedI tried this patch and it works great!
Comment #17
himagarwal CreditAttribution: himagarwal commentedThis patch should be applied to the D7 core of Ubercart AJAX Cart.
Comment #18
tunicSeems ok, committed to dev.