-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable product not showing price on category and product page #… #28252
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @madhurajawat. Thank you for your contribution
❗ Automated tests can be triggered only manually with an appropriate comment:
ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
|
||
return $this->wrapResult($result); | ||
if(!$result) { | ||
$result = BasePriceBox::_toHtml(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magento\Catalog\Pricing\Render\FinalPriceBox
extends from Magento\Framework\Pricing\Render\PriceBox
(BasePriceBox
).
If I'm not mistaken, with the above in the mind the parent class is actually called twice, once through parent::_toHtml
and once through BasePriceBox::_toHtml
, is there a reason for this and thus on purpose or not?
$msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price'); | ||
} catch (\InvalidArgumentException $e) { | ||
$this->_logger->critical($e); | ||
return $this->wrapResult($result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd refactor everything related to $msrpPriceType
into the try-catch in which $msrpPriceType
is defined, this way the return logic ($this->wrapResult($result)
) is not duplicated.
I can understand if this was done to prevent too much indentation by using an early return. In this case I'd argue that it might be better to refactor it into a separate method responsible for returning either the HTML for the MSRP price rendering or an empty string in case of the exception for example, minimising the overal indentation.
Is this a valid fix? |
…28068
Configurable product not showing price on category and product page when all the associated products are out of stock.
Description (*)
Configurable product not showing price on category and product page when all the associated products are out of stock.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)