Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import of order states from Magento 1.4 and earlier #7

Open
andyskipper opened this issue Nov 12, 2013 · 1 comment
Open

Import of order states from Magento 1.4 and earlier #7

andyskipper opened this issue Nov 12, 2013 · 1 comment

Comments

@andyskipper
Copy link

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;
}
@tarunbhardwaj
Copy link
Contributor

Its awesome Andy, I'm bit busy right now and check this out later and make this available in code ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants