Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container-fluid">
- <div class="row">
- <div class="col-md-8">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Catálogo</h3>
- </div>
- <div class="panel-body">
- <div class="row">
- <?php
- $productos = new Producto();
- $inventario = new Inventario();
- $sucursal = new Sucursal();
- $productos->get();
- $i = 0;
- foreach ( $productos as $row ) {
- $i++;
- echo form_open("index.php/Fachada_pedido/hacer_pedido", array (
- 'id' => 'formAgregarProducto',
- 'enctype' => 'multipart/form-data'
- ));
- echo '
- <div class="col-md-4">
- <div class="thumbnail">
- <img src="' . base_url() . 'assets/imagenes/' . $row->path_img . '" style="width:300px; height:300px" />
- <h3>' . $row->nombre_producto . '</h3>
- <p>
- <label for="cant1">Cantidad:</label>
- <input class="form-control" type="number" name="cantidad" min="1" value="1">
- </p>
- <button class="btn btn-primary" id="agregar">
- <span class="glyphicon glyphicon-plus-sign"></span>
- Agregar
- </button>
- </div>
- </div>';
- echo form_close();
- }
- ?>
- </div>
- <div class="row">
- <div class="text-center">
- <ul class="pagination">
- <li><a href="#">«</a></li>
- <li><a href="#">1</a></li>
- <li><a href="#">2</a></li>
- <li><a href="#">3</a></li>
- <li><a href="#">4</a></li>
- <li><a href="#">5</a></li>
- <li><a href="#">»</a></li>
- </ul>
- </div>
- </div>
- </div>
- <!-- Panel Body -->
- </div>
- <!-- panel panel-default -->
- </div>
- <!-- col-md-8 -->
- <div class="col-md-4">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title-center text-center ">Carrito de Compra</h3>
- </div>
- <div class="panel-body">
- <div class="table-responsive">
- <table
- class="table
- table-striped table-hover table-condensed">
- <thead>
- <tr>
- <th width="25%" class="text-center"><strong>Producto</strong></th>
- <th width="25%" class="text-center"><strong>Cantidad</strong></th>
- <th width="25%" class="text-center"><strong>Importe</strong></th>
- <th width="25%" class="text-right"><strong></strong></th>
- </tr>
- </thead>
- <tbody id="myID">
- </tbody>
- </table>
- </div>
- <div class="panel panel-default">
- <div class="panel-body">
- <button type="button" class="btn btn-default">Comprar</button>
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-body">
- <button type="button" class="btn btn-success btn-block">¡Crea tu
- propio Arreglo!</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $(document).ready(function() {
- $(".thumbnail > .btn").click(function(event) {
- event.preventDefault();
- var padre = $(this).parent();
- var input_cantidad = padre.children().children('input[name=cantidad]');
- var cantidad = input_cantidad.val();
- var producto = padre.children("h3").text();
- if (cantidad) {
- $.post("<?php echo base_url() ?>Fachada_pedido/agregar_producto_carrito/",
- {producto: producto, cantidad: cantidad},
- function(result) {
- var result = $("#myID").html() + result;
- $("#myID").html(result);
- });
- }
- });
- });
- function eliminar_producto(){
- $('#myID').on('click', '.btn-danger', function(event) {
- event.preventDefault();
- var linea = $(this).parent().parent();
- linea.remove();
- });
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement