Skip to content

Back ordered products in cart verification do not check Manage Stock attribute #65

@FredericMartinez

Description

@FredericMartinez

In app/code/community/Affirm/Affirm/Helper/Data.php you don't check if every product in quote have Manage Stock active or not.

So even if a product has Manage Stock to Yes but behind the woods has also Backorders to Allow Qty Below 0, Affirm will be disabled.

<?php
// line 149

/**
 * Skip promo message for back ordered products cart
 *
 * @param null $quote
 * @return bool
 */
public function isDisableQuoteBackOrdered($quote = null)
{
    if (null === $this->_disabledBackOrderedCart) {
        if (!Mage::helper('affirm')->isDisableForBackOrderedItems()) {
            $this->_disabledBackOrderedCart = false;
            return $this->_disabledBackOrderedCart;
        }
        if (null === $quote) {
            $quote = Mage::helper('checkout/cart')->getQuote();
        }
        foreach ($quote->getAllItems() as $quoteItem) {
            $inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($quoteItem->getProduct());
            if ($inventory->getBackorders() && (($inventory->getQty() - $quoteItem->getQty()) < 0)) {
                $this->_disabledBackOrderedCart = true;
                break;
            }
        }
        Mage::register('affirm_disabled_backordered', $this->_disabledBackOrderedCart);
    }
    return $this->_disabledBackOrderedCart;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions