July 18, 2018 / Nirav Shah
Magento has emerged as a very important tool for many categories of business owners. It is quite powerful and helpful in helping a business owner set his/her personal e-commerce store. It has also grown a community and an ecosystem of its own.
Magento is available as:
This blog post contains all the information that you need to set up Magento Commerce (Enterprise Edition) in your local system and import product listing from a given CSV file.
Basically we need to follow below steps to import products from erp to magento in enterprise edition.
We need to follow below steps to setup enterprise edition in our local system.
(a) Install all required packages and tools first.
https://devdocs.magento.com/guides/v2.2/cloud/before/before-workspace-magento-prereqs.html
(b) Add SSH key
Using below command, you can create new ssh key.
ssh-keygen -t rsa
You can also define file where you want to save key.
(c) Install Magento CLI
curl -sS https://accounts.magento.cloud/cli/installer | php
(d) Add ssh key to CLI
magento-cloud ssh-key:add ~/.ssh/id_rsa.pub
(e) Clone and branch the project
To clone the project’s master environment to your local:
Login to Magento Cloud CLI:
magento-cloud login
List your projects:
magento-cloud project:list
Clone the project:
magento-cloud project:get
We have used Laravel for Import process. Below is the laravel script to download csv from ftp server and move that csv to archive then.
There are 3 types of authentication we can use:
We have used here Token based authentication.
The token allows Magento to verify that the caller is authorized to access a system resource. To get a token, you must specify the user’s username and password in the request. You need to use following script to create token in PHP.
Note :- make sure username is admin user with proper resources should be assigned.
This token must be specified in the authorization header of every api call that requires admin permissions, like api call to get the list of products, add new product, update existing product or delete product.
For getting the list of products from magento we can use following API.
You will have to pass token in header here.
If you want to get all the products then use “searchCriteria=0” in request url else if you want to filter product by sku or category, then you will have to pass proper searchCriteria. For that you can refer: https://devdocs.magento.com/guides/v2.3/rest/performing-searches.html
For adding product you can use this api url:
{your_magento_host}/rest/{storeViewId}/V1/products
If we want to add product in any specific store view, we need to pass in url.
{storeViewId} can be all or default or any store view code.
To update any product, you need to use the same api url.
In data array we will pass all required data which we want to update.
Also Read – Magento2 on AWS – Everything You Should Know About
As a Director of Eternal Web Private Ltd an AWS consulting partner company, Nirav is responsible for its operations. AWS, cloud-computing and digital transformation are some of his favorite topics to talk about. His key focus is to help enterprises adopt technology, to solve their business problem with the right cloud solutions.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.