pstuteville/magentor

Cardinality Violation

Closed this issue · 3 comments

When I try to create shipments, I'm getting an error from the Magento server.

Here's what I'm posting:
Magento::Shipment.create(:order_id=>100000015, :itemsQty=>[{81=>1}])

And here's what I'm getting back:
exception: 1 -> SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

I get the same error on Order.add_comment; I'm on a vanilla install of Magento 1.6 community, am I not making the request correctly?

I no longer have access to a magento installation to look into this. Can you check the following to see if this works for you? If i remember right, the cardinality errors have to do with the way data is being passed to magento.

order_id = 100000015
item_qtys =  {
    81 => 1
}
shipment_id = Magento::Shipment.commit("create", order_id, item_qtys)

I discovered the error was from passing the order_id as a hash param instead of unlabeled, with the param hash afterwords. So basically I was sending nil for ID. Once I'm done I'll post the working code and close the issue on github.

On Aug 5, 2013, at 4:57 PM, Preston Stuteville notifications@github.com wrote:

I no longer have access to a magento installation to look into this. Can you check the following to see if this works for you? If i remember right, the cardinality errors have to do with the way data is being passed to magento.

order_id = 100000015
item_qtys = {
81 => 1
}
shipment_id = Magento::Shipment.commit("create", order_id, item_qtys)

Reply to this email directly or view it on GitHub.

This should be a working example:
Magento::Shipment.create(100000015, {81=>1})