Esempio n. 1
0
 public function calcularItemAction()
 {
     $this->getHelper('viewRenderer')->setNoRender();
     $request = $this->getRequest()->getParams();
     $id = $request['id'];
     $qtd = $request["qtd"];
     $carrinho = new Application_Model_Carrinho();
     $retorno = $carrinho->carrinho($id, $qtd);
     $totalCompra = $carrinho->TotalCarrinho();
     // print_r($retorno);
     echo json_encode(array('qtd' => $qtd, 'id' => $id, 'subTotal' => 'R$ ' . number_format($retorno['subTotal'], 2, ",", "."), 'precoTotal' => 'R$ ' . number_format($totalCompra, 2, ",", "."), 'retorno' => true));
 }
Esempio n. 2
0
 public function indexAction()
 {
     $carrinho = new Application_Model_Carrinho();
     $this->view->carrinho = $carrinho->listaCarrinho();
     $this->view->totalCarrinho = 'R$ ' . number_format($carrinho->TotalCarrinho(), 2, ",", ".");
 }