When using AnQiCMS to manage website content, many users may notice a phenomenon: even for ordinary articles, information, and other non-product type documents, the returned data structure still contains when obtaining details through the API.price(price) andstockThese two fields are inventory quantities.This may initially seem confusing, but after a deep understanding of AnQiCMS's design philosophy, it will be found that this is a reflection of its strong flexibility and scalability.

AnQiCMS in the underlying design, abstracts all content into the core entity of “document” (Archive).No matter 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 enables AnQiCMS to handle various types of content with a standardized API interface, greatly simplifying the system architecture and development difficulty.

priceandstockThe field is a product under this unified architecture.They are designed as general properties of the document, 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 a “article” model, this common document structure includespriceandstockThe field is usually meaningless for the article itself, they will be displayed as 0 or a large placeholder by default (for example, as shown in theprice: 0, stock: 9999999)。But when creating the "product" model, these two fields become crucial, as they are used to represent the price and current inventory of the product, which are directly related to the transaction attributes of the product.

This design brings significant advantages:

Firstly, it providesExtremely flexible and scalable。If your website's business needs to expand in the future, for example, converting the original 'Service' articles displayed on the website to online-purchasable 'Service Products', AnQiCMS does not need to modify the underlying database structure. Instead, it only needs to enable and configure the 'Service' model in the backend management interfacepriceandstockField can be entered. Front-end developers can also judge whether to display or enable the functions of these fields intelligently according tomodule_idor model configuration, whether to display or enable these fields.

secondly,Unified API interface and data structureEnglishly simplifies the work of developers. Whether the front end needs to display a list of articles, a list of products, or any other type of content list, it can be called/api/archive/listor/api/archive/detailinterface, and according to the returned data inmodule_idThis means lower API interface learning cost, more unified code logic, and thus improved development efficiency.

In short, AnQiCMS makes all documents includepriceandstockThe field is to build a general, powerful and flexible content management platform.These fields are like the 'reserve interfaces' of the document, waiting to be activated and utilized, ensuring that the system can seamlessly support a variety of complex business needs, from pure content display to e-commerce.


Common Questions and Answers (FAQ)

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

Q2: Can I hide the display of fields for non-product models in the AnQiCMS backend management interface?priceandstock字段的显示?A2: AnQiCMS provides powerful model customization features. AlthoughpriceandstockIt is a system-level general field, but you can customize its display behavior by configuring the document model.For example, when creating or editing the "Article" model, you can adjust the relevant settings to make these fields not appear in the content editing interface or set them as non-editable, thus optimizing the editing experience.

Q3: If I initially created a content model without a price attribute (such as "course introduction"), do I need to recreate the document to make it a paid course?A3: This is the convenience brought by AnQiCMS design. You do not need to create documents again. BecausepriceandstockThe 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 stock information, and then the front-end page will display and implement the corresponding features based on the model type and the values of these fields.