Hi,
I am adding a stock check mechanism to do 3 things:
1. Remove "Add to cart" buttons if stock control is activated and set to zero stock
2. Throw an error is someone uses "Add to cart" on an item which has just gone to zero stock (i.e. someone just bought the last one)
3. Ensure that customers can't change the quantity in their basket to a value that exceed current stock
Point 3 is the one causing me a problem. It seems hook_cart_item gets called at least twice when you update a basket's contents as I get this when I try it with a product that doesn't have sufficient stock:
- At present, we can supply only 4 of item MXR pédale de compression Super Comp M132
- Votre panier à été mis à jour.
- At present, we can supply only 4 of item MXR pédale de compression Super Comp M132
It would also be nice to be able to force the item quantity to the allowed level rather than rely on the customer to do it, which requires updating the basket contents at that point in the code too.
Am I asking the impossible??
Regards,
- Paul
P.S. I know I have a few more transalations to add!




Joined: 03/11/2008