2

i need the query to get the all configurable options of a product in the order,

In order, i wants to get the configurable product option like color, size by the query

from that i cant used that into the export item.

$instance = Mage::getResourceModel("sales/order_grid_collection")->addAttributeToSelect('increment_id')
    ->addAttributeToSelect('status')
    ->addAttributeToSelect('grand_total')
    ->addAttributeToSelect('total_paid')
    ->addAttributeToSelect('base_currency_code')
    ->addAttributeToSelect('order_currency_code')
    ->addAttributeToSelect('shipping_name')
    ->addAttributeToSelect('billing_name')
    ->addAttributeToSelect('created_at')
    ->addAttributeToSelect('updated_at');
$instance->getSelect()
        ->join(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.shipping_description'))
        ->joinLeft(array('sfoi'=>'sales_flat_order_item'),'sfoi.order_id=main_table.entity_id',array('sfoi.sku','sfoi.product_type','sfoi.name','sfoi.product_options'))
        ->where('(main_table.status = "processing")')
        ->group(array('sfoi.order_id')); 
$gridcollection = $instance->getFirstItem()->getData();

i need product options ie. configurable product - super attribute(color,size) with this

after selecting 'product_option' i got below,

a:10:{s:15:"info_buyRequest";a:6:{s:4:"uenc";s:80:"aHR0cDovL2lwaG9uZTVjLmVtc21vYmlsZS5jb20vaXBob25lL2lwaG9uZS01cy13aXRoLXBsYW5zLXA,";s:7:"product";s:2:"73";s:8:"form_key";s:16:"EnCATaJe2xLoYzhQ";s:15:"related_product";s:0:"";s:15:"super_attribute";a:3:{i:176;s:2:"12";i:177;s:2:"19";i:180;s:2:"27";}s:3:"qty";i:1;}s:15:"attributes_info";a:3:{i:0;a:2:{s:5:"label";s:12:"Phone Colour";s:5:"value";s:4:"Gold";}i:1;a:2:{s:5:"label";s:12:"Phone Memory";s:5:"value";s:5:"64 GB";}i:2;a:2:{s:5:"label";s:12:"Plans";s:5:"value";s:8:"POSTPAID";}}s:11:"simple_name";s:29:"iPhone 5S Gold 64 GB Postpaid";s:10:"simple_sku";s:29:"iPhone 5S Gold 64 GB Postpaid";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;s:17:"giftcard_lifetime";N;s:22:"giftcard_is_redeemable";i:0;s:23:"giftcard_email_template";N;s:13:"giftcard_type";N;}

i need, Phone Colour - Gold

Plans - POSTPAID

Phone Memory - 64 GB

how to get this

any ideas? thanks in advance.

  • 1
    You can use unserialize() to break the a:10:{...} into an array. Most of what your looking for is probably in there. – Aepod Mar 11 '14 at 14:50
2

If you have the $orderItem all the options are in $orderItem->getProductOptions().

  • is it possible to write query instead of code – Helphin Mar 11 '14 at 10:05
  • 1
    this would be SELECT product_options FROM sales_flat_order_item but I don't know what you want to do with this. – Fabian Blechschmidt Mar 11 '14 at 11:42
  • i have update the question based on your sugestion, can u help me, to get the values mentioned there – Helphin Mar 11 '14 at 12:22
  • is it possible to filter using query? – Helphin Mar 11 '14 at 12:27

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.