Example #1
0
 /**
  * Insert Item into Google Content
  *
  * @param \Magento\GoogleShopping\Model\Item $item
  * @return $this
  */
 public function insert($item)
 {
     $service = $this->getService();
     $entry = $service->newEntry();
     $type = $item->getType();
     $type->convertProductToEntry($item->getProduct(), $entry);
     $entry = $service->insertItem($entry);
     $published = $this->convertContentDateToTimestamp($entry->getPublished()->getText());
     $item->setGcontentItemId($entry->getId())->setPublished($published);
     $expires = $this->_getAttributeValue($entry, 'expiration_date');
     if ($expires) {
         $expires = $this->convertContentDateToTimestamp($expires);
         $item->setExpires($expires);
     }
     return $this;
 }