How to create custom table in Magento2 Module?

This post will helpful to create a custom mysql table in magento2 module. For creating custom table in magento2 we will use InstallSchema.php and for adding an extra column in magento 2 tables we will use UpgradeSchema.php . Magento2, mysql file should be inside Setup folder under module.

Following is the example of custom table creation. I am going to create a custom table called custom_table.

Use Below code to create a custom table. Create a file called InstallSchema.php in setup folder of module i.e. (app/code/vendor/modulename/Setup/installschema.php). And Use following Code.

namespace vendor\modulename\Setup;
use Magento\Framework\DB\Ddl\Table as Table;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
 * Class InstallSchema
 * @package Eecom\Reservation\Setup
class InstallSchema implements InstallSchemaInterface
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
         * insert new table
        $installer = $setup;
         * Create table 'custom_table'
        $table = $installer->getConnection()->newTable($installer->getTable('custom_table'))
                ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
                ['unsigned' => true, 'nullable' => false],
                'Customer ID'
                'Customer Email'
            ->setComment('Custom  Table');


In above code you can change tableName according to your need and can add more columns.

If you are having any doubts, feel free to contact us at [email protected] . However, if you do have any additional tips or method on this “How to”, you can suggest them in the comment section below.

Stay tuned for more “How to” blog on Magento 2. Till then Happy Magento 2 Coding!

20 Practical Keys to Combat Abandoned Cart on Your Magento Store

The average cart abandonment rate for online retailers is 69.23% – according to Baymard Institute’s list of cart abandonment rate (source: It means two-thirds of the time online visitors add items to their cart only to leave the cart abandoned. That results in tons of lost sales. There’s nothing worse for online retailers than it! And, it is just getting worse day by day. If not dealt accurately, it can lead to business failure.

Don’t worry, you can still envision the hope with Envision Ecommerce! Fortunately, we have some practical keys to help you dwindle that abandoned cart rate on your Magento store. Let’s take a look at all 20 keys.

1. Timely Get Back in Front of Visitors

Most of the customers visit your website, add products to their shopping cart and then go off somewhere else – generally the reason is having last minute doubt regarding your products or services or they want to do some comparison before shopping.

And, this is where a timely reminder shines! Yes, you need to reach out those customers by sending an email within an hour to encourage them to complete the purchase. Your customers may spend some time for comparison shopping and when they get tired & forget your Magento store, an email can be just what’s required to get back in front of them to win them back.

2. Verify Order Status

Check order table in Magento and verify order status of every order whether it is pending or completed. Update your cart record according to that order status. It will help you to exactly get about your abandoned cart rate.

But, you may get fail to verify the status of certain orders, like which are placed over the phone. For such cases, you need to verify the presence of an order via same email as the customer.  If you have an order from an email, you need to stop sending them reminder emails. Otherwise, you will just make your existing customers upset by sending emails that contain irrelevant content or offers. And even worse, if you’ve included incentives or offers in that emails for first-time buyers to encourage them to finish the buying process. It will just make your customers worried that they didn’t get such offers and incentives during their buying time.

Magento’s order management system doesn’t support auto-assign order status and a store owner need to take action in between order processing and completion. It is one of the most imperfect aspects of Magento. In such instances, you can use our Auto Conditional Order Status Update extension which is helpful to make your Magento store’s order management simple and clear. The extension allows you to change order statuses. Thus, you can enjoy automated order status facility instead of changing status manually.

3. Check Product Availability

Keep a regular eye on your Magento store’s inventory and don’t send abandoned cart emails to customers who abandoned cart with out of stock products. It will just leave a bad experience on your customers and will increase your bounce rate.

4. Alert Customers for Low Stock Products

It is the most effective method to avoid afore-shared out of stock and cart abandonment situation. You can put a badge or some type of pointer on your low stock products’ images. It will alert your customers to order more and quickly.

Moreover, you can use our Easy Product Label Magento 2 extension that will help you to assign custom product labels to your preferred products. These product labels will facilitate you to attract more visitors & run different promotional product campaigns (for example, you can display a low stock badge on such product labels), which will result in successful conversions.

5. Don’t Include Countries in Your Magento Store that You Don’t Ship To:

If you don’t ship to some countries but you’ve added them onto you Magento store, then it is essential to exclude such countries. For instance, a customer browses your store from a different country and adds products to cart. After entering his current address and getting an error message that shipping is not available in his regions, he will just leave your store with abandoned cart. Thus, it is good for your Magento store to exclude such countries.

6. Prefer to Send Emails from an Individual Instead of a Group, Company or an Organization

Almost all people prefer to open an email coming from an individual’s end instead of a group, association, company or organization. Just make sure that your email sender is a specific person on your side. Another foremost aspect is to personalize the email with receiver’s first name or the product name in its subject line.

7. Keep Checkout Process Simple, Easy & Faster

A long and complex checkout process only frustrates customers and they eventually give up after filling out a lengthy registration form including billing address, credit card details, shipping address, phone number, etc. So, you need to make your checkout process easier, more simple & efficient, and less “clicks” for the first-time customers. Don’t force your users for registration on just their first-time landing at your Magento store. If they are ready to make a purchase and adding products to their cart, it is the right time to proceed further and ask them for registration process.

You can use One Step Page Checkout extension on your Magento store to offer your customers an optimized and simplified one-page checkout process. It allows customers to update all check out information on a single web page instead of waiting for the next page or going back/forth. Thus, you can make checkout process easier & faster on your Magento store and inhibit shopping cart abandonment.

8. Avoid Bad Surprises during Checkout Process

Another major reason why customers leave their cart abandoned is due to bad surprises during checkout process like hidden costs or some additional costs. You may be charging these costs for shipping, handling or other add-on expenses. But your customers only know a specific price or total expected price. So, you need to be transparent and up-front with your pricing and other additional charges, and also make sure your shoppers are pre-informed and knowledgeable about their total amount before proceeding to checkout.

9. Give Discounts/Offers on Products Abandoned

To effectively get results from abandoners, we encourage you to give discounts or offers on the products abandoned by them. It will entice your shoppers to place an order as they wouldn’t want to let go of such offers and discounts on their desired products.

Using our Enhanced Abandoned Cart Magento extension, you can inform your customers via sending mails regarding the special offers or discounts on the items available in their abandoned cart. So, your Magento store can lead to loyal customers, increased sales & revenue and reduced abandoners.

10. Send Related Products

Most often, customers visit products that they don’t want to buy. You can track such information and use it to understand your shoppers’ interest. For example, a visitor visits your online baby store, browses new born baby collection, adds some products to the cart and leave the cart abandoned. And, it is clear for you to understand your shopper’s interest. Now, you can use this information to retarget such shoppers by sending different products relevant to their choice, or same product at a lower price.

11. Provide Third Party Payment Methods

Make sure your Magento store supports third party payment options like PayPal, Razor, Amazon and several others. People often don’t prefer to fill a long credit card number or other in-depth information. Some shoppers use credits cards that are not MasterCard or Visa-based. Therefore, if your Magento store doesn’t support multiple payment methods, it will leave your shoppers alienated, incapable to buy at your store. So to ensure that your shoppers will not abandoned their shopping cart due to the lack of payment options, it’s essential you offer as many as possible at your online store.

12. Implement Easy Returns, Refunds and Cancellation Policy

Make your customers informed about your return, refund and product cancellation policy at your store. It will help your customers to understand that how easy it is for them to shop from your store. Implementing these policies will entice shoppers to make a purchase or at least try the product, as they know they can easily return or cancel it or even request for refund.

13. Continuous Technical Assistance

Customers may get frustrated due to complicated navigation, excessive security checks or payment gateway crashing problems at your store and leave cart abandoned. Thus, you need to provide a continuous technical support or 24/7 live chat facility so that they can talk to a concerned person about the issue or query.

14. Provide Coupons to New Customers

Be careful and avoid over-discounting at your Magento store. You should offer discount coupons only to your first-time shoppers. It means you can give some special coupon discounts that are deeper than what you give to your existing shoppers.

15. Multiple Level Discount Based on Order Size

Another effective tactic to combat abandoned cart is to offer multiple level discount based on your shopper’s order size.

For example, if a customer spends a total of $100 at your store, you can offer 10% off on this size of order. If someone spends over $200, you can give 20% off, and if $300 has spent, you can give a larger discount of 30% off to such orders over $300.

16. Remind Shoppers About Their Loyalty Points or Reward Points

If you have abandoners who earned some loyalty point or reward point balances at your Magento store, you need to remind them about their existing balances. It will entice them to make use of such points to grab discount and complete the purchase in contradiction of leaving cart abandoned.

17. Offer Checkout Options to Guest Customers

Forcing first-time visitors to log in or signup is also the major reason behind cart abandonment. You can offer guest checkout options for such visitors and make checkout process a lot easier for them, which is accurately what they need. As a result, you will have more sales at your online Magento store.

18. 24/7 Online Store Monitoring to Prevent Errors

Make sure you have a QA team who continuously monitors all on-going functionalities or activities at your Magento store and ensures that there’s no error that can void a sale at store.

19. Implement Security Measures for Credit Card Transactions

Another effective practical key is to implement security measures at your Magento store for shoppers’ credit card transactions. It will make them feel more secure while completing transactions on your online store. You also need to ensure them that their personal details will be handled with utmost security and they will not become sufferers of any phishing activity.

20. Keep Customers Away from Any Kind of Distraction

Keep your customers focused and don’t distract them by displaying unnecessary flash movies, subscription boxes or banners. There is no place of such unnecessary things on your product or order pages, unless they are directly associated with the first-time purchase.

So… Have You Done All This to Combat Abandoned Cart on Your Magento Store?

If you’re still fighting an ongoing battle of abandoned cart issues and want to bring your abandoners back to your Magento store, Envision Ecommerce is here to help you. We know how to effectively implement these practical keys on your Magento store. We also have some unique Magento 1 & 2 extensions that help in avoiding abandoned cart issues. Contact our certified Magento experts and Solutions Specialist today at [email protected] or you can visit: to avail our services & extensions.

Welcome Magento to India

Being a company that’s got Magento deeply embedded in its DNA, we’re on cloud nine since we heard of first-ever MagentoLive India event 2017.

Yes, for the very first time, Magento is going to officially organize its first MagentoLive event in India on May 2, 2017, in Bengaluru. We’re glad and welcome you ‘Magento’ to India with full gratitude. We’ve been waiting for years for such an opportunity to meet & listen to “Who’s Who” of Magento world. It would really be a great chance for us to learn, share and network with the diverse like-minded Magento people.

Since our inception, we have been continuously doing “How to Blogs” on Magento2 and producing innovative Magento platform based products for the Magento community like MageIonic app, Magento 1 & 2 extensions, etc. That’s why we will be there along with our Magento certified solution specialists and certified developers who are eager to live & breathe MagentoLive 2017 to learn a lot more about Magento.

Let’s catch up and have some talks around Magento! Connect with our COO over linkedin who will be there. All the best Magento.

How to Reindexing Programmatically In Magento 2?

Use below code in any class for reindexing in magento2.

 * @var \Magento\Indexer\Model\IndexerFactory
protected $_indexerFactory;
 * @var \Magento\Indexer\Model\Indexer\CollectionFactory
protected $_indexerCollectionFactory;
public function __construct(
    \Magento\Indexer\Model\IndexerFactory $indexerFactory,
    \Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory
   $this->_indexerFactory = $indexerFactory;
   $this->_indexerCollectionFactory = $indexerCollectionFactory;
 // you can call this function to do reindexing
public function reIndexing(){
   $indexerCollection = $this->_indexerCollectionFactory->create();
   $ids = $indexerCollection->getAllIds();
   foreach ($ids as $id) {
   $idx = $this->_indexerFactory->create()->load($id);
   $idx->reindexAll($id); // this reindexes all
   //$idx->reindexRow($id); // or you can use reindexRow according to your need

If you still have any query regarding this “How to” or would like to add some suggestions to this solution, let us know your feedback or query at [email protected], and don’t forget to share this “How to” blog with your fellow Magento 2 users!

Easter Sale is Now Live at Our Revamped Envision Store. Get 30% OFF Storewide!

Envision Ecommerce store has been revamped. The store is upgraded to Magento 2 (the platform of the future) and with great new UI.

While the store’s functionality remains largely the same, we have just upgraded it to Magento 2 and redesigned with fresh layouts for a much cleaner look for our customers. Our store now showcases all that we do which was missing in our earlier store layout. We tried our best to improvise existing store structure to match with customers’ touch points. We are sure, you are going to love it.

Envision Revamped store

Another notable update we expect you love is – “Easter 30% OFF Storewide”. In the spirit of upcoming Easter, you can avail the benefit of this 30% discounts on any of our products (Magento extensions, Magento 2 extensions, WooCommerce Plugins, Hybrid Mobile apps, etc.) & other services.

Meet our new revamped store and let us know if you have more suggestions and feedback. We enjoy making your shopping experience more pleasant and smooth! We’re glad to welcome you at our revamped store:

How To Create Custom Layout Page In Magento2?

We already know that Magento provide following layout as default:-

– Empty
– 1 column
– 2 columns with left bar
– 2 columns with right bar
– 3 columns

Sometime we need some customization in our Magento design and want to change design of Home page or any specific page.

There are two files needed to create custom layout page

1 – Create Namespace/Module/view/frontend/layouts.xml this file registered custom layout. Use below code.

<?xml version="1.0" encoding="UTF-8"?>
<page_layouts xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
 <layout id="test">
 <label translate="true">test layout</label>

2- Create Namespace/Module/view/frontend/page_layout/test.xml this file to manage design your layout page. Use below Code.

<?xml version="1.0"?>
<layout xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<update handle="empty"/>
<referenceContainer name="page.wrapper">
<container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="page-header" before="main.content"/>
<container name="" as="page_top" label="After Page Header" after="header.container"/>
<container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer"/>

Now this is complete to use as custom layout. You can check this layout in admin panel configuration setting.

If you still have any query regarding this “How to” or would like to add some suggestions to this solution, let us know your feedback or query at [email protected], and don’t forget to share this “How to” blog with your fellow Magento 2 users!

How to Update Mini Cart in Magento2 ?

Update mini cart when you are submitting a form

Magento provides a way to update minicart if you are submitting a form. First of all create sections.xml file in ‘etc/frontend’ folder in your module.

Now write following code snippet in sections.xml file

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
<action name="modulename/controller/addProduct">
<section name="cart"/>

Action name: action name is controller where you are submitting form.

Example of this situation may be when you want to set custom price of product in your own controller. This approach will work when you are using POST or PUT form submitting. It will also work for AJAX request.

If you still have any query regarding this “How to” or would like to add some suggestions to this solution, let us know your feedback or query at [email protected], and don’t forget to share this “How to” blog with your fellow Magento 2 users!

How Facebook Ads Help Brands Convert Leads into Shoppers?

Today, almost all types of information like news stories about current issues, civic bodies’ updates, and information on the most popular brands have been channelized to the futuristic generation via social media platforms. Social media channels are the most emerging as well as strong contenders exist by traditional means of communication for brands. For Instance:

Twitter drives massive user engagement through hash tags and retweets, Instagram drives engagement, using well-captioned and interesting pictures. Similarly, Facebook’s superiority lies in its incomparable reach of 184 million customers who access the platform each month, and the fact that it offers – an ability for brands to curate stories, as well as experiment with content, videos and motion pictures.

The format of Facebook’s creative ads is like PockeTVC, carousels and others which help brands to express a story in one-of-a-kind and impactful way. Furthermore, Facebook’s ad formats contain video, image and carousel which instantly generates awareness of the closest business area, and thereby provide information to customers that they actually require to get there and help them to established brands drive in-store sales.

Understands Your Targeted Audience

Facebook benefits brand to reach the correct arrangement of targeted audience covering behavior segments and demographic interest. A local store locator is accessible for carousel and make the ads even more valuable for customers by placing contact detail and opening hours of adjacent stores just a single click away.

However, Facebook has the ability to effectively urge the client to visit the adjacent store of the specific brand, and even for advertisement formats such as Video Ads, Carousel and Photo that are intended at driving awareness. Third parties like Nielsen have measured as well as proven that the awareness impact translates to boost in sales as compared to the actual physical stores.

In addition to this, Facebook has extensively worked with brick and mortar brands over the last year and helped them build a strong bridge between the online and offline. By utilizing the features like carousal ads, slideshow, etc., these brands have been capable to reach out to their potential customers who are active users of Facebook on portable and desktop.

A list of campaigns that have worked outstandingly for traditional brands, such as:

Jewelry brand i.e. Tanishq who has approximately 160 stores in 80 urban areas crosswise over India, chose to exhibit its designs with dazzling close-up shots utilizing carousel ads to catch individuals’ attention. Significantly, it led them to its physical stores by adding a “Shop Now” call-to-action button that brought individuals to its website to earn a discount voucher and redeemed in-store. By using all these tools, Tanishq able to saw a 30 percent growth in in-store sales as well as in-store footfall among 25 to 44 year olds during its campaign.

Another women’s popular brand, namely Veet utilized Facebook to reinforce its TV promotions and fortify its campaign with the aim of urging ladies to purchase its hair removal cream. However, this brand partnered with innovative agency, i.e. iContract and Facebook’s Creative Shop to develop an integrated campaign and adapt its prevailing TV promotion into snappier video advertisements. To slope things up, it controlled the advertisements with reach and recurrence purchasing to achieve 18-to 55-year old ladies in India on an enormous scale. This hearty multi-screen methodology made a great impact on Veet’s intended audience and resulting nearly 11 percent incremental rise in-store sales in a market where Facebook advertisements were implemented versus a market where they were definitely not.

Therefore, in an era of ever-evolving e-commerce stores and ground-breaking marketing technologies, Facebook make an obvious choice for brands to rework their ad campaigns and earn more optimistic interest for their products. So if you are still not using the affordability and feasibility of tools that Facebook offers, then connect it today and generate more ROI.