How to use the AnQiCMS custom field feature to add additional display parameters to the product detail page?
In a content management system, the product detail page often needs to display more rich and specific product parameters than basic information to meet the personalized needs of different industries and products.AnQiCMS provides powerful custom field functionality, allowing us to easily add these additional display parameters to product detail pages without modifying the core code.
Next, we will detail the three steps on how to use the custom fields of AnQiCMS to inject more vitality into your product detail page.
Step 1: Define custom fields in the product content model
The flexibility of AnQiCMS is reflected in its customizable content model.To add additional parameters to the product details page, we first need to define these parameters in the "product model".
- Enter content model management:Log in to the AnQiCMS backend, navigate to the 'Content Management' section on the left-hand menu bar, and then click 'Content Model'.
- Edit the product model:In the content model list, find and click the edit button next to "Product Model". If you have other specific product models, you can also select the corresponding model to edit.
- Add custom field:After entering the product model editing page, scroll down to see the area named "Content Model Custom Field".Here, you can click on 'Add Field' to create new product parameters.
- Parameter name:This is the field name seen in the background management, it is recommended to use easily understandable Chinese descriptions, such as "color
- Call field:This is the unique identifier used when referencing the parameter in the template, it must be alphabetic, lowercase is recommended, and should not contain spaces or other special characters, for example, corresponding to "color" it can be set to
colorCorresponding to "Warranty period" can be set towarranty. - Field type:Choose the appropriate field based on the data type you need to enter.AnQiCMS provides various field types, such as single-line text (suitable for short text like model, color), numbers (suitable for price, inventory), multi-line text (suitable for long descriptions), single selection, multiple selection, or dropdown selection (suitable for preset options such as size S/M/L, material categories, etc.)
- Mandatory?:Check according to business requirements. If this parameter is essential information that must be provided when the product is released, please set it as mandatory.
- Default:If it is a selection field (single selection, multiple selection, dropdown), enter each option value on a separate line here; if it is a general text field, you can preset a default content.
Repeat the above steps, you can add any number of custom parameters according to the characteristics of the product. After defining, remember to click save.
The second step: fill in the custom field content for the product
After you have defined the custom fields in the product model, these fields will automatically appear on the product release or edit page.
- Go to the product publication or editing page:Navigate to 'Content Management' under 'Publish Document', select a product category, or edit an existing product in 'Document Management'.
- Find the "other parameters":Below the product editing page, you will find a collapsible area named "Other Parameters." Expand this area, and you will see all the custom fields defined in the first step.
- Enter field content:Enter the product parameters corresponding to the type of each field.For example, enter 'red' for the 'Color' field, select 'L' for the 'Size' field, fill in 'one year' for the warranty period, etc.This data will be stored with the product and prepared for display on the front-end page.
Step 3: Display custom parameters on the product detail page template
The final step is to display these rich custom parameters on your website product detail page. This usually involves modifying the template files under your current theme, usuallytemplate/您的主题文件夹/product/detail.htmlor a similar path.
AnQiCMS provides two main tags to retrieve and display custom fields:
Display specific custom fields one by one:If you need to place a specific custom field at a fixed position on the detail page, such as displaying the model below the product name, you can use it directly
archiveDetailLabel, and specify the 'calling field' name you set in the first step.<p>产品型号:{% archiveDetail with name="model" %}</p> <p>保修期:{% archiveDetail with name="warranty" %}</p> {# 如果自定义字段的内容是HTML,请务必加上 |safe 过滤器防止被转义 #} <div class="product-features"> {% archiveDetail introduction with name="introduction" %} {{ introduction|safe }} </div>Here
model/warranty/introductionThat is the 'calling field' name you set for the custom field in the first step.Loop through and display all custom fields:If you wish to display all custom fields in a list format, for example, in a "product parameters" or "specifications" module, then use
archiveParamsThe label will be more convenient. It will automatically retrieve all the custom parameters of the current product and iterate through them.<div class="product-specs"> <h3>产品规格</h3> <ul> {% archiveParams params %} {% for item in params %} {# 确保只显示有值的字段 #} {% if item.Value %} <li> <span class="spec-name">{{ item.Name }}:</span> <span class="spec-value">{{ item.Value|safe }}</span> </li> {% endif %} {% endfor %} {% endarchiveParams %} </ul> </div>In this example,
item.NameIt will display the parameter name you set in the background (such as “color”, “material”),whereasitem.Valueit will show the specific value you fill in for the product (such as “red”, “cotton linen”)。|safeThe filter ensures that the display is parsed correctly even if the custom field contains HTML content.
Combine the complete example of the product detail page (only showing the part related to custom fields):
Assuming your product model defines in addition to the built-in fields of AnQiCMS,model(Model, single-line text) andfeatures(Features, multi-line text/rich text) two custom fields.
`twig
<h1 class="product-title">{% archiveDetail with name="Title" %}</h1>
<div class="product-summary">
{# 显示产品型号自定义字段 #}
<p class="product-model">型号:{% archiveDetail with name="model" %}</p>
<p class="product-description">{% archiveDetail with name="Description" %}</p>
</div>
<div class="product-image">
<img src="{% archiveDetail with name='
Related articles
How to implement scheduled article publishing in AnQiCMS to ensure content is displayed to users as planned?
## Content publishing no longer chaotic: AnQiCMS's scheduling feature helps you easily plan your content schedule In the fast-paced digital content world, maintaining the rhythm of content publishing is crucial.Whether it is a small and medium-sized enterprise, a self-media operator, or a multi-site manager, everyone knows that presenting content to users according to a plan can effectively enhance brand image and increase user stickiness.However, manual publishing is not only time-consuming and labor-intensive, but it is also easy to disrupt the established plan due to various unexpected situations.AnQiCMS is well-versed in this, and its built-in scheduled publishing function is exactly designed to solve these pain points
2025-11-08How to configure the recommended attributes of articles (such as headlines, sliders) in AnQiCMS and display them in different areas on the front end?
Manage website content in Anqi CMS and make important information stand out to users, which is crucial for enhancing user experience and content marketing effectiveness.Among them, the recommendation attribute configuration of the article and the front-end display are important functions to achieve this goal.By reasonable settings, you can easily display articles such as "headline", "slide" and the like in different positions on the website, attracting visitors' attention.### First part: Set recommendation properties for articles in the background Firstly, we need to log in to the Anqi CMS backend management interface to assign "recommendation properties" to specific articles
2025-11-08How to call the website logo, filing number, and copyright information to display in the footer in AnQiCMS template?
In website operation, the footer usually carries important content such as brand logo, legal statements, filing information, and copyright statements.This information not only concerns the professional image of the website, but also reflects trustworthiness and compliance.For those who use AnQiCMS, flexibly calling this information in templates to achieve dynamic updates is a basic and practical skill.AnQiCMS is renowned for its concise and efficient architecture and the high performance brought by the Go language. It provides an intuitive template tag system, making it very easy to display website content.
2025-11-08How to add watermarks and anti-capture interference codes to the images in AnQiCMS article content to protect originality?
Today, with the increasingly rich digital content, the value of original content becomes more prominent, but it also faces the risk of being misused and plagiarized.Especially well-crafted images and written articles often become targets for criminals, not only violating the creators' labor成果, but also potentially diluting brand influence.Fortunately, AnQiCMS is a management system that focuses on user experience and content security, built-in powerful image watermarking and anti-crawling interference code functions, aimed at helping you easily protect your digital assets.###
2025-11-08How to build a multi-level menu and display it on the front end using the AnQiCMS navigation list tag (`navList`)?
The navigation system of the website is the core bridge for users to interact with content, especially for sites with rich content or deep levels, a clear and efficient multi-level menu is crucial.AnQiCMS provides a powerful and flexible navigation list tag (`navList`), allowing you to easily build and display a fully functional multi-level menu.To make full use of the navigation function of AnQiCMS, we need to start from the background configuration and then proceed to the rendering of the front-end template, step by step building the menu structure we desire.### One, Back-end Navigation Configuration
2025-11-08How to set the SEO title, keywords, and description for a single page in AnQiCMS, and customize its template?
Managing website content in AnQiCMS, a single page (or independent page) is a very practical feature, such as common pages like "About Us", "Contact Information", and so on.These pages' content is relatively fixed, but its SEO performance and display form are crucial for the overall image and user experience of the website.AnQiCMS is designed with SEO-friendliness in mind and provides flexible template customization capabilities, allowing us to easily set up unique SEO information and customize the display templates for each single page.
2025-11-08How to use the `thumb` filter to get a thumbnail image in AnQiCMS?
In a content management system, image thumbnails play a crucial role.They can not only accelerate page loading speed and optimize user experience, but also maintain visual consistency in various layouts, especially in list pages, recommendation positions, and other scenarios, which is particularly important.AnQiCMS (AnQi Content Management System) provides us with a convenient way to manage and access these thumbnails, where the `thumb` filter is a powerful tool to achieve this function.
2025-11-08How to apply the `thumb` filter to the image URL in the AnQiCMS template?
In website content operation, images play a crucial role, as they can not only attract users' attention but also effectively convey information.However, the original large image that has not been optimized often becomes a bottleneck in website loading speed, affecting user experience and even search engine rankings.AnQiCMS fully understands this and has provided a simple yet powerful tool for content operators to solve this problem - that is the **`thumb` filter`**.Then, how is the `thumb` filter applied to the image URL in the AnQiCMS template?
2025-11-08