Magento integration

1. Installing the integration

Getting Magento API token

Note! This integration supports 2.3 and later versions of Magento. 

 

For the integration, you will need from Magento API Access Token and your Store URL.

Use the following steps to generate an Access Token:

  1. Log in to Admin and click System Extensions Integrations to display the Integrations page.
  2. Click Add New Integration to display the New Integration page.
  3. Enter a unique name for the integration in the Name field. Then enter your admin password in the Your Password field. Leave all other fields blank.
  4. Click the API tab. Quick way is to select all fields in the following resources: Sales, Catalog and Stores. More specific list of needed fields is below in section Minimum Magento API permissions.
  5. Click Save to save your changes and return to the Integrations page.
  6. Click the Activate link in the grid that corresponds to the newly-created integration.
  7. Click Allow. A dialog similar to the following displays:

Copy the Access Token for later. Also save your store's URL.

   

Minimum Magento API permissions

In order for the integration to work properly the following API permissions are needed. Below is detailed how these permissions are used. If these permissions are not granted, the described feature will not work.

Under Sales in section Actions there are three recourses to be selected: View is needed to read orders, Ship to create shipments and Comment to add comments when the order is transferred to myOGO and also change order's status if specified in integration settings.

Under Catalog > Inventory, permission for Products is needed to be able to read product data.

Under Stores > Inventory permission for Sources is needed to be able to read different source locations and update product stock levels for the source.

     

     

Integrating to MyOGO

Go to myOGO Edit merchant page and select Integrations. Click on New integration and select Magento from the list.

Fill in the Store Url and Access Token then save.

After you have saved, Location section will open. If you have multiple stock locations in Magento, you can select which one is connected to myOGO. Integration connects the products' stock to that location.

If you want to connect multiple locations, you can do these steps again to set up another integration.

Remember to save your changes and to enable scheduled latest changes update after the goods are in stockYou can test your integration by pressing Test button.

By default Magento wont have status for partially shipped orders and orders transferred to myOGO. If you want to add these you can find instructions under How to create order status section on this page. These statuses are optional.

If you want to add product attribute for EAN code, instructions are under How to add EAN code attribute for products.

 

2. Synchronizing products

Once the integration is set up, go to the ProductsSync webshop products. If the products are not yet visible, click Refresh.

When the products are visible on the Magento side of the page, click on all, or the desired products, and select Create product. Read more about the product sync page.

When the physical products arrive at the warehouse, the stock amounts will be visible in both myOGO and Magento.

 

How to add EAN code attribute for products

Magento does not provide EAN code as a default attribute. If you want to add this to Magento and myOGO to be viewed and edited, follow the instructions below.

 

To add new attributes in Magento navigate to STORES and under Attributes click Products. In the Product Attributes page select Add New Attribute.

In the Attribute Properties section fill in "EAN code" to the Default Label field.

In the Advances Attribute Properties section give the attribute the code f.e. "eancode". All the other options should stay as they are by default.

In myOGO navigate to Edit merchantIntegrationsMagentoFill in the status code you just created in the field Name of EAN / barcode attribute.

 

3. Setting up shipping methods

Shipping methods that you offer at your online store need to be linked to specific shipping methods provided at myOGO in order to gain full automation.

To access names of different shipping methods go to Store  Configuration. From the drop-down options open Sales and select Shipping methods.

Field Method name is the code that myOGO receives from the order from given shipping method. Save the method names you want to map to myOGO.

Go to Edit merchant → Shipping methods.

Add new shipping method from the list and copy the shipping method name from your online store.

 

The "*" special character can be used as a wild card in the text or code. E.g.

  1. "DHL*" matches to "DHL-1" and "DHL-test"
  2. "D*L" matches to "DtestL" and "DYL"

Remember to link every shipping method individually to certain shipping methods on myOGO.

We offer a large variety of shipping methods.

  • DHL offers worldwide fast delivery
  • Omniva is a cheaper and slower option to ship internationally
  • GLS ships to Europe

 

After all shipping methods in your online store are linked to OGOship shipping methods, your setup is done. For more information read Shipping Methods.

 

How to create order status

By default Magento won't have status for partially shipped orders and orders transferred to myOGO. These statuses can be created and linked to myOGO by following these steps. First do steps 1-4 for both statuses. Once they are created and licked, the statuses will sync automatically to Magento.

1. In Magento from the left admin menu select STORES and under Stores menu, select Order Status

2. From the top right corner click Create New Status

3. Fill in code in Status Code field you want to use (f.e. "TransferredToMyogo" and "PartiallyShipped"). Don’t use spaces or special characters in the name.

Then fill in the Status Label, that is shown as a statuses name in the Magento. Labels can hold white spaces and special characters

4. From the top right corner click Save Status

5. In myOGO navigate to Edit merchantIntegrationsMagentoFill in the status codes you just created to their appropriate fields

 

 

How API fields in use

This section of instructions is ment for developers using Magento. Here are listed the API endpoints and fields used from them by myOGO is using in our integration and some additional notes on the functionality.

 

 

Order

We don't read orders with status canceled or fraud. You can specify your own status code for when we take in the order, else we use default processing. You can specify your own status code for when the order is partially shipped, else we use default processing. By default, we will read orders which are in status processing, partially shipped or transferred to myOGO. In detailed order search, you can uncheck the open order only box to also show complete orders.

GET /rest/default/V1/orders

{
    "items": [
        {
           "base_currency_code"
           "base_total_due"
           "created_at"
            "entity_id"
           "increment_id"
           "shipping_amount"
           "shipping_description"
           "shipping_incl_tax"
           "status"
           "updated_at"
           "items": [
               {
                   "base_price"
                   "base_price_incl_tax"
                    "base_tax_amount"
                    "item_id"
                   "product_type"
                    "qty_ordered"
                   "qty_shipped"
                    "sku"
                }
            ],
            "extension_attributes": {
                "shipping_assignments": [
                   {
                        "shipping": {
                          "address": {
                               "city"
                               "company"
                                "country_id"
                               "email"
                               "firstname"
                               "lastname"
                                "postcode"
                                "street": [
                                   "streetline1",
                                   "streetline2"
                                ],
                              "telephone"
                           },
                           "total": {
                               "shipping_amount"
                               "shipping_incl_tax"
                            }
                      },
                  }
              ],
          }
       }

    ],
    "total_count"
}

Product

We don't read virtual products and product must have source assigned, which is also selected in integration settings for warehouse. We only read products where source_code is assigned to us in integration settings.

GET /rest/default/V1/products

{
    "items": [
        {
            "sku"
            "name"
            "price"
            "type_id"
            "custom_attributes": [
                {
                    "attribute_code": "Specified in integration settings",
                    "value"
                },
            ]
        }
    ],
    "total_count"
}

Source Item

GET /rest/default/V1/inventory/source-items

{
    "items": [
        {
            "sku"
            "source_code"
            "quantity"
            "status"
        }
    ],
    "total_count"
}

Sources

GET /rest/default/V1/inventory/sources

{
    "items": [
        {
            "source_code"
            "name"
        },
    ],
}

Update stock to Magento

POST /rest/default/V1/inventory/source-items

{
    "quantity"
    “sku"
    "source_code"
    "status"
}

Create shipment to Magento

POST /rest/default/V1/order/{orderId}/ship

{
    "items": [
        {
            "order_item_id"
            "qty": 1
        }
    ],
    "tracks": [
        {
            "carrier_code"
            "title"
            "track_number"
        }
    ],
    "arguments" :
        {
            "extension_attributes": {
            "source_code"
        }
    }
}

Add comment / change status

Weather or not you have configured statuses Partially shipped and Transferred to OGO (as described above) the relevant comment is added by myOGO to the history.

POST /rest/default/V1/orders/{id}/comments

{
    "statusHistory": {
        "Comment": "Order partially shipped" or "Order transferred to Ogoship."
        "is_customer_notified": 0,
        "is_visible_on_front" : 0,
        "Status": Specified in integration settings, default processing
    }
}