Open kestraly opened 1 week ago
Hi @kestraly. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues 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.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @kestraly,
Thanks for the report and collaboration!
It seems to us an expected behavior, If you still need to use the methods from Magento\Swatches\Helper\Data
in your .phtml
file, you should create a ViewModel and use dependency injection to get the Magento\Swatches\Helper\Data
class. Then, you can create a method in your ViewModel that uses the methods from the helper. You can then call this method from your .phtml file.
Else please let us know your use case if you don't want to create a ViewModel.
Thanks
Preconditions and environment
Magento 2.4.x
Accessing the catalog swatch helper data directly from templates is not possible. Is there a reason this is not possible?
Steps to reproduce
Add $this->helper('Magento\Swatches\Helper\Data'); in a .phtml template file that is loaded on a catalog page.
Sample Code
Expected result
Access to Catalog Swatch Helper Data to perform tasks such as
Actual result
main.ERROR: Magento\Swatches\Helper\Data doesn't extends Magento\Framework\App\Helper\AbstractHelper when accessing a page using the .phtml template file.
Additional information
Possible solution for Helper vendor/magento/module-swatches/Helper/Data.php
Update from
class Data
to
class Data extends \Magento\Framework\App\Helper\AbstractHelper
Release note
No response
Triage and priority