Skip to content

Conversation

@gwharton
Copy link
Contributor

@gwharton gwharton commented Jul 16, 2019

Original PR (*)

  1. [2.3] Provide fallback GalleryOptions class when argument missing from layout xml file #23733: [2.3] Provide fallback GalleryOptions class when argument missing from layout xml file

Description (*)

The main product gallery layout file "catalog_product_view.xml" in "Magento_Catalog" now requires the argument "gallery_options" to be injected to the instance of the
"\Magento\Catalog\Block\Product\View\Gallery" class for the "product.info.media.image" block in order for the product page to be rendered correctly (This is a recent change). If this option is not present then the product page will just render the product image, and nothing else as the getGalleryOptions() call will just return null.

This is not a problem in vanilla Magento, as the argument is present in the layout file, however third party module providers, or anyone instantiating an instance of the "\Magento\Catalog\Block\Product\View\Gallery" class, or inheriting from it now needs to inject this argument for the template to render correctly. This has broken backwards compatability with old third party modules code, who now need to update to inject this argument.

This PR introduces code into the phtml template, that detects if the option is not injected, and falls back to hard coded "\Magento\Catalog\Block\Product\View\GalleryOptions" class.

Fixed Issues (if relevant)

  1. When viewing product only the image shows #23432: When viewing product only the image shows

Manual testing scenarios (*)

  1. Remove argument "gallery_options" from "catalog_product_view.xml" in Magento_Catalog module.
  2. Clear cache
  3. View product page (product that has an image)
  4. Ensure product page renders correctly.

Questions or comments

See notes and discussion in Original PR where it is being discussed whether to implement this series of PR's or not. This backport should follow whatever the decision is for the 2.3 release line's PR.

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 Jul 16, 2019

Hi @gwharton. 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.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@VladimirZaets
Copy link
Contributor

Hi @gwharton.
The next 2.2 release will be the last of functional releases.
Due to it, we are closing 2.2-develop for contribution.
Thanks for collaboration.

@m2-assistant
Copy link

m2-assistant bot commented Jul 16, 2019

Hi @gwharton, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@VladimirZaets VladimirZaets self-assigned this Jul 16, 2019
@gwharton gwharton deleted the 2.2-develop-galleryoptions branch July 17, 2019 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants