Creating Datatables
Before we can start to add our product info to our Datatable we first need to create the table itself. This can be done quite simply but will need us to know the details of what information for each product we want to store.
We are going to be storing the following for each of our sports products:
- product_id
- sku
- name
- description
- price
- image
- url_path
- InStock
Create a new Datatable by going to: Navigation -> Data -> New Datatable
This gives us a completely empty Datatable shell. We will now need to add a Field Name for each of the pieces of information. To do this:
- Click on Add Field
- Fill out a Field Name (e.g. product_id)
- Select a Data Type
What is a Data Type?
The Data Type (as the name suggests) lets the system know what type of data we are going to be storing in each field. The options available are explained in Field types.
For a Datatable, the Number and Text types can be used as the Unique Field (see below).
So our completed Datatable might look something like this:
Setting a Unique Field
The Unique column in our table is how we will tell the system which row to look up when we later come to pull out the information we want to include in our email. So for example we will be able to say something like:
"Include the name for the product in our Datatable where the product_id equals 1"
We can only have one column in any Datatable set to Unique and the values in that column must obviously all be... well... unique!
We have added the product_id column to our table for this training example but in the real world it is also quite likely we could possibly rely on the sku fields.
So with our Datatable created the next step is going to be to fill it up with the data information on all the products from our store
Updated 10 months ago