Skip to content
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

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

Conversation

madhurajawat
Copy link

…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)

  1. magento/magento2#<issue_number>: Configurable product not showing price on category and product page Configurable product not showing price on category and product page #28068

Manual testing scenarios (*)

  1. Create a configurable product, all simple products are out of stock
  2. Go to -> detail page of the configurable product
  3. The product price does not show

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented May 18, 2020

Hi @madhurajawat. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered only manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s). <test-build(s)> is a comma-separated list of build names. Allowed build names are Database Compare, Functional Tests CE, Functional Tests EE, Functional Tests B2B, Integration Tests, Magento Health Index, Sample Data Tests CE, Sample Data Tests EE, Sample Data Tests B2B, Static Tests, Unit Tests, WebAPI Tests.

ℹ️ 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();

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);

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.

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Aug 17, 2020
@pradeepkanaka
Copy link

Is this a valid fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Partner: Ranosys Technologies partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: pending review Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Pull Requests Dashboard
  
Pending Review
Development

Successfully merging this pull request may close these issues.

None yet

5 participants