3

I am having issues getting a collection from the DB in Magento.

I am trying to pull the field rx_queue from the table sales_flat_order (it's a custom column we added).

When I run the function that is supposed to do this, I get the error message listed in the title of this question.

Here is the function

public function getPrescriptionQueue($orderId) {
    $prescription = Mage::getResourceModel('sales/order')->getCollection()->addFieldToFilter('increment_id', array('eq' => $orderId))->getSelect();
    return $prescription['rx_queue'];
}

What am I doing that gives me this error in the first place? How can I fix it?

4

please keep in my mind this thing

Mage::getResourceModel('sales/order'); ==  Mage::getModel('sales/order')->getCollection();

So If you are using resource model it has already called getCollection Method so you dont have to call it again

Hope this will help you

0

The issue was I was using Mage::getResourceModel where I should have used Mage::getModel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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