3

Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Catalog\Block\Product\ImageFactory::getRatio() must be of the type integer, string given, called in /Users/mpxq2/Projects/server/vendor/magento/module-catalog/Block/Product/ImageFactory.php on line 155 and defined in /Users/mpxq2/Projects/server/vendor/magento/module-catalog/Block/Product/ImageFactory.php on line 92

TypeError: Argument 1 passed to Magento\Catalog\Block\Product\ImageFactory::getRatio() must be of the type integer, string given, called in /Users/mpxq2/Projects/server/vendor/magento/module-catalog/Block/Product/ImageFactory.php on line 155 in /Users/mpxq2/Projects/server/vendor/magento/module-catalog/Block/Product/ImageFactory.php on line 92

I'm trying to open any category page and getting this errors. Just updated to 2.3.0. setup:upgrade, static-content:deploy, setup:di:compile, cache:flush and indexer:reindex already done... How can i solve this?

3
  • delete the generated folder and clean the cache – Ghulam.M Mar 1 '19 at 14:59
  • @GeeEmm didn't help – dukir Mar 1 '19 at 15:36
  • @dukir have you got any solution for this? – Piyush Apr 3 '20 at 7:59
0

this file use

vendor/magento/module-catalog/view/frontend/templates/product/view/opengraph/general.phtml

        <?php
            /**
            * Copyright © Magento, Inc. All rights reserved.
            * See COPYING.txt for license details.
            */

            /** @var $block \Magento\Catalog\Block\Product\View */
            ?>

            <meta property="og:type" content="product" />
            <meta property="og:title"
            content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getName()) ?>" />
            <meta property="og:image"
            content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
            <meta property="og:description"
            content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getShortDescription()) ?>" />
            <meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" />
            <?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()) :?>
            <meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/>
            <?= $block->getChildHtml('meta.currency') ?>
            <?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.