Managing Multiple Stores from Single Application – Part 1
If you run multiple stores on different platforms, you know how time-consuming it can be to manage them. Adding products, comparing analytics, or controlling inventory are just three of the many repetitive tasks you have to do daily for every store you own. And while some e-commerce platforms offer their customers an option to manage all stores from a centralized location, it’s limited to that specific platform only.
In this article, I’ll show you how you can connect all your stores via a single application and significantly decrease workload while making your business time-efficient and cost-effective.
The Good and the Bad
Before we move to the technicalities, let’s take a closer look at the solution.
- Saved time—by adding the same product to all your stores in one location you cut the time it would take you to manually add it in multiple stores.
- Better analytics—you can compare product sales and review how different stores (their design, platform, checkout process, payment processing, etc.) influence your revenue.
- Improved inventory overview—allows you to manage product quantities conveniently.
- Centralized order processing—orders from all stores can be synchronized, downloaded, and managed in the application.
- Limited e-commerce platform functionality—some features in one platform may not be available in another.
- Complexity—application implementation can be challenging and requires careful analysis of each e-commerce platform in order to create an application that “works with all.”
- API-dependent—all store interactions from the single application will rely on APIs of connected e-commerce platforms. Any API issues will affect the application.
- Lots of data—the more managed stores, the more data will flow into the application.
The best use case for the store-managing application is selling the same merchandise in different stores. The app will help you stay in control and maintain steady growth.
You can also reap the above benefits and eliminate the cons by migrating all your stores to one technology, but this will be a costly endeavor. So before venturing down that path, you might want to give the app a go first.
In this part of the article, we’ll focus on the Laravel 5 framework that will help us develop the application efficiently in terms of time and cost.
Why Laravel 5?
To answer the question, we have to take a step back and briefly summarize how the application should work.
We’ll need to keep our product and store information in a single database. Each defined store will have a unique name, base URL, and type (WooCommerce, Magento, etc.—we’ll not store any sensitive information, such as usernames, passwords, consumer keys, for security reasons; those will be kept in a configuration file). For each type of store, we’ll implement a class that will handle all API interactions.
Whenever a product is created, updated, or deleted in the system, it will automatically execute a corresponding action to publish, update, or delete the product in all managed stores. We need to be able to:
- Create database tables
- Manage model relationships (e.g., how products relate to stores)
- Set up cron jobs that periodically synchronize products that failed to be published (due to any failure: server or API)
- Utilize database module events that execute API calls upon creating, updating, and deleting a product
- Use the MVC pattern for separating our business and presentation layers and to handle our actions better
Laravel 5 is a perfect fit for our needs. It’s very popular (large developer groups) and well documented.
php artisan make:migration create_products_table
This command will create a base code to create our products table that we’ll have to define ourselves. Besides creating tables, we can change table structure by adding or removing columns, foreign keys, etc. Migrations are very helpful, especially when working with large developer teams. When we issue the
php artisan migrate command, all migrations are executed and all development environments have the same database structure.
Our business logic will be kept in Laravel’s Eloquent models where we can define relationships (e.g., how products relate to stores, and vice versa). Models allow us to easily perform create, update, and delete operations in the database. We will also utilize Eloquent’s observers to call special functions that execute API calls whenever a product is created, updated, or deleted.
Lastly, we’ll use Laravel’s task scheduling to periodically execute certain cron jobs that will publish, update, and delete products in external stores. Sometimes API calls can fail during the product creation process (e.g., a store’s hosting server can have downtime)—that’s why we will use these task schedulers to make sure a product in our application is synchronized with all external stores.
Laravel also comes with functionalities for all kinds of web development projects. We can build our applications quickly and efficiently, without worrying in case we need support.
The store-managing app can help you keep tabs on all of your assets without wasting time on repetitive tasks. With improved analytics, centralized stock management, and synchronized order processing, you can focus on expansion. Click To Tweet
In the next part of the article, we’ll dive deeper and see how the solution should look like code-wise.
Polcode is an international full-cycle software house with over 1,300 completed projects. Propelled by passion and ambition, we’ve coded for over 800 businesses across the globe. We’re always on the lookout for solutions that improve the business operations of our clients. Contact us to give your existing e-commerce asset a boost.