Sections in the Article
This article explains how to use the templateContext variable to get relevant information about Content Store users. By providing user context, a developer of the PDF HTML template can call an Ajax endpoint to decide which information to show to a specific user of a Content Store.
An example of more advanced usage is getting specific pricing for a specific retailer based on their email address in the generated PDF.
To Add User Context for a Catalog Template in Control Center
- Go to Control Center > Html Templates and click the Type drop-down to select one of the templates designed to be used in Content Store (Content Store Template, Content Store Cover Page or Content Store End Page).
- You can now use the templateContext variable shown below in your catalog templates.
- For more information about how to input parameters, read this article.
To Add User Information in a PDF Catalog
- Log in to Content Store (front end) and add a number of entities to your cart.
- Click the Catalog button and select the template where you added the templateContext variable in Control Center. (See instruction in To Add User Context for a Catalog Template in Control Center above.)
- In the screenshot below, the variable is available in the Last Page template (right column).
Example of the templateContext Variable Used in a Catalog
Below is a screenshot of the templateContext variable from the Control Center back-end settings:
The templateContext variable used in the generated PDF file is shown below: