public function generate($pageTitle)
    {
        $tags    = parent::generate($pageTitle);
        $product = $this->registry->registry('current_product');

        if (!$product instanceof MagentoProduct) {
            $this->logger->error('Could not retrieve mage product from registry');

            return $tags;
        }
        /** @var \Magento\Store\Model\Store $store */
        $store           = $this->storeManager->getStore();
        $image           = $product->getMediaGalleryImages()->getFirstItem();
        $imageUrl        = is_object($image) ? $image->getData('url') : '';
        $name            = $product->getName();
        $description     = $product->getDescription();
        $availableText   = $product->isInStock() ? 'instock' : 'oos';
        $categoryName    = $this->getCategoryName();
        $defaultCurrency = $store->getCurrentCurrency()->getCode();

        $eanIdentifier = $this->config->getConfigByPath(ExportInterface::PATH_PROD_EAN_CODE)->getValue();
        $ean           = (string) $product->getData($eanIdentifier);

        $taxClassId   = $product->getTaxClassId();
        $storeId      = $store->getId();
        $taxRate      = $this->taxCalculation->getDefaultCalculatedRate($taxClassId, null, $storeId);
        $priceIsGross = $this->taxConfig->priceIncludesTax($this->storeManager->getStore());
        $price        = $product->getFinalPrice();
        $priceNet     = $priceIsGross ? round($price / (1 + $taxRate), 2) : round($price, 2);
        $priceGross   = !$priceIsGross ? round($price * (1 + $taxRate), 2) : round($price, 2);

        $productTags = [
            TagGenerator::SITE_PARAMETER_PRODUCT_IMAGE             => $imageUrl,
            TagGenerator::SITE_PARAMETER_PRODUCT_NAME              => $name,
            TagGenerator::SITE_PARAMETER_PRODUCT_DESCRIPTION_SHORT => $description,
            TagGenerator::SITE_PARAMETER_PRODUCT_EAN               => $ean,
            TagGenerator::SITE_PARAMETER_PRODUCT_AVAILABILITY      => $availableText,
            TagGenerator::SITE_PARAMETER_PRODUCT_CATEGORY          => $categoryName,
            TagGenerator::SITE_PARAMETER_PRODUCT_PRICE             => $priceGross,
            TagGenerator::SITE_PARAMETER_PRODUCT_PRETAX_PRICE      => $priceNet
        ];

        if ($priceGross || $priceNet) {
            $productTags[TagGenerator::SITE_PARAMETER_PRODUCT_CURRENCY]        = $defaultCurrency;
            $productTags[TagGenerator::SITE_PARAMETER_PRODUCT_PRETAX_CURRENCY] = $defaultCurrency;
        }
        $tags = array_merge($tags, $productTags);

        return $tags;
    }
public function generate($pageTitle)
    {
        $tags    = parent::generate($pageTitle);
        $product = $this->registry->registry('current_product');

        if (!$product instanceof MagentoProduct) {
            $this->logger->error('Could not retrieve mage product from registry');

            return $tags;
        }
        /** @var \Magento\Store\Model\Store $store */
        $store           = $this->storeManager->getStore();
        $image           = $product->getMediaGalleryImages()->getFirstItem();
        $imageUrl        = is_object($image) ? $image->getData('url') : '';
        $name            = $product->getName();
        $description     = $product->getDescription();
        $availableText   = $product->isInStock() ? 'instock' : 'oos';
        $categoryName    = $this->getCategoryName();
        $defaultCurrency = $store->getCurrentCurrency()->getCode();

        $eanIdentifier = $this->config->getConfigByPath(ExportInterface::PATH_PROD_EAN_CODE)->getValue();
        $ean           = (string) $product->getData($eanIdentifier);

        $taxClassId   = $product->getTaxClassId();
        $storeId      = $store->getId();
        $taxRate      = $this->taxCalculation->getDefaultCalculatedRate($taxClassId, null, $storeId);
        $priceIsGross = $this->taxConfig->priceIncludesTax($this->storeManager->getStore());
        $price        = $product->getFinalPrice();
        $priceNet     = $priceIsGross ? round($price / (1 + $taxRate), 2) : round($price, 2);
        $priceGross   = !$priceIsGross ? round($price * (1 + $taxRate), 2) : round($price, 2);

        $productTags = [
            TagGenerator::SITE_PARAMETER_PRODUCT_IMAGE             => $imageUrl,
            TagGenerator::SITE_PARAMETER_PRODUCT_NAME              => $name,
            TagGenerator::SITE_PARAMETER_PRODUCT_DESCRIPTION_SHORT => $description,
            TagGenerator::SITE_PARAMETER_PRODUCT_EAN               => $ean,
            TagGenerator::SITE_PARAMETER_PRODUCT_AVAILABILITY      => $availableText,
            TagGenerator::SITE_PARAMETER_PRODUCT_CATEGORY          => $categoryName,
            TagGenerator::SITE_PARAMETER_PRODUCT_PRICE             => $priceGross,
            TagGenerator::SITE_PARAMETER_PRODUCT_PRETAX_PRICE      => $priceNet
        ];

        if ($priceGross || $priceNet) {
            $productTags[TagGenerator::SITE_PARAMETER_PRODUCT_CURRENCY]        = $defaultCurrency;
            $productTags[TagGenerator::SITE_PARAMETER_PRODUCT_PRETAX_CURRENCY] = $defaultCurrency;
        }
        $tags = array_merge($tags, $productTags);

        return $tags;
    }
public function generate ( $ pageTitle ) { $ tags = parent :: generate ( $ pageTitle ) ; $ product = $ this -> registry -> registry ( 'current_product' ) ; if ( ! $ product instanceof MagentoProduct ) { $ this -> logger -> error ( 'Could not retrieve mage product from registry' ) ; return $ tags ; } /** @var \Magento\Store\Model\Store $store */ $ store = $ this -> storeManager -> getStore ( ) ; $ image = $ product -> getMediaGalleryImages ( ) -> getFirstItem ( ) ; $ imageUrl = is_object ( $ image ) ? $ image -> getData ( 'url' ) : '' ; $ name = $ product -> getName ( ) ; $ description = $ product -> getDescription ( ) ; $ availableText = $ product -> isInStock ( ) ? 'instock' : 'oos' ; $ categoryName = $ this -> getCategoryName ( ) ; $ defaultCurrency = $ store -> getCurrentCurrency ( ) -> getCode ( ) ; $ eanIdentifier = $ this -> config -> getConfigByPath ( ExportInterface :: PATH_PROD_EAN_CODE ) -> getValue ( ) ; $ ean = ( string ) $ product -> getData ( $ eanIdentifier ) ; $ taxClassId = $ product -> getTaxClassId ( ) ; $ storeId = $ store -> getId ( ) ; $ taxRate = $ this -> taxCalculation -> getDefaultCalculatedRate ( $ taxClassId , null , $ storeId ) ; $ priceIsGross = $ this -> taxConfig -> priceIncludesTax ( $ this -> storeManager -> getStore ( ) ) ; $ price = $ product -> getFinalPrice ( ) ; $ priceNet = $ priceIsGross ? round ( $ price / ( 1 + $ taxRate ) , 2 ) : round ( $ price , 2 ) ; $ priceGross = ! $ priceIsGross ? round ( $ price * ( 1 + $ taxRate ) , 2 ) : round ( $ price , 2 ) ; $ productTags = [ TagGenerator :: SITE_PARAMETER_PRODUCT_IMAGE => $ imageUrl , TagGenerator :: SITE_PARAMETER_PRODUCT_NAME => $ name , TagGenerator :: SITE_PARAMETER_PRODUCT_DESCRIPTION_SHORT => $ description , TagGenerator :: SITE_PARAMETER_PRODUCT_EAN => $ ean , TagGenerator :: SITE_PARAMETER_PRODUCT_AVAILABILITY => $ availableText , TagGenerator :: SITE_PARAMETER_PRODUCT_CATEGORY => $ categoryName , TagGenerator :: SITE_PARAMETER_PRODUCT_PRICE => $ priceGross , TagGenerator :: SITE_PARAMETER_PRODUCT_PRETAX_PRICE => $ priceNet ] ; if ( $ priceGross || $ priceNet ) { $ productTags [ TagGenerator :: SITE_PARAMETER_PRODUCT_CURRENCY ] = $ defaultCurrency ; $ productTags [ TagGenerator :: SITE_PARAMETER_PRODUCT_PRETAX_CURRENCY ] = $ defaultCurrency ; } $ tags = array_merge ( $ tags , $ productTags ) ; return $ tags ; }
Generates page specific tags + generic tags

@param string $pageTitle

@return array
@throws \Magento\Framework\Exception\LocalizedException
Generates page specific tags + generic tags