Skip to content

Conversation

monteshot
Copy link
Contributor

@monteshot monteshot commented Aug 24, 2022

Description (*)

Fixes for case when application in single/multi store mode:

  • Fixed issue with logo in single/multi store mode for Theme viewmodel
  • Fixed issue with logo in single/multi store mode for Sales viewmodel

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Admin Users unable to change front-end Logo in Design Config when in Single Store Mode #35952

Manual testing scenarios (*)

Use steps from #35952 (comment)

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
…onfig when in Single Store Mode - Fixed issue with logo in single store mode for Theme viewmodel - Fixed issue with logo in single store mode for Sales viewmodel
@m2-github-services m2-github-services added Partner: Perspective partners-contribution Pull Request is created by Magento Partner labels Aug 24, 2022
@m2-assistant
Copy link

m2-assistant bot commented Aug 24, 2022

Hi @monteshot. Thank you for your contribution
Here are 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 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)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review labels Aug 24, 2022
@monteshot
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot monteshot changed the title magento/magento2#35952 Admin Users unable to change front-end Logo in… magento#35952 Admin Users unable to change front-end Logo in… Aug 24, 2022
@monteshot monteshot changed the title magento#35952 Admin Users unable to change front-end Logo in… magento2#35952 Admin Users unable to change front-end Logo in… Aug 24, 2022
@monteshot monteshot changed the title magento2#35952 Admin Users unable to change front-end Logo in… magento/magento2#35952 Admin Users unable to change front-end Logo in… Aug 24, 2022
…onfig when in Single Store Mode - Declared property for registry
@monteshot
Copy link
Contributor Author

@magento run all tests

1 similar comment
@monteshot
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run WebAPI Tests
@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run Functional Tests CE
@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run WebAPI Tests,Functional Tests EE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run Functional Tests B2B, Functional Tests EE, Magento Health Index

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot
Copy link
Contributor Author

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@monteshot monteshot changed the title magento/magento2#35952 Admin Users unable to change front-end Logo in… magento/magento2#35952 Admin Users unable to change front-end Logo in Design Config when in Single Store Mode Aug 26, 2022
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Lima
Copy link
Contributor

engcom-Lima commented May 23, 2023

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop and PHP 8.1

Manual testing scenario:

  • Design Config -> add Logo to StoreView & Save & Flush Cache
  • Update store config and change to Single Store Mode (enabled)
  • Design Config -> Add a new logo to the Website & Save & Flush Cache (storeview unavailable)
  • Check logo in the frontend.

Before: ✖️ Admin side config

Screenshot 2023-05-22 at 4 09 41 PM

Frontend:

Screenshot 2023-05-22 at 4 09 47 PM

After: ✔️ Admin side config

image

Frontend:

Screenshot 2023-05-22 at 4 09 47 PM

Builds are failing. Hence, moving this PR to Extended Testing.

@engcom-Echo
Copy link
Contributor

@magento run Integration Tests,Functional Tests EE,Functional Tests CE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Functional Tests CE and Functional Tests EE failures are different on last two run on same commit.
Functional Tests CE
Run1
image

Run2
image

Functional Tests EE
Run1
image

Run2
image

@engcom-Echo
Copy link
Contributor

We have raised new internal approval request JIRA for MHI failure. Waiting for approvals.
Hence moving this to Pending Approval

Thank you!

@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Integration Tests,Functional Tests CE, Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Integration Tests,Functional Tests CE,Functional Tests EE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Functional Tests CE failure are different on last two run on same commit.
Run1
36008-ce

Run2
36008-CE22

Functional Tests B2B build is green.
For Magento Health Index failure we have approval ticket which is approved.

Hence moving it to merge in progress

@TuVanDev
Copy link
Member

TuVanDev commented Nov 1, 2023

Although this pull request has been merged, it will not be available until the next general releases are published, I created a custom composer patch file (diff file) for Magento and Adobe Commerce version 2.4.5 and higher using this pull request:

diff --git a/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php b/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php index a640526517d47..d133388e4a4c1 100644 --- a/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php +++ b/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php @@ -54,9 +54,13 @@ public function getPath(): ?string if ($order instanceof Order) { $storeId = $order->getStoreId(); } + $scopeType = ScopeInterface::SCOPE_STORE; + if ($this->scopeConfig->getValue('general/single_store_mode/enabled') === "1") { + $scopeType = ScopeInterface::SCOPE_WEBSITE; + } $salesLogoPath = $this->scopeConfig->getValue( 'sales/identity/logo_html', - ScopeInterface::SCOPE_STORE, + $scopeType, $storeId ); @@ -66,7 +70,7 @@ public function getPath(): ?string $headerLogoPath = $this->scopeConfig->getValue( 'design/header/logo_src', - ScopeInterface::SCOPE_STORE, + $scopeType, $storeId ); diff --git a/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php b/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php index 1a10fe9177320..5be2cf9360ed4 100644 --- a/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php +++ b/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php @@ -39,9 +39,13 @@ public function __construct( public function getPath(): ?string { $path = null; + $scopeType = ScopeInterface::SCOPE_STORE; + if ($this->scopeConfig->getValue('general/single_store_mode/enabled') === "1") { + $scopeType = ScopeInterface::SCOPE_WEBSITE; + } $storeLogoPath = $this->scopeConfig->getValue( 'design/header/logo_src', - ScopeInterface::SCOPE_STORE + $scopeType ); if ($storeLogoPath !== null) { $path = Logo::UPLOAD_DIR . '/' . $storeLogoPath; 

To apply this custom composer patch, I suggest using the Vaimo Composer Patches plugin https://github.com/vaimo/composer-patches. This plugin can apply the patch to multiple files within a diff file.

Alternatively, if you prefer to use the Cweagans Composer Patches plugin https://github.com/cweagans/composer-patches, you can refer to the official Adobe Commerce documentation at https://experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/patches/apply.html?lang=en#composer

As the Cweagans Composer Patches plugin does not support applying the patch to multiple files within a diff file, you'll need to create 2 separate diff files:

  • The patch file for the magento/module-theme module's composer package:
diff --git a/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php b/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php index 1a10fe9177320..5be2cf9360ed4 100644 --- a/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php +++ b/vendor/magento/module-theme/ViewModel/Block/Html/Header/LogoPathResolver.php @@ -39,9 +39,13 @@ public function __construct( public function getPath(): ?string { $path = null; + $scopeType = ScopeInterface::SCOPE_STORE; + if ($this->scopeConfig->getValue('general/single_store_mode/enabled') === "1") { + $scopeType = ScopeInterface::SCOPE_WEBSITE; + } $storeLogoPath = $this->scopeConfig->getValue( 'design/header/logo_src', - ScopeInterface::SCOPE_STORE + $scopeType ); if ($storeLogoPath !== null) { $path = Logo::UPLOAD_DIR . '/' . $storeLogoPath; 
  • The patch file for the magento/module-sales module's composer package:
diff --git a/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php b/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php index a640526517d47..d133388e4a4c1 100644 --- a/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php +++ b/vendor/magento/module-sales/ViewModel/Header/LogoPathResolver.php @@ -54,9 +54,13 @@ public function getPath(): ?string if ($order instanceof Order) { $storeId = $order->getStoreId(); } + $scopeType = ScopeInterface::SCOPE_STORE; + if ($this->scopeConfig->getValue('general/single_store_mode/enabled') === "1") { + $scopeType = ScopeInterface::SCOPE_WEBSITE; + } $salesLogoPath = $this->scopeConfig->getValue( 'sales/identity/logo_html', - ScopeInterface::SCOPE_STORE, + $scopeType, $storeId ); @@ -66,7 +70,7 @@ public function getPath(): ?string $headerLogoPath = $this->scopeConfig->getValue( 'design/header/logo_src', - ScopeInterface::SCOPE_STORE, + $scopeType, $storeId ); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: Perspective partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Project: Community Picked PRs upvoted by the community
8 participants