0

I'm checking each order line.

If the line was ordered, I have to do to something. If it was backordered, I will have to do something different. Like this:

private function myFunction($order){
    $orderItems = $order->getAllVisibleItems();

    foreach($orderItems as $item) {
        $product = Mage::getModel('catalog/product')->load($item->getProductId());

        if( $item was ordered )
            foo();
        elseif( $item was backordered ) 
            bar();

    }

}

I've already tried this post but it doesn't work.

How can I check both scenarios?

1 Answer 1

1

You can try Below code

Assuming $_product is your product object.

    <?php $product_inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product) ?>
    <?php if($product_inventory->getBackorders() == 1 || $product_inventory->getBackorders() == 2): ?>
    <?php echo $this->__('Back Ordered') endif; ?>

You can also refer to this solution for More Detail

Hope it Helps.

1
  • Doesn't work. The solution must be based on order to know if the product was backorder when the order was placed. Commented Jul 31, 2019 at 13:25

Your Answer

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

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