示例#1
0
文件: Item.php 项目: uibar/lavinia2
 /**
  * Returns formatted buy request - object, holding request received from
  * product view page with keys and options for configured product
  *
  * @return \Magento\Framework\DataObject
  */
 public function getBuyRequest()
 {
     $option = $this->getOptionByCode('info_buyRequest');
     $buyRequest = new \Magento\Framework\DataObject($option ? unserialize($option->getValue()) : []);
     // Overwrite standard buy request qty, because item qty could have changed since adding to quote
     $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($this->getQty() * 1);
     return $buyRequest;
 }
示例#2
0
 /**
  * Returns formatted buy request - object, holding request received from
  * product view page with keys and options for configured product
  *
  * @return \Magento\Framework\DataObject
  */
 public function getBuyRequest()
 {
     $option = $this->getOptionByCode('info_buyRequest');
     $initialData = $option ? unserialize($option->getValue()) : null;
     if ($initialData instanceof \Magento\Framework\DataObject) {
         $initialData = $initialData->getData();
     }
     $buyRequest = new \Magento\Framework\DataObject($initialData);
     $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($this->getQty() * 1);
     return $buyRequest;
 }