When using AnQiCMS to manage website content, many users may notice a phenomenon: even for ordinary articles, information, and other non-product types of documents, the returned data structure still containsprice(price) andstock(Stock quantity) These two fields. At first glance, this may seem confusing, but after deeply understanding the design philosophy of AnQiCMS, it will be found that this is exactly the embodiment of its strong flexibility and scalability.

AnQiCMS is designed at the lowest level to abstract all content into the core entity 'document' (Archive).No matter whether it is a news report, a product introduction, a single page, or a software download link, they all share a set of basic attributes and fields in the core data model of the system.This unified document structure allows AnQiCMS to handle various types of content with a standardized API interface, greatly simplifying the system architecture and development complexity.

priceandstockThe field is the product under this unified architecture. They are designed as universal attributes of documents, which means they exist in every document record, but whether they are actually used or have business significance depends entirely on the "model" (Module) type associated with the document.

For example, when you create an "article" model, this general document structure containspriceandstockFields are usually meaningless in the context of the article, they will be displayed as 0 or a larger placeholder (for example, as shown in the example)price: 0, stock: 9999999). But when creating the "product" model, these two fields become crucial, as they are used to represent the product's price and current inventory, directly related to the product's trading attributes.

This design brings significant advantages:

Firstly, it providesextreme flexibility and scalability. If your website's business needs to expand in the future, such as turning the original "Service" articles that were used for display into online purchasable "Service Products", AnQiCMS does not need to modify the underlying database structure, but only needs to enable and configure the "Service" model in the background management interface.priceandstockThe field can be.module_idOr model configuration, intelligently judge whether to display or enable the functions of these fields.

Second, this kind ofUnified API interface and data structureIt greatly simplifies the work of developers. Whether the front-end needs to display a list of articles, product lists, or any other content list, it can be called/api/archive/listor/api/archive/detailinterface, and according to the returned data inmodule_idOr other model custom fields to render different content or functions. This means lower API interface learning cost, more unified code logic, and thus improves development efficiency.

In short, the reason why AnQiCMS includes all documents ispriceandstockThe field is to build a universal, powerful and flexible content management platform.These fields are like the "reserved interfaces" of the document, waiting to be activated and utilized to ensure that the system can seamlessly support a variety of complex business needs from pure content display to e-commerce.


Frequently Asked Questions (FAQ)

Q1: If my document is not a product type, thenpriceandstockwhat value will the field display?A1: For documents of non-commodity type, these two fields usually display default values. As can be seen from the document examples you provided,priceThe field is usually0(in cents), andstockThe field will be a very large number, for example9999999This usually indicates that the inventory is sufficient or unlimited. When rendering on the front-end page, you can selectively display or ignore these fields based on the model type of the document.

Q2: Can I hide the display of fields in the AnQiCMS backend management interface for non-product models?priceandstock?A2: AnQiCMS provides powerful model customization features. AlthoughpriceandstockIt is a common field at the system level, but you can customize its display behavior through the configuration document model.For example, when creating or editing the "article" model, you can adjust the settings to make these fields not appear in the content editing interface, or set them to be non-editable, thereby optimizing the editing experience.

Q3: If I initially created a content model without a price attribute (such as "course introduction"), and now I want to modify it to a paid course, do I need to create a new document?A3: This is the convenience brought by the design of AnQiCMS. You do not need to create documents anew. Due topriceandstockThe field is an inherent attribute of the document, you just need to modify the relevant configuration of the "course introduction" model in the background, enable it, and set the actual business logic and values for these fields.The existing "course introduction" document in the system will automatically have these properties, you just need to edit each document and fill in the corresponding price and inventory information, and then the front-end page will display and implement the corresponding functions based on the model type and these field values.