Example #1
0
 /**
  * Checks allowed quote item for gift messages
  *
  * @param  \Magento\Framework\DataObject $item
  * @return bool
  * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  */
 public function getIsAllowedQuoteItem($item)
 {
     if (!in_array($item->getId(), $this->getAllowQuoteItems())) {
         if ($item->getGiftMessageId() && $this->isGiftMessagesAvailable($item)) {
             $this->addAllowQuoteItem($item->getId());
             return true;
         }
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Retrieve gift message for entity. If message not exists return null
  *
  * @param \Magento\Framework\DataObject $entity
  * @return \Magento\GiftMessage\Model\Message
  */
 public function getGiftMessageForEntity(\Magento\Framework\DataObject $entity)
 {
     if ($entity->getGiftMessageId() && !$entity->getGiftMessage()) {
         $message = $this->getGiftMessage($entity->getGiftMessageId());
         $entity->setGiftMessage($message);
     }
     return $entity->getGiftMessage();
 }