Author: admin

Type of session in Magento 2

Sessions refer to the mechanism used to manage and store user-specific information during their visit to an online store. Magento 2 uses sessions to store data such as shopping cart contents, customer login information and other user related data. There are several types of sessions in Magento 2: Type of session in Magento 2 File […]

Read More

Registry and Register in Magento 2

Registry and Register in Magento 2 Registry: The Registry in Magento 2 is an instance of \Magento\Framework\Registry class. It allows you to store and retrieve data using a key-based approach. Storing Data: use Magento\Framework\Registry; $registry = $objectManager->get(Registry::class); $registry->register(‘key_name’, $value); Retrieving Data: $data = $registry->registry(‘key_name’); Register: The Register in Magento 2 is an instance of \Magento\Framework\RegisterInterface […]

Read More

Magento 2 Rest API Authentication

Magento 2 Rest API Authentication Magento 2 Rest API Three types of API Authentication. Token based authentication OAUTH based authentication Session Based Authentication 1.Token based authentication Customer token : Base_Url/V1/integration/customer/token Method Type: POST Hit url by POSTMAN Body payload : raw { “username”:”test”, “password”:”test” } ——————————- Admin Token : /V1/integration/admin/token Method Type: POST Hit url […]

Read More

Custom rest api event observer confliction Magento2

Custom rest api event observer confliction Magento2 Custom rest api we need to define event and plugins under webapi_rest folder. In this way it will not conflict default features. Vendor/Module/etc/webapi_rest/events.xml <?xml version=”1.0″ ?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Event/etc/events.xsd”> <event name=”sales_model_service_quote_submit_before”> <observer instance=”vendor\module\Observer\Order\Observerclass” name=”events_change”/> </event> </config> namespace vendor\module\Observer\Order; use Magento\Quote\Model\QuoteRepository; use Psr\Log\LoggerInterface; class Observerclass implements \Magento\Framework\Event\ObserverInterface { protected […]

Read More