Ecshop get all order information or sales for a product

Source: Internet
Author: User

Put the code on the lib_main.php.

/*get Valid order information*/function Sales_goods_order ($goods _id) {$sql='Select order_id from'. $GLOBALS ['ECS']->table ('Order_goods').'where goods_id='. $goods _id;/*Order_goods Extract order_id*/$res= $GLOBALS ['DB']->GetAll ($sql); foreach($res as$k =$v) {er _id_arr[]= $v ['order_id']; } er _status='1,5';/*1: Split, 5: Confirm that any one of the conditions is met, calculate sales*/er _id= Implode (',', er _id_arr); $sql='SELECT * from'. $GLOBALS ['ECS']->table ('Order_info').'where Order_status in ('. er _status.') and order_id in ('. er _id.')'; $result= $GLOBALS ['DB']->GetAll ($sql); return$result;/*return valid order information*/}/*get a valid order sales statistics for a product*/function Sales_goods_number ($goods _id) {returncount (Sales_goods_order ($goods _id));}

Ecshop get all order information or sales for a product

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.