The algorithm of the shopping Cart

Source: Internet
Author: User
Algorithm for finding a shopping cart
When the customer added to the shopping cart after purchase, how to get the total price of the goods, if the Apple unit price of 10 yuan A, banana 5 yuan A, dragon fruit 8 yuan A, bought 3 apples, bananas 2, dragon Fruit 5, the current database is so designed a table put ID, commodity name, Price, b table put ID (and the ID of a table corresponds to), the number of items purchased, how to get the last price (the simplest and most efficient way), my current method is to use a multi-table query to the customer under the purchase of all the data query, and then in PHP with a foreach loop array, and then multiply the price and number, Finally, the results are added and the efficiency is not good.


------Solution--------------------
The reply was deleted by the administrator in 2013-01-11 12:19:36

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.