This article contains the integration of Magento stores with Green Story
Client specific inputs
- Client ID: XXXXXXXXXXXXXXXXXXXXXXXXXXX
- SHA-256 Shared Key: XXXXXXXXXXXXXXXXXXXXXXXXXX
- Product Notification Url: https://store-sync- service.greenstory.ca/api/webhooks/products/magento
- Order Notification Url: https://store-sync- service.greenstory.ca/api/webhooks/orders/magento
Generic Inputs
- greenstoryJS value:
<script type="text/javascript" src="https://gsstatic.greenstory.ca/widgets/app/greenstoryinitMagento.min.js"></script>
Email html
(only if carbon offsetting functionality is enabled)
Summary
- This plugin provides a solution that enables Magento ecommerce Clients to export the products and orders to the greenstory platform and add impact and carbon offset widgets to various pages
- The plugin provides the following main features:
- Exports the bulk products or recently created products to the green story platform.
- Export recently placed order to the green story platform
- Add aggregate and product-specific impact and carbon offset stats via widgets to various pages such homepage, product pages, cart page and customer account page
- Version: 2.0
- Last Updated Date: 15-Jun-2022
Component Overview
Limitations
- The plugin operates within the Magento instance limitations, as allowed by the system.
- This plugin only allows products and orders to be exported.
- Full Product synchronization export option is available, but if it's timing out, we need to execute the script provided below in server
php bin/magento greenstory:sync_all_products
Compatibility
- The magento plugin plugin is compatible with Magento 2.0 and above
Plugin Installation
To integrate Magento plugin in to the website, you will need to follow these steps:
- Upload the zipped module file to <Magento root dir>/app/code directory
- Unzip the module file
- To complete the installation, follow the below steps. These are standard steps for installing any module in Magento (https://devdocs.magento.com/extensions/install/)
- Enable the module and clear static view files
- You should see the following output
- Register the module
- Recompile your Magento project
- Verify that the module is enabled
- you should see output verifying that the extension is no longer disabled
- Run the following command
Clean the cache
Give Write Permissions required
- Enable the module and clear static view files
Site preferences configuration
The plugin will make use of a set of Magento admin configuration to function properly. These configurations are available at a global level or at an individual store level. Global configurations are carried over as default configurations at the store level
1. Admin -> Stores -> Configurations -> Green Story -> Impact Visuals
Section | General |
Attribute Display Name | Green Story Client ID |
Type | String |
Description | Use to place Client ID that is given by greenstory |
Mandatory | Yes |
Section | General |
Attribute Display Name | Green Story Library File |
Type | String |
Description | Use to include Greenstory’s js file |
Mandatory | <script type="text/javascript" src="https://gsstatic.greenstory.ca/widgets/app/greenstoryini tMagento.min.js"></script> |
Section | General |
Attribute Display Name | Site ID |
Type | String |
Description | Provide custom Site ID or plugin will take Magento Store ID |
Default | Magento Store ID |
Section | General |
Attribute Display Name | Site Domain |
Type | String |
Description | Provide Site Domain or plugin will take Magento Site’s base URL |
Default | Magento Site’s base URL |
Section | General |
Attribute Display Name | Encryption Key |
Type | String |
Description | Use to place Greenstory SHA-256 Shared Key which is required to encrypt the product and order payloads |
Mandatory | Yes |
Section | Notification |
Attribute Display Name | Product Notification Url |
Type | String |
Description | API URL to synch products |
Mandatory | https://store-sync-service- dev.greenstory.ca/api/webhooks/products/magento |
Section | Notification |
Attribute Display Name | Product Notification Interval |
Type | String |
Description | Set Intervals in days to push the latest product updates to green story backend |
Mandatory | Yes |
Default | 1 |
Section | Notification |
Attribute Display Name | Order Notification Url |
Type | String |
Description | API URL to synch orders |
Mandatory | https://store-sync-service- dev.greenstory.ca/api/webhooks/orders/magento |
Section | Notification |
Attribute Display Name | Enable Product Notification |
Type | Boolean |
Description | Enable or Disable production synch on updates |
Default | No |
Section | Notification |
Attribute Display Name | Enable Product Cron Notification |
Type | Boolean |
Description | Enable or Disable production daily product sync |
Default | No |
Section | Notification |
Attribute Display Name | Enable Order Notification |
Type | Boolean |
Description | Enable or Disable order sync |
Default | No |
Section | Notification |
Attribute Display Name | Sync All Product Button |
Type | Button |
Description | It can be used to sync all products to Greenstory back end. |
Section | Widget |
Attribute Display Name | Enable/Disable Widget Globally |
Type | Boolean |
Description | Enable/Disable all Green Story widgets with a single button |
Default Value | No |
Section | Widget |
Attribute Display Name | Widget Language |
Type | List |
Description | Force a specific Greenstory supported language from the list. If Default, it will get Magento store language. |
Default Value | Default |
Section | Widget |
Attribute Display Name | Widget Locale |
Type | List |
Description | Force a specific Greenstory supported locale from the list.The locale drives the international number format. If Default will get Magento store locale. |
Default Value | Default |
Post Plugin Installation Steps
- Update the ‘Green Story Client ID’ configuration with the client ID provided for your organization
- Update the ‘Encryption Key’ configuration with the SHA-256 key provided for your organization
- Ensure ‘Green Story Library File’, ‘Product Notification Url’ and ‘Order Notification url’ have values as provided in the Client specific input section
- Complete a full product sync per store by clicking on the Sync All Product Button
- Turn ON the ‘Enable Product Notification’ configuration
- Turn ON ‘Enable/Disable Widget Globally’ configuration
- Turn ON each widget configuration as per which widget needs to be enabled or disabled
- Change language or locale configurations for each store if a different language or locale then the default of the store is required
- Turn ON ‘Enable Order Notification’ once the setup is complete and we are ready to go-live
Adding Widgets
- Create a new Widget
- Go to Content > Widgets
- Add a new Widget with following settings
- Type: (Choose any one of the following widget from Green Story)
- Green Story Brand Offset Widget
- Green Story Cart Offset Visual Widget
- Green Story Counter Widget
- Green Story Cart Impact Visual Widget
- Green Story Customer Impact Visual Widget
- Green Story Product Offset Widget
- Green Story Product Widget
- Design/package Theme: Choose the theme you are using
- Widget Title: Provide an appropriate name based on the type of widget selected.
- Assign to store views: Choose the store view you want to assign the widget to
- Layout updates section
- Display on: Specified Page
- Page: CMS Home Page (or the page which is your home page)
- Container: Choose where on the page you want to show the widget
- Save
View Plugin Logs
To debug product sync or order sync we can get the logs from the below path
- var/log/api.log
- var/log/greegreenstory_export.log
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article