Marketpress out of stock when adding to cart

Hi! We didn't notice this until today. Not sure if it was a problem before beta 4, might have been and we just didn't see it.

Products with 10 or more in stock can only be added once to cart, then it says Sold Out. Refresh the page and it's still there (button says add to cart) but if you haven't emptied the cart it the popup says its to low in stock, 0 left.

I'm thinking the functions that check stock somehow only reads the first digit. I'm going to try changing a product to 20-something to see if it thinks there's 2 in stock...

Ah! Now it works... and i changed it back down to 11 and it still works. So maybe they will all work again if i edit the stock level on every product with more then 10 in stock? ;-p

Still, it would be awesome if you can figure out the problem so it wont happen again. Neither me or my client (or other MP users) will be happy editing stocks on hundreds of items.

Any other info you might need?

  • Philip John

    Hiya,

    First off can you ensure you're on the latest version of MarketPress please? 2.0 has been fully released so you should make sure to grab that - it's no longer in beta.

    Secondly, can you just clarify whether you get this issue when you set stock to 11 or 20? What happens at 9?

    Meanwhile, I'll try to replicate this... I can't seem to replicate it, so we're gonna have to find out why you're having trouble! Try disabling all other plugins while you test it.

    Cheers!
    Phil

  • Anders E

    Yes, latest MP.

    Lower then 10 in stock works fine. Products with 10 or more have this problem, until i edit the stock level. Then it suddenly works again.

    This seems to be an after effect of the problem i described in the beta thread:

    In the network settings the user admin (per site) is set to use the mapped domain. Everything works when it's like that.

    I changed that setting to use the original (sub) domain. Thats when the cart stoped working. Changed back, now it's working again.

    Aarons answer:

    Interesting catch. Basically what is happening is the when your admin domain is different to the front domain, the cart cookie cannot be updated during the AJAX add to cart function due to browser restrictions. The only technical ways around this is to either make sure backend domains are mapped, or turn off ajax completely.

    So, I suppose this new bug might be a recurring problem if you want to change the network setting for the admin panels every once in a while.

    Could the ajax functions be hard coded to use the mapped domain even if the network is set to use the sub domains for admin panels? Maybe that would solve it?

    I'm just guessing here...

  • Anders E

    Backend mapping matches frontend again, thats what solved the issue i had in the beta thread.

    It was after that the issue described above appeared.

    Try one more thing for me, pleeeease? Possible way to replicate the problem on a wpmu install with a mapped domain on a site with MP:

    1. Make sure you have a couple of products in MP on a site with domain mapping. Some with less then 10 in stock, some with more.
    2. Set backend mapping to "original domain" in the network settings.
    3. Try out the cart on site with mapped domain. If it doesn't work, great, replication in progress. Try on a couple of products so you're sure it doesnt work.
    4. Set backend mapping to "mapped domain" in the network settings.
    5. Try to add products to cart. If products with less then 10 in stock work, and products with more then 10 seems to only have 1 in stock no matter what it really is, then the problem is replicated.

    Can you replicate it like this? If you can, I would think it's something that needs resolving.

    There are times when you need to change the backend mapping to original domain. For example if someone adds a mapped domain to their site without having the correct A record set, so you need to access that sites backend to remove the domain mapping.

    Also, if you could leave the backend mapping setting on "original domain" the user can get to their admin and fix it themselves. But then the cart won't work at all. So, therefore my additional question is if the the ajax functions can be hard coded to use the mapped domain even if the backend mapping is set to use the original (sub) domains?

    Or possibly set cookies for both mapped and original domains? I don't know if that possible, but if it is, it would probably solve the above problems.

    Hey, sorry if I'm a bit of a pest. Thanks for putting up with crazy ideas and bug reports.

  • Aaron

    So, therefore my additional question is if the the ajax functions can be hard coded to use the mapped domain even if the backend mapping is set to use the original (sub) domains?

    No, because that's controlled by domain mapping plugin.

    I think it would work for both your situations if you make the setting user defined (where however you access it is ok).

    Or possibly set cookies for both mapped and original domains?

    It's not possible because of browser security restrictions.

    Can you replicate it like this?

    It'll be a little while before I can test that kind of setup.

  • Anders E

    Thanks for checking it out Phil!

    Well, it must have been some odd combination of the cookie stuff described above and updating MP or something. Seems to working fine here as well now. I'll let you know if it happens again.

    Aaron:

    I think it would work for both your situations if you make the setting user defined (where however you access it is ok).

    Yes, that seems to be working. Maybe that setting should be a recommendation in the Marketpress installation instructions?

    Thanks guys!
    -Anders

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.