Получение пользовательских атрибутов из элемента заказа


Я добавил некоторые пользовательские атрибуты "на лету" в элемент цитаты, как описано в в этом посте .

Что я пытаюсь сделать, так это получить значение этих пользовательских атрибутов в наблюдателе, запускаемом при проверке_onepage_controller_success_action

Я получил объекты элемента заказа следующим способом:

$orderIds = $observer->getEvent()->getOrderIds();
foreach($orderIds as $eachOrderId) {
    $order = Mage::getModel('sales/order')->load($eachOrderId);
    $items = $order->getAllVisibleItems();
    foreach($items as $item)
    {
        //Here are the methods I've used to get the custom attributes below

        //The below works to get an array of product options, but it gets output like this**
        //The custom attributes are in there somewhere though, so I know the information
        //is available, just how to get it?
        $item['product_options']

        //The below doesn't work, $options is a non-object
        $helper = Mage::helper('catalog/product_configuration');
        $options = $helper->getCustomOptions($item);
        if ($options) {
            foreach ($options as $key => $value)
            {
            }
        }

        //The below doesn't work, $options is a non-object
        $optionsArr = $item->getProductOptions();
        if(count($optionsArr['options']) > 0)
        { }
    }
}


**
a:6:{
    s:15:"info_buyRequest";
    a:5:{
        s:4:"uenc";
        s:88:"aHR0cDovL3RhbGtpbmd0b20ubWVyRTHSDF546747J7887HG0UG64X3Byb2R1Y3Qvdmlldy9pZC8yOS8,";
        s:7:"product";
        s:2:"29";
        s:7:"options";
        a:2:{
            s:4:"Logo";
            s:8:"img1.jpg";
            s:5:"Quote";
            s:8:"img2.jpg";
        }
        s:15:"super_attribute";
        a:2:{
            i:141;
            s:1:"9";
            i:152;
            s:2:"18";
        }
        s:3:"qty";
        i:1;
    }
    s:15:"attributes_info";
    a:2:{
        i:0;
        a:2:{
            s:5:"label";
            s:4:"Size";
            s:5:"value";
            s:5:"Large";
        }
        i:1;
        a:2:{
            s:5:"label";
            s:6:"Colour";
            s:5:"value";
            s:3:"Red";
        }
    }
    s:11:"simple_name";
    s:22:"Flower Red Large";
    s:10:"simple_sku";
    s:7:"4t5454t";
    s:20:"product_calculations";
    i:1;
    s:13:"shipment_type";
    i:0;
}

Атрибуты, которые мне нужны здесь:

S:4: "Логотип"; s:8:"img1.jpg "; s:5: "Цитата"; s:8:"img2.jpg";

 1
Author: Community, 2014-06-06

1 answers

Я был недалек от истины. Чтобы получить пользовательские атрибуты, я использовал это в наблюдателе:

$prodOptions = $item->getProductOptions();
$addOptions = $prodOptions['additional_options'];
 0
Author: user2565123, 2014-06-09 14:11:12