Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $products = array();
- $sections = array();
- $pagetype = array();
- $names = array();
- $query = $this->db->query('select id,in_stock from product_stock');
- foreach($query->result() as $row) {
- $products[$row->id] = FALSE;
- if($row->in_stock == 'out') $products[$row->id] = TRUE;
- }
- $disallowed = array('product-detail','%detail');
- $query = $this->db->query("select id,contents,pagetype,name from product_info
- where id not like 'deleted%'
- and pagetype not like '" . implode("' and pagetype not like '", $disallowed) . "'");
- foreach($query->result() as $row) {
- $out = 0;
- $count = count($row->contents);
- foreach(explode(' ', $row->contents) as $content) {
- if(isset($products[$content])) {
- ($products[$content]?$out++:null);
- }
- }
- $cooking .= $row->id ."\t" .$row->pagetype ."\t" .$row->name ."\t" .$count ."\t" .$out ."\t" .($out/$count)*100 ."\n";
- }
- $cooking = "id\tpagetype\tname\tnumber in section\tnumber out of stock\t% out of stock\n" . $cooking;
- force_download('oosreport_section.txt',$cooking);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement