0

i have been working trying to create an edit order system where when an order is bellow a given state the customer can edit the order

now i have everything working by adding a reorder like link which does the exact same as reorder but creates a session which identifies that your editing an order, in order to do this for out of stock products i had to turn backorders on

however i have found a glitch, if a customer was to add 5 hats to the cart and logs off, if when they come back the item's stock qty is now 0 they can still go into the cart, naturally this is because of the backorders being enabled.

i have made a CartController to pick up adding/updates to the shopping cart and manually check if the stock is less than what's in the cart, however if the customer had the item when there was ample stock, leave and returns when it's now out of stock, they bypass these checks

one suggestion that was made by a college was that we shorten the lifetime of the cart session for registered customers, while we could do this, there is more of a problem during a sale

originally, before backorders was turned on, if this same situation occurred the "Proceed to checkout" button would be missing and you would get an error message

now i've tried fixing up a new IndexController and using $this->_getSession()->addError('Some products in your cart have gone out of stock'); but i'm not getting the same results

so how do i create an error message that will prevent the customer from going into the checkout until they have fixed up their cart

2
  • Did you find an answer? Please share it with us. Apr 7, 2013 at 1:25
  • @FabianBlechschmidt yeh, it was the answer here, strange, i swear i marked it
    – Memor-X
    Apr 7, 2013 at 22:04

1 Answer 1

1

Try to add the error to the quote item.

    /app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php:300
    if ($baseMessages) {
        foreach ($baseMessages as $message) {
            $messages[] = array(
                'text' => $message,
                'type' => $quoteItem->getHasError() ? 'error' : 'notice'
            );
        }
    }

Might work. Just an idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.