Tag

magento 2.4.6

Browsing

In this blog, we will call rest api for get customer list in magento2.First we need to generate admin token to get customer.You can refer blog for generate admin tokenhttps://www.magedad.com/magento-2-how-to-generate-admin-token-using-rest-api/ Rest API endpoint = https://domain.test/rest/V1/customers/searchMethod = GETContent type = Content-Type:application/jsonHeader = Authorization: Bearer xxxx_token_xxxxParams =searchCriteria[sortOrders][0][field]=entity_idsearchCriteria[sortOrders][0][direction]=ascExample:The following image shows a get customer list using a REST client. I hope this blog is useful to get customer list using Rest API. In case, I missed anything or…

In this blog I will show you how we can generate admin token using REST API.Rest API endpoint = https://domain.test/rest/V1/integration/admin/tokenMethod: POSTContent type = Content-Type:application/jsonPost Data = {“username”:”<USER-NAME>”, “password”:”<PASSWORD>”} Example:The following image shows a token request for the admin account using a REST client: We can refer adobe commerce document for generate tokens.I hope this blog is useful to generate admin token using Rest API. In case, I missed anything or need to add some more…

If you want to delete legacy database table then you can follow this blog. In blog, We try to delete database entries using root script in magento2.Here is script for delete entries from magento database. Create file deleteData.php in magento root directory. You can run script in magento root path on server. You can use php $argv for pass parameters while run script. See documentHere is code you delete entries with parameter command.Command php deleteData.php…

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…

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