Skip to content

Import of order states from Magento 1.4 and earlier #7

Open
@andyskipper

Description

@andyskipper

The connector presently makes a call to retrieve all order states using this call in Openlabs_OpenERPConnector_Model_Sales_Order_Api:

    /* Retrieve order states */
    public function getOrderStates() {
        return Mage::getSingleton("sales/order_config")->getStates();
    }

The getStates() method was private until Magento 1.5, and will fail for any versions prior to that. In 1.4 and earlier, two separate methods exist instead, the results of which could be combined to achieve the same result, for example:

/* Retrieve order states - new version */
public function getOrderStates() {
    $states = array();
    try {        
        $states = Mage::getSingleton("sales/order_config")->getStates();
    }
    catch (Exception $e) {
        /* getStates() not found - early Magento version */
        $visibleStates = Mage::getSingleton("sales/order_config")->getVisibleOnFrontStates();
        $invisibleStates = Mage::getSingleton("sales/order_config")->getInvisibleOnFrontStates();

        $states = $visibleStates + $invisibleStates;
    }
    return $states;
}

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