public static function getParcel($what, $orderid = 0) { $data = array('volume' => 0, 'weight' => 0, 'height' => 0, 'width' => 0, 'length' => 0); if ($what == 'site') { $order = Basket::getOrder(); $arrField = 'goods'; $data = array('volume' => 0, 'weight' => 0); foreach ($order[$arrField] as $item) { if ($item['set'] == true) { foreach ($item['goods'] as $goods) { $temp = Catalog::getArticle($goods['sizeId']); $data['volume'] += $temp['height'] * $temp['width'] * $temp['length']; $data['weight'] += $temp['weight']; if ($temp['width'] > $data['width']) { $data['width'] = $temp['width']; } if ($temp['length'] > $data['length']) { $data['length'] = $temp['length']; } $data['height'] += $temp['height']; } } else { $temp = Catalog::getArticle($item['sizeId']); $data['volume'] += $temp['height'] * $temp['width'] * $temp['length']; $data['weight'] += $temp['weight']; if ($temp['width'] > $data['width']) { $data['width'] = $temp['width']; } if ($temp['length'] > $data['length']) { $data['length'] = $temp['length']; } $data['height'] += $temp['height']; } } $data['volume'] = $data['volume'] / 1000000; $data['weight'] = $data['weight'] / 1000; $address = Region::getCity($_SESSION['iuser']['address'][0]['city']); } else { $order = Orders::getOrderById($orderid); foreach ($order['goods'] as $item) { $temp = Goods::getSizeByName($item['tree'], $item['size']); $data['volume'] += $temp['height'] * $temp['width'] * $temp['length']; $data['weight'] += $temp['weight']; if ($temp['width'] > $data['width']) { $data['width'] = $temp['width']; } if ($temp['length'] > $data['length']) { $data['length'] = $temp['length']; } $data['height'] += $temp['height']; } $data['volume'] = $data['volume'] / 1000000; $data['weight'] = $data['weight'] / 1000; $address = IuserAddress::getCity($order['address']['city']); } return array('data' => $data, 'address' => $address); }