3

This is my collection:

$collection = 

Mage::getModel('checkout/cart')->getQuote()->getItemsCollection()
                    ->addFieldToFilter('product_type', ['eq' => 'bundle']);
$collection->getSelect()
      ->joinLeft(
            ['sfqio' => 'sales_flat_quote_item_option'],
            'main_table.item_id = sfqio.item_id'
      )->where('code = ?', 'additional_options');
//$collection->getSelect()->columns('sfqio.value');

I want to get the data from the value column, but it is null:

foreach ($collection as $items => $item){
     var_dump($item->getData('value'));
}

If I display the query and executed directly in phpmyadmin(for instance) , I got the value column with a serialized data. In my var_dump case , it is always null. Why ?

1 Answer 1

0

I think it's probably something related to the code in your project as the following code works for me:

require_once('app/Mage.php');
Mage::app();

$collection = Mage::getModel('sales/quote')->load(1)->getItemsCollection();
$collection->getSelect()
    ->joinLeft(
        ['sfqio' => 'sales_flat_quote_item_option'],
        'main_table.item_id = sfqio.item_id'
    );

foreach ($collection as $items => $item){
     var_dump($item->getData('value'));
}

Your Answer

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

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