0

Trying to get data from 'info_buyRequest' the same way i have in other templates using:

$item->getBuyRequest()

This doesn't work in \Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice

When I var_dump($item) i see the string name of 'info_buyRequest':

var_dump($item);

//outputs
...
protected '_origData' => 
    array (size=80)
      'item_id' => string '12823' (length=5)
      'order_id' => string '4003' (length=4)
      'parent_item_id' => null
      'quote_item_id' => string '37733' (length=5)
      'store_id' => string '1' (length=1)
      'created_at' => string '2017-04-26 00:35:14' (length=19)
      'updated_at' => string '2017-04-26 00:52:01' (length=19)
      'product_id' => string '47' (length=2)
      'product_type' => string 'simple' (length=6)
      'product_options' => string 'a:2:{s:15:"info_buyRequest";...

but i haven't able to access the data with the different methods i have tried.

2

As per your $item var_dump

$productOption = unserialize($item->getProductOptions());
$infoByRequest = $productOptions['info_buyRequest'];

Or

$orderItem->getProductOptionByCode('info_buyRequest');

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.