Today I want to talk about the Token List. The Token List is a tool inside the Miva Merchant Admin that allows you to see what entities and variables are available on any specific page template inside your Miva Merchant store. The Token List is not assigned by default, so you will have to assign it to your store in order to use it. To assign it click on “Utilities” and checkmark “Token List” if it's not checkmarked already and then click “Update.” Once the Token List is assigned to your store, you will be able to utilize it by clicking into the Pages area of your store Admin and editing one of these store pages.
I'm going to pull up the Storefront. On the upper right corner you will notice that there is a new button here that was not there before and it's called Var List. If you click into it, it will show you a list of all the variables that are available to the Storefront Page. If I open up another tab here and pull up another page, like the About Us page. You'll notice that it has its own list of variables and it slightly differs from the Storefront page, because each page template has different variables available to them. So these entities are used in the page template to pull in specific information for instance if I view the Storefront page, I can click “View All Tokens” and the store will pull up the Storefront page and I can mouse over and see the different components of this page and get an insight of which variables are pulling in this content. This image is being pulled in by the product thumbnail. This name is being pulled in by product name and so on and so forth. Let's go back into the store Admin. This list of variables can actually be filtered some and searched through. Up here there are three checkboxes and you can check or uncheck the different variable types, depending on what you want to see. If I want to hide the local variables from view, I just uncheck here and I can remove the system view and I am currently just looking at the global variables that are again available to the Storefront,
If you have in mind which variable you're looking for, you could also do a search for it. So I can type in “screen.” This is the g.screen variable. It's one of the most commonly used variables. You can use the variable to check for what page template is being loaded onto the page, or you can use its entity to print what this screen value is. If I grab this entity and let’s go into the global header and footer and I will type
style=”color:#fff”> to make it white. This is the variable space and then screen. So if I hit “Save” and go to run time and refresh the screen, you’ll see “This is the SFNT screen.” Now this SFNT is being pulled onto the screen with that screen variable that I was using. I can jump around to another page. This is a category screen and if I scroll down “This is the CTGY screen,” which is correct because this category page is utilizing the category page template inside the pages area of my Store Admin. Another useful variable for web developers is the cust ID variable. If I go back into the Token List and do a search for cust_ID, here's another Global variable. Noticed that it has a value of 0 at the moment. Some of these variables are influenced by what's happening in my run time. This value of 0 tells me that I am not currently logged in as a customer, but if I go into the run time and sign-in, I created a user called “Dev” and you could do the same in your store. Go ahead and click “Login” and if I go back to my Token List, I have to click on to another tab to refresh the list, but I can do a search for the cust_ID and now I have a value of 7. So my customer, which is Dev has a customer ID value of 7 in the database. As a developer I can actually use this knowledge to build an if statement to check if I'm logged in. That’s a slick way to be able to work on a live store environment without affecting the customers who might be shopping at the store. To give an example, mvt:if expr = “g.basket:cust_id” EQ 7 > then load new work in progress.
One last thing I want to go over regarding the Token List is, sometimes as a web developer you need to see the page templates rendered as a customer would see them in the runtime and the Token List really makes that an option for the web developer. For instance, if you go into pages here, let’s pull up the invoice page, because traditionally you would have to actually place an order for you to view the invoice page correctly. With the Token List, you can click into the Invoice Template Click Bar List and it will load a historic order here and all of these variables are populated with a data from the historic order. You can click “View All Tokens” and here's how the customer would have seen the invoice page when they placed order number 1150. You can see my nav bar here is broken, but it's only broken on the invoice page. I might not have caught this issue had I not used the Token List to pull up the invoice page template.You can also pull up the Customer Edit page and have the variables load with the customer you're logged in as and you can also pull up the category and product display pages. You can define which products and categories to use if you know the product and category codes and if you want to see how this would look like in runtime just click “View all Tokens.”