EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Fix grouped/bundeled prices in autocomplete #262

Closed ah-net closed 1 year ago

ah-net commented 1 year ago

Fixes https://github.com/EmicoEcommerce/Magento2TweakwiseHyva/issues/24

Grouped/bundled prices in the autocomplete dropdown are not correct. This fix uses the price from tweakwise to show in the autocomplete dropdown.

epolish commented 1 year ago

Hello, guys! Thanks a lot for that fix! I've found another issue in vendor/emico/tweakwise/Model/Autocomplete/DataProviderHelper.php::getProductItems() line 147 The foreach loop should be like this

foreach ($response->getProductData() as $item) {
    $product = $productCollection->getItemById($item['id']);

     if (!$product) {
        continue;
    }

    $product->setData('tweakwise_price', $item['tweakwise_price']);

    $result[] = $this->productItemFactory->create(['product' => $product]);
}

Because a product can be null

$product = $productCollection->getItemById($item['id']);
$product->setData('tweakwise_price', $item['tweakwise_price']);