Created
November 8, 2019 11:49
-
-
Save denvit/333c4a0508953acca6772b70d20b931f to your computer and use it in GitHub Desktop.
Solution for Firebear Configurable products NoSuchEntityException on categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function afterGetValue(\Magento\ConfigurableProduct\Pricing\Price\FinalPrice $subject, $result) | |
{ | |
/** | |
* @todo Add check on whether preselect is enabled | |
**/ | |
$defaultProductId = $this->defaults->getDefaultProductId($subject->getProduct()); | |
if (!$defaultProductId) { | |
$defaultProductId = (int) $this->_request->getParam('id'); | |
} | |
if ($defaultProductId) { | |
$isCatalogProductView = $this->_request->getControllerName() == 'product'; | |
if ($isCatalogProductView) { | |
$defaultProduct = $this->productRepository->getById($defaultProductId); | |
if ($defaultProduct && $defaultProduct->getTypeId() !== 'configurable') { | |
$result = (float)$defaultProduct->getPrice(); | |
} | |
} | |
} | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment