In AnQi CMS, when you accessarchive/listthe document list through the interface, the returned data includespriceandstockThese fields are of crucial significance for constructing e-commerce website models.They are not just simple numbers; they are the core elements that support product display, transaction process, and inventory management.

laying the foundation of goods: intuitive expression of price and inventory

Firstly,price(price) andstockDirectly convert any 'document' into a 'commodity' with commercial properties.In the e-commerce scenario, whether it is physical goods or virtual services, price is the primary factor for users to make consumption decisions, and inventory directly determines the purchaseability of the product.Anqi CMS builds these fields into the document model, meaning you don't need to perform complex custom development to set the basic trading attributes for your products.

It is worth noting that,priceThe field is stored in units of 'point', which is a common practice in e-commerce systems. The purpose is to avoid precision issues that may arise from floating-point calculations.When displaying on the front end, you just need to divide it by 100 to get the amount in 'yuan'.stockThe field clearly displays the current remaining quantity of the product, which has a direct impact on consumers' understanding of the product's scarcity and the promotion of purchasing behavior.

Fine operation: the art of inventory management

From the perspective of website operation,stockis the key to achieving fine-grained inventory management. By obtaining the inventory data, we can implement various operational strategies:archive/listWe can achieve various operational strategies:

  1. Prevent overselling:Before the user places an order, the system can query the product in real-time.stockEnsure there is enough inventory to complete the transaction. Once the item is successfully purchased, the inventory quantity will also be reduced accordingly, effectively avoiding over-selling and maintaining the merchant's reputation.
  2. Inventory Warning and Replenishment:When the stock quantity of a product falls below a certain threshold,stockthe operations personnel can receive timely warning notifications through data, arrange for procurement or production, and ensure that the product is never out of stock.
  3. Promotion Strategy:For products with tight inventory, promotional methods such as time-limited and quantity-limited sales, and flash sales can be adopted to utilize the scarcity of the product to stimulate the purchase desire of users.In contrast, for overstocked goods, it is also possible to quickly clear inventory through price promotions.

Optimizing User Experience: Transparency is the foundation of decision-making

For consumers,priceandstockTransparent display of fields greatly optimizes the shopping experience:

  1. Fast decision-making:Users can clearly see the prices in the product list and quickly filter out products that fit their budget.At the same time, clear inventory information (such as 'In stock', 'Only 5 left', 'Sold out') can help users determine whether they need to make a purchase immediately, reducing hesitation time.
  2. Filter and Sort:Althougharchive/listThe request parameters do not directly list options for filtering by price or stock, but as part of the returned data, front-end developers can implement custom price range filtering, sorting by price, and sorting by stock quantity, which greatly enhances the efficiency of users in searching for products.
  3. Reduce misunderstandings:Clear pricing and inventory information avoids misunderstandings or disputes arising from information asymmetry, enhancing user trust and satisfaction.

Expand and Integrate: Build a Comprehensive E-commerce Solution

AnQi CMS willpriceandstockAs a core document attribute, it also provides a good expansion foundation for more complex e-commerce functions. For example, combined witharchive/detailInterface, the user can view the detailed information of a product, including its specific price and stock. When the user makes a purchase,orderCreatethe interface will be based ongoods_id(Product ID) andquantity(Quantity) to create an order and handle the inventory deduction logic during this process. Subsequently,ordersthe interface can query a list of orders that include the prices and inventory snapshots of these products.

In addition, if your product has multiple specifications (such as different colors, sizes), and each specification has different prices and inventory, you can take advantage of the flexibility of the 'Document Model' in Anqi CMS to set more detailed price and inventory information for different SKUs (Stock Keeping Units) through 'extra fields', and even combine custom logic to handle them.

In short,archive/listReturned by the interface.priceandstockThe field is a powerful pair of out-of-the-box properties provided by AnQi CMS for e-commerce document models.They are not only the foundation for displaying product information, but also essential core elements that drive product sales, optimize inventory management, and enhance the shopping experience of users.Effectively utilize and manage these two fields can help your enterprise CMS e-commerce website achieve greater commercial value.


Common Questions (FAQ)

Q1:priceWhy is the unit of the field 'points'? How should it be handled when displayed on the front end? A1: priceThe field is in units of 'fen' to avoid precision issues that may arise from floating-point numbers (such as 12.99 yuan) when stored and calculated internally.This is a common practice in many e-commerce systems.priceDivide the value by 100 to convert it to an amount in 'yuan', for example,9900displayed as99.00.

Q2: If my product has multiple specifications (such as different colors, sizes, corresponding different prices and stock),priceandstockhow can the field reflect that? A2: archive/listorarchive/detaildirectly returned in the interfacepriceandstockTypically represents the main price and total inventory of the "document" (i.e., product), or the price and inventory of a default specification.If your product has a complex specification system, each specification has an independent price and stock, it is recommended to use the 'extra' feature in the 'document model' of Anqi CMS.You can customize fields to store different specifications of SKU information, including the price and stock of each SKU.When displaying on the frontend, you can dynamically render different specification selectors based on these additional fields, and update the displayed price and stock in real-time after the user selects a different specification.

Q3: Will the product automatically disappear from the list when the stock of the product is zero? How to set it? A3: archive/listThe interface itself will not bestockWhen zero, the product is automatically filtered out.It will only return the actual stock quantity.stockThe value of the field should be written to write the corresponding judgment logic. For example, after obtaining the product list, iterate through the data, whenstockWhen the value is 0, the product will not be rendered, or the "Add to Cart" button will be grayed out and the text "Sold out" will be displayed.This flexibility allows you to control the display of zero-inventory items according to your actual operational needs.