/** * 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) { $url = $product->getProductUrl(false); if ($url) { $isStoreInUrl = $this->_scopeConfig->isSetFlag(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if (!$isStoreInUrl) { $urlInfo = parse_url($url); $store = $product->getStore()->getCode(); if (isset($urlInfo['query']) && $urlInfo['query'] != '') { $url .= '&___store=' . $store; } else { $url .= '?___store=' . $store; } } $links = $entry->getLink(); if (!is_array($links)) { $links = []; } $link = $entry->getService()->newLink(); $link->setHref($url); $link->setRel('alternate'); $link->setType('text/html'); if ($product->getName()) { $link->setTitle($product->getName()); } $links[0] = $link; $entry->setLink($links); } return $entry; }
/** * 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); $name = $this->getGroupAttributeName(); if (!is_null($name)) { $mapValue = $name->getProductAttributeValue($product); } if (!is_null($mapValue)) { $titleText = $mapValue; } elseif ($product->getName()) { $titleText = $product->getName(); } else { $titleText = 'no title'; } $titleText = $this->_googleShoppingHelper->cleanAtomAttribute($titleText); $entry->setTitle($entry->getService()->newTitle()->setText($titleText)); return $entry; }
/** * 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; }
/** * 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; }