0

Is there any way to filter custom options in Order items.

I have analysed that order items custom options are saved in sales_flat_order_item table under the column product_options.

My question is how to set addtofilter for custom options

1 Answer 1

0

I don't think you can filter it by any function. you will need to get selected custom options from order and need to check statically if your option is selected or not.

<?php
$items = $order->getAllItems();
$block = Mage::app()->getLayout()->createBlock('sales/order_item_renderer_default');
foreach ($items as $item) {
    $block->setItem($item);
    $_options = $block->getItemOptions();
    foreach ($_options as $option) {
        $label = $option['label'];
        $textValue = $option['print_value'];
        if($label == 'labelvalue'){
            //do your stuff
        }
    }
}
?>
1
  • Ok thanks. But actually I want to load it in order collection
    – vinothavn
    Commented Oct 27, 2015 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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