:::: MENU ::::
Posts tagged with: M2

Magento 2 after save and before save method

This tutorial is about Magento 2 after save and before save method .i.e how to use after save and before save methods in magento 2.I assume you want to add after save and before save method of Magento 2 in your model.So, how can we do this?. This tutorial will tell us,how we can do that?

Magento is a flexible platform and it covers almost all the basic and necessary functionalities. Magento has its own _beforeSave and _afterSave functions. You can use them in your ResourceModel using below code.

Before Save

_beforeSave function called when you tried to update or insert data in database table with your model. Then _beforeSave function is called. You can implement you logic like validation, Post data change or any other functionality you want perform.

    namespace QaisarSatti\HelloWorld\Model\ResourceModel;
    class Test extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb  {

        protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
            // do your logic here




After Save

_afterSave function called when After update or insert data in database table with your model. Then _afterSave function is called. You can implement you logic like sending email, Add related data or any other functionality you want perform.

    namespace QaisarSatti\HelloWorld\Model\ResourceModel;
    class Test extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb  {

       protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
          //do your logic here


That’s it from this tutorial. I hope it serves the purpose.
Since these are learning tutorials,please feel free to drop any suggestions or queries in comments section. That will definitely be highly appreciated.

Author: Qaisar Satti
Category: Magento 2
Last Modified: November 9, 2018

Magento 2 free payment extensions

This article is about Magento 2 free payment extensions . Many people often look for payment methods of magento and find it difficult to find a suitable method or extension.In this tutorial i will try to list available free magento 2 payment extensions.This tutorial just have information of free extensions that are available on magento marketplace or any other extension provider store.I will try to list few here with brief descriptions as well.

Below are the free magento payment method extensions.

Magento payment extensions

Magento provides its own payment methods.But here we will discuss free magento shipping extensions.Because these are available for free so anyone can use them.First,lets have a look at the default magento payment methods.

Default magento payment methods:

  • Saved CC
  • Check / Money Order
  • Zero Subtotal Checkout
  • Bank Transfer Payment
  • Cash On Delivery Payment
  • Purchase Order
  • Authorize.net Direct Post
  • Authorize.net

Above are the default payment methods provided by magento.You can use them by going to configuration settings and then modifying payment methods.

Now lets have a look at the free available magento 2 payment extensions.

WAVES Crypto Currency Payments

The blockchain is the technology that has been slowly but steadily taking root in multiple spheres of businesses. It triggered the emergence of cryptocurrencies that progressively find the way into eCommerce. WAVES is the decentralized blockchain platform that focuses on custom blockchain tokens operations. It has high usability and can boast of the wallets that are securely protected to ensure that their owners are the only ones to access the crypto payments.

Key features

  • Inexpensiveness
  • Speed
  • Security
  • Transparency
  • Irreversibility

Extension Link

Ingenico ePayments

Ingenico ePayments is the online and mobile commerce division of Ingenico Group. We connect merchants and consumers, enabling businesses everywhere to go further beyond today’s boundaries and creating the future of global commerce.

Key features

  • Origin verification based on the SHA verification
  • 1-step checkout for credit cards
  • PCI compliant template handling
  • Multiple/Partial captures/refunds
  • Accept payments by mail or telephone (MOTO)
  • Send reminder mail with link to payment page
  • Display fraud result in order
  • Improve fraud detection through device fingerprinting
  • Credit/Debit card split
  • Dynamically add payment methods
  • Advanced fraud detection support

Extension Link

Stripe Payments

Stripe is a global technology company that builds economic infrastructure for the internet. Businesses of every size—from startups to public companies—use our software to accept payments and manage their businesses. Millions of companies in 120+ countries use Stripe to start, run, and scale their businesses.

Key features

  • Accept all major debit and credit cards as well as local payment methods
  • Benefit from Stripe Elements, which helps your users input their payment information quickly and correctly at checkout
  • Achieve PCI-DSS compliance with Stripe Elements hosted input fields
  • Optimized for mobile and fast checkout with Apple Pay, Google Pay, and Payment Request API support
  • Better detect and prevent fraud with the help of Stripe Radar and optional 3D Secure
    Easily capture authorizations and process refunds from your Magento Backend

Extension Link

Internal Payment Method

This extension for Magento 2 allows you to have a specific payment method in your store’s backend for capturing offline payments. With this payment method enabled, you are able to create orders in your store’s backend for your customers and they will not be visible on the checkout page.

Key features

  • Only visible at the backend orders page
  • The store admin can use the method in a similar way as other payment methods in the backend
  • Custom payment name
  • The store admin can use the method in a similar way as other payment methods in the backend
  • It’s OpenSource

Extension Link


Mollie allows you to accept payments and donations online and expand your customer base internationally with support for all major payment methods through a single integration. No need to spend weeks on paperwork or security compliance procedures.

Key features

  • Online within minutes
  • A single solution
  • Transparent pricing
  • Serious security
  • Streamlined checkout
  • Easy refunds
  • Personal Dashboard

Extension Link

Coin Payments

oinPayments extension integrates your Magento 2 store with CoinPayments – a popular online platform that allows accepting, storing, converting, and withdrawing altcoins. At the moment, it supports 70+ cryptocurrencies and provides a unique $tag for accepting payments.

Key features

  • Magento 2 cryptocurrency trading: accept Bitcoin, Ethereum, and other altcoins as payment for products and services you sell
  • Use Magento 2 cryptocurrency wallets to store the altcoins
  • Magento 2 Ethereum wallet
  • Magento 2 Bitcoin wallet
  • Various Magento 2 altcoin wallets
  • Magento 2 Cryptocurrency PayPal integration: send payments to PayPal without any fees
  • Transparent transaction history: view separate logs for deposits, transfers, withdrawals, and conversions

Extension Link

Similarly there are many other extensions available. I tried to list a few. I hope this tutorial help you in any way.

Please feel free to drop any suggestions or queries in comments section. It will be highly appreciated.

Author: Qaisar Satti
Category: Magento 2
Last Modified: November 9, 2018

Magento 2.3 new features

Today we will talk about magento 2.3 new features. Though the magento version 2.3 is not released yet,but magento is planning to release it by the end of this year.During its imagine conference magento announced its plans for the upcoming Magento 2.3 release.Like every major release, there are various exciting features that are set to bring new opportunities for magento clients to sell to their customers, as well as notable back-end efficiencies.

In this article we will look at new features of an enhanced version.i.e magento 2.3.

Magento 2.3 new features

We will have a brief look at the new features and improvements.


A Progressive Web App is an application,built to take advantage of modern technology features. It provides the feature of caching of data so the website can be used (partially or fully) in an offline mode when internet service is unavailable.
Magento recognizes the multiple benefits to this, and in late 2017 announced its efforts in building what it calls the PWA Studio. PWA Studio will contain tools to develop and deploy a PWA for Magento’s front end. Along with PWA Studio will come a lightweight (not feature-full) demo site. The immediate benefits will be a major increase in front-end performance and a close to 10X increase in speed of onboarding new Magento front-end developers.


GraphQL is a query language for using APIs. With advancement in PWA,it is the need of the hour to get smaller amounts of data and to make fewer API requests.GraphQL’s query language makes this possible by allowing the requestor to request a limited subset of attributes to be returned about an entity (significantly smaller responses) and allows you to chain requests (smaller number of requests).

Magento currently supports REST and SOAP API requests that use Service Contracts. However, to support GraphQL,Magento is writing an entirely new layer that interfaces directly to the Query API. The GraphQL implementation will be the underpinnings on how a PWA frontend will retrieve the data it needs.

Declarative Database Schema

Until now the to change the schema of magento database, you can do that using InstallSchema and UpgradeSchema classes where code is written to modify the schema.

Furthermore Magento 2.3 will change the recommended way by implementing a declarative database schema. This technique will try to accomplish multiple goals, some of which were discussed here. Instead of the database schema definitions being fragmented throughout many install and upgrade scripts, it will be fully defined via XML.

Multi-Source Inventory (MSI)

Magento is introducing multi-source inventory management to Magento’s core.This will let merchants to natively manage inventory via multiple sources.This will also enhance the shipping methods like the shipping of items and tracking of stock levels from multiple warehouses,as well as inventory within retail stores to support “ship from store” and “pick up in store”.
Furthermore Magento 2.3 will also include new functionality around the reservation mechanism of inventory. Inventory is now reserved within a new table structure instead of the direct decrementing of stock. This will increase performance and prevent database unnecessary locking during the order.

Asynchronous API

The Asynchronous WebAPI allows a system to execute API calls asynchronously against the Magento REST API.Because of this, integrations don’t have to wait for requests to fully process when making the calls. This improves the performance of integrations that require many API calls, such as a bulk product integration or customer import. A separate status reporting API will be available to check on the progress of the request by ID. This functionality will be available in both Magento Commerce 2.3 and Magento Open Source.

Page Builder

One of the most amazing and waited for feature of magento is Magento’s native CMS.Magento purchased the Blue Foot CMS technology from Gene Commerce and has made that available to its Magento Commerce merchants. Page Builder is a rewrite of Blue Foot CMS using much of the same foundational features and concepts. These features include template creation, drag-and-drop layout management, and a UX that is clean and friendly to use for a non-technical user.
Page Builder will come natively with Magento Commerce 2.3 and will be available for purchase inside the Magento Marketplace for Open Source implementations.


Magento 2.3 will have enhanced security.To protect against malicious users that have obtained a password,in any way magento is implementing two-factor authentication. This extra layer of security will require a user to prove that they have access by sending a security code to their phone or email.Similar to many web applications as it is already implemented across the globe extensively.

Message Queue

Support for message queuing is being extended from Magento Commerce to Magento Open Source. Message queues enable asynchronous communication between systems.


Support for ElasticSearch is being extended from Magento Commerce to Magento Open Source. ElasticSearch, in addition to many other usages, powers Magento’s site search capabilities, including faceted search (filtering by attributes).

PHP 7.2

PHP 7.2 brings new development features, as well as an increase in performance and security.


Because 7.2 is dropping support for mcrypt (PHP’s go to encryption module), the libsodium module will now be used for encryption.

Import/Export Improvements

Through community engineering, many improvements in speed and usability of import/export functionality are being added to the Magento core.

Contact DEG to learn how our customized ecommerce solutions can boost engagement and improve your conversion rate.

Cache Management ACL

Magento is adding fine-grained administration access control around the ability to interact with the system cache. Caching provides a much-needed layer of performance for Magento, and in the wrong hands, performance can dramatically suffer.

Google reCAPTCHA

Magento is switching the technology used for proving that users are humans, not bots, when interacting with a site. Google’s reCAPTCHA tool will now come native.

So after knowing that what will magento 2.3 bring in, it seems really a hard worked and enhanced version.And certainly it will bring more flexibility and versatile features in magento.

Right then this article is purely informational.I hope it will serve its purpose.I am always open to queries and suggestions. Please feel free to drop any.

Author: Qaisar Satti
Category: Magento 2
Last Modified: October 29, 2018

Indexer in Magento 2

This tutorial is about Indexer in Magento 2. First of all lets discuss what is indexing in magento 2? The answer is how Magento 2 transforms data ( products, categories) to improve the performance of your storefront is called indexing.To optimize storefront performance, Magento accumulates data into special tables using indexers. As magento stores lots of data (including catalog data, prices, users, stores) in many database tables.

Lets have an example to clarify the concept. Suppose you changed the price of an item from $4.99 to $3.99. Magento must reindex the changed price to display it on your storefront. Otherwise loading the product information would take a long time, which may result in cart abandonment.

So this was a brief introduction of indexing.Now, lets come to our topic. In this tutorial we will look at different aspects and functionalities of indexing.

Above all lets start learning

indexing in magento 2

We will start with Magento 2 indexers.

Magento 2 indexers

There are basically 10 indexers. we can say that there are 10 default indexers. Which are as follows:

– Design Config Grid ( name: design_config_grid )
– Customer Grid ( name : customer_grid )
– Category products ( name: catalog_category_product )
– Product categories ( name: catalog_product_category)
– Product price ( name: catalog_product_price)
– Product entity attribute value ( name: catalog_product_attribute)
– Catalog search ( name: catalogsearch_fulltext)
– Stock ( name: cataloginventory_stock)
– Catalog rule product ( name: catalogrule_rule)
– Catalog product rule ( name: catalogrule_product)

Furthermore you can look indexer info using following command:

php bin/magento indexer:info

Now we will discuss Indexer status.

Indexer status

An indexer status can be one of following:

– valid: data is synchronized, no reindex required
– invalid: the original data was changed, the index should be updated
– working: indexing is in progress

Similarly you can get indexer status using the following command:

php bin/magento indexer:status

Furthermore lets have a look at Indexing modes.

Indexing modes

Re-indexing can be performed in two modes:

Update on Save: index tables are updated immediately after the dictionary data ( product, category, store…) is changed.
Update by Schedule: index tables are updated by cron job according to the configured schedule.

Similarly you can get indexer status using the following command:

php bin/magento indexer:show-mode

Following command can change indexer mode:

php bin/magento indexer:set-mode {realtime|schedule} [indexer-name]

For the reason that “realtime” is equal to “Update on Save” and “schedule” is equal to “Update by Schedule”.


Rather using “System -> Index Management” in Magento backend, we can also re-index using the following command:

php bin/magento indexer:reindex [indexer-name]

You will get the result like:
1 Customer Grid index has been rebuilt successfully in

Futhermore reset indexer when it’s locked.h3>

Reset indexer

During re-index process, you may get the message like:

Stock index is locked by another reindex process. Skipping.

So we need to reset that indexer status to be able to re-index ( in this case, it’s “cataloginventory_stock” )

Similarly you can reset indexer using following command:

php bin/magento indexer:reset [indexer-name]

That’s it from this tutorial. I hope it serves the purpose.

Since these tutorials are for learning purpose please feel free to drop any suggestions or queries in comments section. That will definitely be highly appreciated.

Author: Qaisar Satti
Category: Magento 2
Last Modified: October 12, 2018