|
| 1 | +# Comwrap Feed Generator |
| 2 | + |
| 3 | +Feed Generator is a service that simplifies the process of generating product feeds. It ensures that you can easily integrate your store with various systems. With just a few configuration steps you can generate a feed that can be consumed by third-party marketplaces like Google and Facebook — or that can be used for integrating with any other third-party system. Currently module supports XML feed format. Another formats will come in the future. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Pls see [INSTALL.md](INSTALL.md) for more details. |
| 8 | + |
| 9 | +## Home page / Grid |
| 10 | + |
| 11 | +On the application home page you will see list of the feeds: |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +For each feed you can: |
| 16 | + |
| 17 | +* Edit Feed |
| 18 | +* Delete Feed |
| 19 | + |
| 20 | +On a feed list you can find: |
| 21 | + |
| 22 | +* Feed name |
| 23 | +* UUID of the feed |
| 24 | +* Adobe Commerce Store to be used |
| 25 | +* File that being generated |
| 26 | +* Date of feed creation |
| 27 | +* Date of feed generation |
| 28 | +* Type of the feed |
| 29 | +* Status of the feed: |
| 30 | + |
| 31 | +* **Pending - nothing yet happened with the feed, it just was created OR edited** |
| 32 | +* **In Process - generation is currently in progress** |
| 33 | +* **Generated - Feed it ready to be used** |
| 34 | + |
| 35 | +## Edit Feed |
| 36 | + |
| 37 | +On a Grid page you can click on a Feed name, and you will be landed on Edit page of selected feed: |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +Here you can change the following elements: |
| 42 | + |
| 43 | +| Field Name | Description | |
| 44 | +|-----------------------|-----------------------------------------------------------------------------| |
| 45 | +| Feed Name | Name of the feed (will be used only on application UI) | |
| 46 | +| Feed Type | Type of the feed: | |
| 47 | +| | - XML | |
| 48 | +| | - CSV - Coming in future releases | |
| 49 | +| | - JSON - Coming in future releases | |
| 50 | +| Adobe Commerce Store | Store of your AC system. Products data from selected store will be used. | |
| 51 | +| Feed Header | Header of the feed. * | |
| 52 | +| Item Body | Body of the single feed element | |
| 53 | +| Feed Footer | Footer of the feed * | |
| 54 | + |
| 55 | +* Feed will be generated as following: Header + All Items + Footer |
| 56 | + |
| 57 | +### Feed Body |
| 58 | + |
| 59 | +For feed body variables can be used. Variables are representing GQL schem that being used (by default it is a Adobe Commerce schema). |
| 60 | + |
| 61 | +Example: |
| 62 | + |
| 63 | +```graphql |
| 64 | +products(search: "test", pageSize: 2) |
| 65 | +{ |
| 66 | + items |
| 67 | + { |
| 68 | + name |
| 69 | + description |
| 70 | + image { |
| 71 | + url |
| 72 | + } |
| 73 | + description { |
| 74 | + html |
| 75 | + } |
| 76 | + price_range { |
| 77 | + minimum_price { |
| 78 | + regular_price { |
| 79 | + value |
| 80 | + currency |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +Based on this GQL schema you can use the following variables (starting inside of the “items“ schema): |
| 89 | + |
| 90 | +* {{name}} |
| 91 | +* {{description}} |
| 92 | +* {{image.url}} |
| 93 | +* {{description.html}} |
| 94 | +* {{price_range.minimum_price.regular_price.value}} |
| 95 | +* {{price_range.minimum_price.regular_price.currency}} |
| 96 | + |
| 97 | +… and so on depends on a schema used |
| 98 | + |
| 99 | +### Placeholders |
| 100 | + |
| 101 | +#### Fixed Variables |
| 102 | + |
| 103 | +Header and Footer currently have a support to variables (Only 1 actualy) |
| 104 | + |
| 105 | +`{{DATA}}` - Current Date/Time - will be in format 2024-10-21T14:45:30.123Z |
| 106 | + |
| 107 | +### Dynamic variables |
| 108 | + |
| 109 | +Variables are defined using double curly braces (`{{ }}`) and correspond to fields in the Magento GraphQL product output. For example, `{{sku}}` will be replaced with the product's SKU. |
| 110 | + |
| 111 | +##### Additonal parameters |
| 112 | + |
| 113 | +###### Repeating Tags with `count` |
| 114 | + |
| 115 | +When a variable corresponds to an array, you can use the `count` property to repeat the XML tag for each element in the array. For instance, using `count=5` will generate up to 5 tags, each containing a different value from the array. |
| 116 | + |
| 117 | +```xml |
| 118 | +<g:brand count=5>{{manufacturer}}</g:brand> |
| 119 | +``` |
| 120 | + |
| 121 | +##### Selecting Specific Array Elements with `index` |
| 122 | + |
| 123 | +To select a specific element from an array, use the `index` property. This will generate a single tag with the value of the specified element from the array. |
| 124 | + |
| 125 | +```xml |
| 126 | +<g:product_type index=2>{{categories.name}}</g:product_type> |
| 127 | +``` |
| 128 | + |
| 129 | +#### Example |
| 130 | + |
| 131 | +```xml |
| 132 | +<item> |
| 133 | + <g:id>{{sku}}</g:id> |
| 134 | + <title>{{name}}</title> |
| 135 | + <description>{{description.html}}</description> |
| 136 | + <link>https://www.native-instruments.com/{{detail_page}}</link> |
| 137 | + <g:image_link>{{image.url}}</g:image_link> |
| 138 | + <g:condition>new</g:condition> |
| 139 | + <g:price>{{price_range.maximum_price.final_price.value}} {{price_range.maximum_price.final_price.currency}}</g:price> |
| 140 | + <g:availability>In Stock</g:availability> |
| 141 | + <g:google_product_category><![CDATA[Arts & Entertainment > Hobbies & Creative Arts > Musical Instruments > Electronic Musical Instruments]]></g:google_product_category> |
| 142 | + <g:identifier_exists>true</g:identifier_exists> |
| 143 | + <g:product_type index=2>{{categories.name}}</g:product_type> |
| 144 | + <g:sale_price>{{price_range.minimum_price.final_price.value}}</g:sale_price> |
| 145 | + <g:brand count=5>{{manufacturer}}</g:brand> |
| 146 | + <g:mpn>{{sku}}</g:mpn> |
| 147 | + <g:additional_image_link><![CDATA[{{image.url}}?width=350&height=350&fit=crop]]></g:additional_image_link> |
| 148 | +</item> |
| 149 | +``` |
| 150 | + |
| 151 | +## Technical Module implementation |
| 152 | + |
| 153 | +Delete Feed - deleting current feed from the database and from all schedules |
| 154 | + |
| 155 | +Regenerate Feed - will fire event “generate.feed“ for particular feed ID. And this event will triggen and action that will create new feed. |
| 156 | + |
| 157 | +### app.config.yaml |
| 158 | + |
| 159 | +- List of all actions currently developed: `app.config.yaml` |
| 160 | + |
| 161 | +* `saveFeed` - save the feed action. Action being invoked after user submit feed form. |
| 162 | + |
| 163 | + Saving feed into key/value storage. Key for the feeds have to looks like following: `feed-UUID`. |
| 164 | + |
| 165 | +* `deleteFeed` - delete the feed action. Action being invoked after user click on Delete button |
| 166 | + |
| 167 | + Deleting the feed from storage by UUID |
| 168 | + |
| 169 | +* `getAllFeeds` - retrieve all feeds from the key/value storage and deliver JSON back. Invoked on dashboard while loading. |
| 170 | + |
| 171 | + Retrieve all available feeds from the storage. Will be used by Dashboard to render feeds list. |
| 172 | + |
| 173 | +* `getFeedByUuid` - retrieve single feed by UUID |
| 174 | + |
| 175 | +* `regenerateFeed` - trigger feed generation. Will place a new event, that feed generation have to be started. |
| 176 | + |
| 177 | + Creating new Event on adobe I/O. Event name: `feed.generate`. |
| 178 | + This event means "Please start Force Regeneration to required feed UUID" |
| 179 | + |
| 180 | +* `processGeneration` - process generation action. Regenerate required feed. Currently ID is hardcoded |
| 181 | + |
| 182 | + Action will be invoked when `feed.generate` event added. |
| 183 | + |
| 184 | +* `getGqlSchema` - retrieve graphql schema from target magento app. |
| 185 | + |
| 186 | +* `getAllStores` - get all Magento stores by API |
| 187 | + |
| 188 | +* `generateByCron` - trigger feed generation by OpenWisk alarms. |
| 189 | + |
| 190 | +Action is running every 30 minutes and checking by feed settings if it have to be regenerate. Process regeneration if necessary. |
| 191 | + |
| 192 | +### Web elements |
| 193 | + |
| 194 | +* `index.html` - Dashboard of the project. |
| 195 | + |
| 196 | + List of Feeds already saved (currently list of feeds received from Action by ajax request). Incl. paginator. |
| 197 | + |
| 198 | + * Button to Create New Feed |
| 199 | + * Every already saved feed have to have a following action: |
| 200 | + * Edit Feed |
| 201 | + * Delete Feed |
| 202 | + * Force Feed Regeneration |
| 203 | + |
| 204 | + Edit / Create New Feed form will contain form to save new Feed. |
| 205 | + |
| 206 | + Current elements: |
| 207 | + * Feed Format - select - JSON | XML |
| 208 | + * Feed Item: Big text field to have XML | JSON there with feed item body |
| 209 | + * Feed Header |
| 210 | + * Feed Footer |
| 211 | + * Store View - select with list of available store views on Magento (websites also have to be there, but it is not possible to select them) |
| 212 | + |
| 213 | + After saving the form, it saved into key/value storage and user have to be redirected to dashboard. Success message have to be shown there. |
| 214 | + |
| 215 | + In case of error, error have to be displayed |
| 216 | + |
| 217 | + |
| 218 | +### Frontend Libraries |
| 219 | + |
| 220 | +## Auto complete |
| 221 | + |
| 222 | +For Text area autocompletion this library was used: |
| 223 | +https://github.com/zurb/tribute |
| 224 | + |
0 commit comments