public function indexAction() { if (!$this->session->has("logado")) { $this->session->set('checkout', true); return $this->response->redirect('user/login'); } $cart = new Cart(new Session(), new Cookie()); $this->view->subtotal = number_format($cart->total(), 2, ',', '.'); if ($this->session->has('frete')) { $this->view->frete = number_format($this->session->get('frete')['valor'], 2, ',', '.'); } $this->view->endereco_form = new CheckOutForm(); $this->view->total = number_format($cart->total() + $this->session->get('frete')['valor'], 2, ',', '.'); $widgets = Widgets::find("tipo_id = 1 AND ativo = 1 AND valor_minimo <= {$cart->total()} "); $this->view->widgets = array_map(array($this, 'setForms'), $widgets->toArray()); }
public function indexAction() { $this->view->dados = Widgets::find('habilitado = 1 AND tipo_id = 1'); }