添加到购物车按钮在 magento 2.4.4 的产品页面上不起作用

问题描述 投票:0回答:1

“添加到购物车”按钮在 magento 2.4.4 的产品页面上不起作用。 [在此输入图像描述][1]

(1) Magento_Catalog/templates/product/view/form.phtml

` require([ 'jquery', 'priceBox' ], function($){ var dataPriceBoxSelector = '[data-role=priceBox]', dataProductIdSelector = '[data-product-id=escapeHtml($_product->getId($_product->getId( )) ?>]',priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

priceBoxes = priceBoxes.filter(function(index, elem){
    return !$(elem).find('.price-from').length;
});

priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});

});

`

(2) 更新 core_config_data SET value = REPLACE(value, 'http://magento246.local/', 'http://magento246.local/') WHERE path = 'design/head/includes';

(3) 设置:升级、设置:di:编译、索引器:重新索引、设置:静态内容:部署 -f、缓存:刷新、缓存:清理、rm -rf var/cache/*

(4) [在此输入图像描述][2]

我用了很多方法解决了这个bug,但还是没有修复。以上是其中一些方法。

这个问题偶尔会出现。并不总是出现,它出现在所有 6 种产品中。

它仅出现在产品页面上。如果我们从类别页面添加到购物车,则不会出现该错误。

如果我从类别中翻页,那么我会进行购物车。然后,如果我在产品页面上执行此操作,则不会出现此错误。

当我直接在产品页面上执行此操作时,就会出现此错误。

当时还没有广告车。

(Magento2.4.4)

是的,我尝试解决,但这个错误尚未修复。



  [1]: https://i.stack.imgur.com/cGbHd.png
  [2]: https://i.stack.imgur.com/Yyo2v.png
php magento2 magento2.4.4
1个回答
0
投票

试试这个

{ “[data-role=priceBox][data-price-box=product-id-escapeHtml($_product->getId()) ?>]”: { “价格框”:{ “priceConfig”: getJsonConfig() ?> } } }

© www.soinside.com 2019 - 2024. All rights reserved.