if (!empty($item['review_id'])) { $classExists = ' review-exists'; } ?> <li> <a href="#" class="opener"> <span class="cell"><?php echo $num; ?> </span> <span class="cell"><?php echo $item['date_in']; ?> </span> <span class="cell"><?php echo Order::statusName($item['status']); ?> </span> <span class="cell"><?php echo $item['amount_credit']; ?> <i class="fa fa-rub"></i></span> </a> <div class="slide"> <div class="frame"> <div class="small-table"> <div class="row-holder"> <div class="column"> <strong class="title"><?php echo trans('main.Review'); ?>
public function orders($cid) { $customer = Customer::instance()->initByExternalId($cid); $api = new Api(); $password = $customer->get()->credential->agbis_password; if (!$password) { $this->log('Customer password is not exists', ['customer_id' => $cid]); return Response::json('Customer password is not exists', 500); } $key = 'users.agbis.sessions.customer' . $cid; $sessionId = Cache::get($key); if ($sessionId) { $this->log('session found', ['customer' => $customer->get()->id, 'session' => $sessionId]); } if (!$sessionId) { $sessionId = $this->initSessionKey($customer, $password, $key); } try { $orders = $api->Orders($sessionId); } catch (ApiException $e) { $this->log('session inactive, try new session'); $sessionId = $this->initSessionKey($customer, $password, $key); $orders = $api->Orders($sessionId); } foreach ($orders['orders'] as &$order) { $order['status_name'] = Order::statusName($order['status']); $order['autopay'] = $order['status'] >= 1 && $order['amount'] > 0; $lastPay = OrderAutopay::getLastPay($cid, $order['id']); $order['order_autopay'] = $lastPay['lastPay']; $order['payTotal'] = $lastPay['total']; } $orders = array_reverse($orders['orders']); return $orders; }
private function filterHistoryOrders($orders) { $api = new Api(); $cid = Customer::instance()->initByExternalId($api->id())->get()->id; $reviews = OrderReview::whereCustomerId($cid)->orderBy('created_at', 'asc')->get()->lists('id', 'order_id'); foreach ($orders as $key => &$item) { if (!Order::isStatusHistory($item['status'])) { unset($orders[$key]); continue; } if (!empty($reviews[$item['id']])) { $item['review_id'] = $reviews[$item['id']]; } } return array_reverse($orders); }