diff --git a/Model/Adapter/Product.php b/Model/Adapter/Product.php index 83e1e0c..add5062 100644 --- a/Model/Adapter/Product.php +++ b/Model/Adapter/Product.php @@ -371,6 +371,29 @@ protected function addFieldHandlers() } }); + //Add on_sale fieldhandler + $this->addFieldHandler('final_price', function ($item) { + try { + $finalPrice = $item->getFinalPrice(); + //Fix for configurable products + if ($item->getTypeId() === Configurable::TYPE_CODE) { + $finalPrice = $item->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(); + } + + if ($item->getTypeId() === Bundle::TYPE_CODE) { + $finalPrice = $item + ->getPriceInfo() + ->getPrice('final_price') + ->getMinimalPrice() + ->getValue(); + } + + return $finalPrice; + } catch (\Exception $e) { + return false; + } + }); + } catch (\Exception $e) { $this->clerk_logger->error('Getting Field Handlers Error', ['error' => $e->getMessage()]);