1

I am showing a list of items ordered from all the orders from 'sales_flat_order_item' table in Magento 1.9.2 . I get the name ,Sku and all other values from the following collection.

  protected function _prepareCollection() {

    $collection = Mage::getModel('sales/order_item')->getCollection();
    $collection->getSelect()->join(array('o' => 'sales_flat_order'), 'main_table.order_id = o.entity_id', array('increment_id','created_at'));
    $this->setCollection($collection);
    parent::_prepareCollection();
    return $this;
}

Now I want to get the size and color of the item ordered. I am new to Magento , i have no clue from where I can get these value.

0

these values are serialized inside the column product_options in order items with the key attributes_info. here is an example

array (size=10)
  'info_buyRequest' => 
    array (size=6)
      'uenc' => string 'aHR0cDovLzUwLjU2LjIxMy4xNTcvd29tZW4vdG9wcy1ibG91c2VzL25vbGl0YS1jYW1pLTQ2MC5odG1sP29wdGlvbnM9Y2FydA,,' (length=100)
      'product' => string '417' (length=3)
      'related_product' => string '' (length=0)
      'super_attribute' => 
        array (size=2)
          92 => string '20' (length=2)
          180 => string '78' (length=2)
      'qty' => string '1' (length=1)
      'return_url' => string '' (length=0)
  'attributes_info' => 
    array (size=2)
      0 => 
        array (size=2)
          'label' => string 'Color' (length=5)
          'value' => string 'Black' (length=5)
      1 => 
        array (size=2)
          'label' => string 'Size' (length=4)
          'value' => string 'L' (length=1)
  'simple_name' => string 'NoLIta Cami' (length=11)
  'simple_sku' => string 'wbk002' (length=6)
  'product_calculations' => int 1
  'shipment_type' => int 0
  'giftcard_lifetime' => null
  'giftcard_is_redeemable' => int 0
  'giftcard_email_template' => null
  'giftcard_type' => null

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.