示例#1
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Framework\Gdata\Gshopping\Entry $entry
  * @return \Magento\Framework\Gdata\Gshopping\Entry
  */
 public function convertAttribute($product, $entry)
 {
     $mapValue = $this->getProductAttributeValue($product);
     $description = $this->getGroupAttributeDescription();
     if (!is_null($description) && !is_null($description->getAttributeId())) {
         $mapValue = $description->getProductAttributeValue($product);
     }
     if (!is_null($mapValue)) {
         $descrText = $mapValue;
     } elseif ($product->getDescription()) {
         $descrText = $product->getDescription();
     } else {
         $descrText = 'no description';
     }
     $descrText = $this->_gsData->cleanAtomAttribute($descrText);
     $entry->setContent($entry->getService()->newContent()->setText($descrText));
     return $entry;
 }
示例#2
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Framework\Gdata\Gshopping\Entry $entry
  * @return \Magento\Framework\Gdata\Gshopping\Entry
  */
 public function convertAttribute($product, $entry)
 {
     $mapValue = $this->getProductAttributeValue($product);
     $description = $this->getGroupAttributeDescription();
     if ($description !== null && $description->getAttributeId() !== null) {
         $mapValue = $description->getProductAttributeValue($product);
     }
     if ($mapValue !== null) {
         $descrText = $mapValue;
     } elseif ($product->getDescription()) {
         $descrText = $product->getDescription();
     } else {
         $descrText = 'no description';
     }
     $descrText = $this->_googleShoppingHelper->cleanAtomAttribute($descrText);
     $entry->setContent($entry->getService()->newContent()->setText($descrText));
     return $entry;
 }