Category

Magento2

Category

As we have lots files on server var/log folder. so I have tips for debug logs in adobe cloud or on-premises. Let’s start to analyse logs in magento2.Here is three tips for analyse logs.1. You can monitor live logs using below command. When you run command then you can see live logs.tail -f var/log/*.log 2. If you want to check specific error in old log files then run bewlo command.grep -r ‘error xyz’ var/log/* 3.…

In this blog, I will show you how to upgrade Magento 2.4.5-p1 to 2.4.6-p3 opensource project.If your project integrated with git then first create new branch like release/magento246-p3 using commandgit checkout -b release/magento246-p3We need to upgrade software first. We can see software requirement here Software2.4.5-p12.4.6-p3Composer2.22.2Elasticsearch7.178.7OpenSearch1.22.5MariaDB10.410.6PHP8.18.2, 8.1RabbitMQ3.93.11Redis6.27.0Varnish7.07.3 Run below command to update module version in composer.jsoncomposer require magento/product-community-edition 2.4.6-p3 –no-updateORManually update package version in composer.json file “magento/product-community-edition”: “2.4.6-p3”, Next step is run composer updatethen run magento…

When we upgrade Magento 2.4.6 then we might get deprecated Zend classes errors in custom modules because of some Zend class removed in Magento 2.4.6. In this blog I added some depreciated Zend classes alternative to fix those error. We have some alternative of Zend class are Laminas classes and Magento classesHere is list of alternative of Zend classes.\Zend_Http_Client::POST => \Laminas\Http\Request::METHOD_POST\Zend_Http_Client::GET => \Laminas\Http\Request::METHOD_GET\Zend_Json => \Laminas\Json\Json\Zend_Filter => \Magento\Framework\Filter\FilterInput\Zend_Http_Client => \Laminas\Http\Request\Zend_Http_Response => \Laminas\Http\Response\Zend_Validate => \Laminas\Validator\Zend_Filter_Input => \Magento\Framework\Filter\FilterInput\Zend_Json_Exception…

We’ll show you how to add category attributes in magento2 and display in category form. We show here 3 easy step for add category attribute and display attribute to category form. Step 1: Create patch file for create category attribute. Create file below.app/code/MageDad/Module/Setup/Patch/Data/AddAttributeCategoryAttribute.php Step 2: In this step we are going to add attribute in category form. Create file – app/code/MageDad/Module/view/adminhtml/ui_component/category_form.xml Step 2: Run setup upgrade commandphp bin/magento setup:upgrade I hope this blog is useful…

When you test your magento code with PHPStan then facing some issue for code qaulity like PHPStan: __construct() has parameter $components with no value type specified initerable type array.Might be your code is like below: And error like below: We don’t know array format of $components and $data so we need to ingore this errors in phpstan-baseline.neonNeed to run below command for fix error: I hope you like this solution.

In this blog in explain about how we can get current admin user details from session.We need to use session class Magento\Backend\Model\Auth\Sessiont to get current loggedin admin data.Here is simple code is to get admin details. Code is writter with PHP8 and supported to magento 2.4.6 😍 Created one simple class and loaded Session in construct method You can get more details about user with different methods like for get admin user name $this->authSession->getUser()->getUsername();Here is…

In this blog, I created admin role save after event to save custom field data in tablecreate events.xml file at app/code/<Vendor>/<Module>/etc/events.xml Now Create observer PermissionsRolePrepareSave for save field field_name data in database. Create file at path app/code/MageDad/Module/Observer/Backend/Admin/PermissionsRolePrepareSave.php I hope this blog is useful for save role field data in database. In case, I missed anything or need to add some more information, Don’t heisted to leave a comment in this blog, I’ll get back with…

In Magento 2, you can use the built-in logging system to add logs for debugging purposes. Here’s a step-by-step guide on how to add log in Magento2: Initialize the Logger in your class To start logging, you need to instantiate the \Psr\Log\LoggerInterface in your class. You can do this by adding it to the constructor. Add Log Statements Now, you can use the $this->logger object to add log statements. There are different log levels available,…