Shopping cart data caching and loading method of online system

Through the front-end paging loading and data caching mechanism, the performance and user experience problems of shopping carts on cloud business platforms are solved when processing large amounts of data and complex business logic, and the efficient loading and data consistency of shopping cart pages is achieved, and the cart additions are supported across stores are supported. and flexible data management reduces server burden and operational costs.

CN119202430AInactive Publication Date: 2024-12-27HEBEI TONGFU SHARING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411293207.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When shopping carts on existing cloud business platforms process large amounts of data and complex business logic, they lead to complex page loading and processing, affecting performance and user experience. Especially when the data volume is large and cars are added across stores, there is data consistency. and complexity issues.

Method used

Adopt the front-end paging loading and data caching mechanism to render valid and invalid product data through initial state checking and paging, and update the cache when data changes, ensure real-time update and consistency of information, reduce the amount of data loaded in a single time, and reasonably allocate the front-end and Backend resources.

Benefits of technology

Improves the performance and user experience of shopping cart pages, supports cross-store addition, flexible management of large amounts of product data, ensures real-time updates and consistency of information, reduces server burden and operational costs, and improves the flexibility and scalability of data processing. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202430A_ABST
    Figure CN119202430A_ABST
Patent Text Reader

Abstract

The invention relates to a shopping cart data caching and loading method of an online system, which comprises the following steps of: when a shopping cart page is presented, checking an initial state, and determining whether the page enters for the first time or is rendered again; when entering the shopping cart page for the first time, requesting to obtain all commodity data needing to be loaded into the shopping cart; then according to a preset number of goods, obtaining and rendering goods data of a corresponding number, and recording a starting subscript and an ending subscript when rendering is finished; when the commodity data is obtained and rendered, effective commodity data is firstly obtained and rendered, and then invalid commodity data is obtained and rendered; the rendered data are cached at the front end; and the shopping cart page loads the data from the cache and presents the data. According to the invention, through a front-end paging loading and data caching mechanism, the performance of shopping cart pages and the user experience are effectively improved, cross-shop loading is supported, a large amount of commodity data is flexibly managed, and meanwhile, real-time updating and consistency of information are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cloud commerce shopping management, and in particular to a shopping cart data caching and loading method for an online system. Background Art

[0002] Existing cloud commerce platforms provide services such as product display, transaction processing, and inventory management. Most cloud commerce platforms include shopping cart functions, including:

[0003] When users browse products, they can add them to the shopping cart. The shopping cart acts as a temporary storage space, allowing users to add or remove products at any time before making a final purchase decision.

[0004] The shopping cart can automatically calculate the total price of the selected items, including possible discounts, taxes and shipping costs, etc., to provide users with instant price information;

[0005] On platforms that support cross-store purchases, users can add products from different stores to the same shopping cart and settle the bill in a unified manner, which provides convenience for users;

[0006] Shopping cart data can be used to analyze user purchasing behavior, help merchants understand user preferences, and optimize product recommendations and inventory management;

[0007] The shopping cart is an important tool to guide users from browsing to checkout. It is usually integrated with the payment system to facilitate users to complete their purchases.

[0008] When loading product data in a shopping cart, if there are too many data lists, a paging loading mechanism is needed to assist, especially when there is no limit on the number of SKUs (product unified numbers, each product has unique SKU information). However, the paging loading mechanism greatly increases the complexity of the shopping cart in terms of price calculation (cross-store, full discount, discount, etc.), which leads to the following problems when processing shopping cart page data loading and rendering:

[0009] Since there is no limit on the number of SKUs in the shopping cart, page loading and processing becomes complicated and slow when the amount of data is large;

[0010] The backend does not support paging to load shopping cart data, which means that all data processing and paging logic need to be implemented on the frontend, increasing the burden on the frontend;

[0011] The shopping cart data needs to be cached on the front end, and the logic of data updates and changes needs to be handled, which may lead to data consistency issues, especially when the data changes frequently;

[0012] Since adding carts across stores is supported, data loading and rendering for different stores need to be handled specially, which increases the complexity of implementation;

[0013] If you use recursive rendering to reduce the amount of data loaded at one time, for example, only rendering 6 pieces of data at a time, it may affect performance, especially when the amount of data is large;

[0014] During the data loading and rendering process, if it is not handled properly, it may cause users to wait too long, affecting the user experience. For example, rendering invalid products after valid products are rendered may cause users to wait for valid products to be rendered before seeing invalid products, increasing the user's waiting time.

[0015] It is necessary to accurately detect changes in shopping cart data to decide whether re-rendering is needed, which involves complex state management and conditional judgment.

[0016] Therefore, shopping carts in existing online systems (such as shopping carts on cloud business platforms) face challenges in processing large amounts of data and complex business logic, and need to be further optimized to improve performance and user experience.

[0017] The information disclosed in this background technology section is only intended to deepen the understanding of the overall background technology of the present invention, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art already known to those skilled in the art. Summary of the invention

[0018] In view of the defects existing in the prior art, the purpose of the present invention is to provide a shopping cart data caching and loading method for an online system, which effectively improves the performance and user experience of the shopping cart page through front-end paging loading and data caching mechanism, supports cross-store cart addition, flexibly manages a large amount of product data, and ensures real-time updating and consistency of information.

[0019] In order to achieve the above purpose, the technical solution adopted by the present invention is:

[0020] A shopping cart data caching and loading method for an online system, characterized by comprising the following steps:

[0021] When rendering the shopping cart page, perform an initial state check to determine whether it is the first time entering the shopping cart page or whether the shopping cart page is being re-rendered based on a triggering event;

[0022] When entering the shopping cart page for the first time, a request is made to obtain all product data that needs to be loaded into the shopping cart, including valid product data and invalid product data;

[0023] Initialize the rendering environment, set the starting index startIndex to 0, obtain the corresponding amount of product data according to the preset number of items and render them, and record the ending index endIndex when the rendering ends;

[0024] When obtaining product data and rendering, first obtain valid product data and render it, then obtain invalid product data and render it;

[0025] The rendered data is cached on the front end;

[0026] The shopping cart page loads data from the cache and renders.

[0027] Based on the above technical solution, the default value of the preset number of items is 6.

[0028] On the basis of the above technical solution, when rendering, obtain product data from each store one by one;

[0029] If the current store has less than 6 product data, search for and obtain the product data of the next store.

[0030] Based on the above technical solution, when switching back to the shopping cart page from other pages, it is determined whether the product data in the shopping cart has changed;

[0031] If there is no change, directly get the cache data after the last rendering from the front-end cache;

[0032] If there are changes, the shopping cart page is re-rendered as if it were the first time the shopping cart page was entered, and the rendered data is re-cached on the front end.

[0033] Based on the above technical solution, whether the product data in the shopping cart has changed is based on the comparison of the following information:

[0034] The total number of stores and the names of each store;

[0035] Product name and total quantity of products;

[0036] Number of promotional activities and their names;

[0037] Unit price of the product;

[0038] The total price of the product.

[0039] Based on the above technical solution, if it is detected that re-rendering is required during the rendering process, the following steps are followed:

[0040] If the product data in the shopping cart has not changed and the last rendering operation has not been completed, the last rendering operation will be executed and completed first;

[0041] If the product data in the shopping cart has not changed and the last rendering operation has been completed, the cached data after the last rendering is directly obtained from the front-end cache;

[0042] If the product data in the shopping cart changes, the shopping cart page will be re-rendered as if the shopping cart page was first entered, and the rendered data will be re-cached on the front end.

[0043] Based on the above technical solution, each shopping cart paging corresponds to a rendering completion identifier;

[0044] When all pages of valid product data have been rendered, the valid product classification rendering completed identifier is updated to completed;

[0045] When all the pages of the invalid product data are rendered, the invalid product classification rendering completed identifier is updated to completed.

[0046] Based on the above technical solution, the backend provides all the product data that needs to be loaded into the shopping cart and maintains two information lists:

[0047] The first information list is used to store store related information that needs to be loaded into the shopping cart;

[0048] The second information list is used to store information related to the products that need to be loaded into the shopping cart, as well as the corresponding relationship between the products and the stores.

[0049] Based on the above technical solutions, the backend also counts and maintains information on product prices, product inventory, product discounts and discount ratios.

[0050] The shopping cart data caching and loading method of an online system described in the present invention has the following beneficial effects:

[0051] 1. Improve performance: Through paging loading and caching mechanism, the amount of data loaded at a single time is reduced, thereby improving the loading speed and response performance of the page.

[0052] Through paging loading, the resources of the front-end and back-end are reasonably allocated, which reduces the pressure on the server and also reduces the burden of the front-end to process large amounts of data.

[0053] By processing paging and caching on the front end, the computing and storage requirements of the back-end servers are reduced, helping to reduce operating costs.

[0054] 2. Optimize user experience: When users browse the shopping cart, they can quickly see the product information without waiting for all the data to be loaded at once, which improves the user's shopping experience.

[0055] There is no limit on the number of SKUs, which can meet the purchasing needs of the B-side.

[0056] It supports cross-store cart addition, allowing users to manage products from different stores in one shopping cart, increasing the flexibility of data management.

[0057] The solution can adapt to different business needs and changes, has good scalability, and facilitates the addition and modification of future functions.

[0058] The caching and data change detection mechanisms ensure that the shopping cart data that users see at different time points remains consistent.

[0059] The solution takes into account the display logic of expired products, ensuring that users can see the status of all products, including those that are no longer valid.

[0060] The shopping cart data caching and loading method of an online system described in the present invention effectively improves the performance and user experience of the shopping cart page through front-end paging loading and data caching mechanism. It supports cross-store cart addition and flexible management of a large amount of commodity data, while ensuring real-time update and consistency of information. In addition, the solution also optimizes resource allocation, reduces server burden, supports complex business logic, improves the flexibility and scalability of data processing, and helps reduce operating costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The present invention has the following accompanying drawings:

[0062] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0063] Figure 1 A flowchart of Embodiment 1 of a method for caching and loading shopping cart data in an online system according to the present invention.

[0064] Figure 2 A flowchart of a second embodiment of a method for caching and loading shopping cart data in an online system according to the present invention.

[0065] Figure 3 A flowchart of a third embodiment of a method for caching and loading shopping cart data in an online system according to the present invention. DETAILED DESCRIPTION

[0066] The present invention is further described in detail below in conjunction with the accompanying drawings. The detailed description is an explanation made in conjunction with the exemplary embodiments of the present invention, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0067] like Figure 1 As shown, the present invention provides a shopping cart data caching and loading method for an online system, comprising the following steps:

[0068] When rendering the shopping cart page, perform an initial state check to determine whether it is the first time entering the shopping cart page or whether the shopping cart page is being re-rendered based on a triggering event;

[0069] For example, the trigger event generated by switching the shopping cart page will cause the shopping cart page to be re-rendered;

[0070] When entering the shopping cart page for the first time, a request is made to obtain all product data that needs to be loaded into the shopping cart, including valid product data and invalid product data;

[0071] Initialize the rendering environment, set the starting index startIndex to 0, obtain the corresponding amount of product data according to the preset number of items and render them, and record the ending index endIndex when the rendering ends;

[0072] When obtaining product data and rendering, first obtain valid product data and render it, then obtain invalid product data and render it;

[0073] The rendered data is cached on the front end;

[0074] The shopping cart page loads data from the cache and renders.

[0075] This embodiment adopts a front-end caching mechanism, which reduces the number of repeated requests to the server to obtain data, and significantly improves the loading speed of the shopping cart page; since the number of requests to the server is reduced, especially in high-concurrency scenarios, it helps to reduce server load and improve system stability; by giving priority to rendering valid product data, users can see valid product information in the shopping cart more quickly, thereby improving the shopping experience; by adopting paging rendering technology, data can be loaded gradually according to user needs, which not only reduces the initial loading time, but also avoids performance problems caused by loading too much data on the page at one time; it has advantages in improving user experience, reducing server pressure, and optimizing system performance.

[0076] Based on the above technical solution, the default value of the preset number of items is 6. That is, 6 items of product data are obtained and rendered each time until all valid product data are rendered.

[0077] On the basis of the above technical solution, when rendering, obtain product data from each store one by one;

[0078] If the current store has less than 6 product data, search for and obtain the product data of the next store.

[0079] Organizing product data by store for rendering helps improve the logic and clarity of the shopping cart page, making it easier for users to find and manage products by store. Users can see product information from different stores more intuitively and can seamlessly browse to the products of the next store, improving the continuity and smoothness of shopping.

[0080] Based on the above technical solution, one of the situations where the shopping cart page is re-rendered according to the triggering event is as follows Figure 2 As shown, when switching back to the shopping cart page from other pages, it is determined whether the product data in the shopping cart has changed;

[0081] If there is no change, directly get the cache data after the last rendering from the front-end cache;

[0082] If there are changes, the shopping cart page is re-rendered as if it were the first time the shopping cart page was entered, and the rendered data is re-cached on the front end.

[0083] By detecting changes in the product data in the shopping cart, unnecessary rendering operations are avoided when the data remains unchanged, thereby saving system resources and time; in the case of unchanged data, users can see the content of the shopping cart page almost instantly without waiting for the data loading and rendering process, greatly improving the user experience; in the case of changed data, by re-rendering the shopping cart page and updating the front-end cache, it is ensured that the data seen by the user is always the latest and the consistency of the data is maintained. This embodiment, on the basis of maintaining the original rendering logic, adds a processing flow for specific trigger events, so that the system can respond to different user behaviors and page switching scenarios more flexibly and intelligently.

[0084] Based on the above technical solution, whether the product data in the shopping cart has changed is based on the comparison of the following information:

[0085] The total number of stores and the names of each store;

[0086] Product name and total quantity of products;

[0087] Number of promotional activities and their names;

[0088] Unit price of the product;

[0089] The total price of the product.

[0090] The product data in the shopping cart remains unchanged only if the above information remains unchanged.

[0091] Based on the above technical solution, the second situation of re-rendering the shopping cart page according to the triggering event is as follows Figure 3 As shown, if re-rendering is detected during the rendering process, the following steps are taken:

[0092] If the product data in the shopping cart has not changed and the last rendering operation has not been completed, the last rendering operation will be executed and completed first;

[0093] If the product data in the shopping cart has not changed and the last rendering operation has been completed, the cached data after the last rendering is directly obtained from the front-end cache;

[0094] If the product data in the shopping cart changes, the shopping cart page will be re-rendered as if the shopping cart page was first entered, and the rendered data will be re-cached on the front end.

[0095] When the data has not changed and the rendering has not been completed, the last rendering operation is completed first, avoiding the problem of incomplete or disordered pages caused by rendering interruptions, and ensuring the continuity and integrity of rendering; by quickly loading the completed rendering data from the front-end cache (when the data has not changed and the rendering has been completed), the user's waiting time is reduced, the page response speed and user experience are improved; when the data changes, by re-rendering the shopping cart page and updating the front-end cache, it is ensured that the data seen by the user is always the latest and the consistency of the data is maintained. This embodiment avoids unnecessary rendering and loading operations by reasonably distinguishing different situations and taking corresponding processing measures, thereby optimizing the utilization of system resources.

[0096] Based on the above technical solution, each shopping cart paging corresponds to a rendering completion identifier;

[0097] When all pages of valid product data have been rendered, the valid product classification rendering completed identifier is updated to completed;

[0098] When all the pages of the invalid product data are rendered, the invalid product classification rendering completed identifier is updated to completed.

[0099] By introducing page rendering completion identifiers and category rendering completion identifiers, the rendering progress and status of various types of data in the shopping cart page can be tracked and managed more accurately, thereby improving the accuracy and efficiency of rendering management; during the rendering process, combined with the preset number of default values ​​of 6, multiple page rendering tasks can be processed in parallel, and synchronized and coordinated according to the status of the rendering completion identifier, thereby improving the concurrency and efficiency of rendering. By ensuring that all pages are rendered before updating the rendering completion identifier, the system can ensure that the shopping cart page data presented to the user is consistent and complete.

[0100] The solution framework provided in this embodiment is scalable. By adjusting the relevant settings of paging and classification, and adjusting the default values ​​of the preset number of items, new paging, classification or rendering logic can be easily added without making large-scale modifications to the existing architecture.

[0101] Based on the above technical solution, the backend provides all the product data that needs to be loaded into the shopping cart and maintains two information lists:

[0102] The first information list is used to store store related information that needs to be loaded into the shopping cart;

[0103] The second information list is used to store information related to the products that need to be loaded into the shopping cart, as well as the corresponding relationship between the products and the stores.

[0104] Based on the above technical solutions, the backend also counts and maintains information on product prices, product inventory, product discounts and discount ratios.

[0105] The backend does not involve paging loading, and price calculation operations can be performed based on the backend data. Paging is performed by the frontend and the rendering results are cached. Through the collaborative work of the frontend and backend, an efficient, flexible and user-friendly shopping cart page is implemented.

[0106] The backend is responsible for statistics and maintenance of key product information, including but not limited to product prices, inventory, discounts, and discount ratios. This information is the basis for price calculation and display on the shopping cart page.

[0107] The front-end system performs page loading according to user operations, and the front-end is also responsible for caching the rendered page results so that they can be quickly presented to users when needed later. By caching the rendered page results on the front-end, users can quickly see the content when they revisit the shopping cart page or switch pages, without having to wait for the back-end data to be reloaded and rendered, allowing users to browse the product information in the shopping cart more smoothly. Since the front-end is responsible for page loading and caching rendering results, the back-end system does not need to process a large number of paging requests and data transmission tasks, thereby reducing the load pressure on the back-end.

[0108] The responsibilities of the front-end and back-end are clear and relatively independent, which makes it easier to implement future functional expansion or optimization of the system. For example, it is easy to add new paging strategies, optimize the cache mechanism, or introduce more complex pricing logic.

[0109] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.

[0110] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by those skilled in the art based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A shopping cart data caching and loading method for an online system, characterized in that: The steps include: When rendering the shopping cart page, perform an initial state check to determine whether it is the first time entering the shopping cart page or whether the shopping cart page is being re-rendered based on a triggering event; When entering the shopping cart page for the first time, a request is made to obtain all product data that needs to be loaded into the shopping cart, including valid product data and invalid product data; Initialize the rendering environment, set the starting index startIndex to 0, obtain the corresponding amount of product data according to the preset number of items and render them, and record the ending index endIndex when the rendering ends; When obtaining product data and rendering, first obtain valid product data and render it, then obtain invalid product data and render it; The rendered data is cached on the front end; The shopping cart page loads data from the cache and renders.

2. A method for caching and loading shopping cart data in an online system as claimed in claim 1, characterized in that: The default value of the preset number of entries is 6.

3. The method for caching and loading shopping cart data in an online system according to claim 1, characterized in that: When rendering, obtain product data from each store one by one; If the current store has less than 6 product data, search for and obtain the product data of the next store.

4. The method for caching and loading shopping cart data in an online system according to claim 1, characterized in that: When switching back to the shopping cart page from other pages, determine whether the product data in the shopping cart has changed; If there is no change, directly get the cache data after the last rendering from the front-end cache; If there are changes, the shopping cart page is re-rendered as if it were the first time the shopping cart page was entered, and the rendered data is re-cached on the front end.

5. The method for caching and loading shopping cart data in an online system as claimed in claim 4, characterized in that: Whether the product data in the shopping cart has changed is based on the comparison of the following information: The total number of stores and the names of each store; Product name and total quantity of products; Number of promotional activities and their names; Unit price of the product; The total price of the product.

6. A method for caching and loading shopping cart data in an online system as claimed in claim 1, characterized in that: If re-rendering is detected during the rendering process, proceed as follows: If the product data in the shopping cart has not changed and the last rendering operation has not been completed, the last rendering operation will be executed and completed first; If the product data in the shopping cart has not changed and the last rendering operation has been completed, the cached data after the last rendering is directly obtained from the front-end cache; If the product data in the shopping cart changes, the shopping cart page will be re-rendered as if the shopping cart page was first entered, and the rendered data will be re-cached on the front end.

7. The method for caching and loading shopping cart data in an online system according to claim 1, characterized in that: Each shopping cart pagination corresponds to a rendering completion identifier; When all pages of valid product data have been rendered, the valid product classification rendering completed identifier is updated to completed; When all the pages of the invalid product data are rendered, the invalid product classification rendering completed identifier is updated to completed.

8. The method for caching and loading shopping cart data in an online system according to claim 1, characterized in that: The backend provides all the product data that needs to be loaded into the shopping cart and maintains two information lists: The first information list is used to store store related information that needs to be loaded into the shopping cart; The second information list is used to store information related to the products that need to be loaded into the shopping cart, as well as the corresponding relationship between the products and the stores.

9. A method for caching and loading shopping cart data in an online system as claimed in claim 8, characterized in that: The backend also counts and maintains product prices, product inventory, product promotions and discount ratio information.