Created
December 14, 2015 12:56
-
-
Save vistajess/fde54734086a59becc6c to your computer and use it in GitHub Desktop.
ecommerce_orders.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include_once 'includes/headscript.php'; | |
| include_once '../config/config_pdo_connection.php'; | |
| include_once '../support/courier_class.php'; | |
| include_once '../config/directory.php'; | |
| $page = $_REQUEST['page'] ?: 1; | |
| $curl = curl_init(); | |
| $curlConfig = array( | |
| // CURLOPT_URL => API_V2 . '/users/' . $_SESSION['beone_new_user_id'] . '/orders?page=' . $page, | |
| // CURLOPT_URL => 'http://10.10.2.17:7000/me/orders?access_token=' . $_SESSION['access_token'] . '&page=' . $page, | |
| CURLOPT_URL => API_V2 . '/me/orders?access_token=' . $_SESSION['access_token'] . '&page=' . $page, | |
| CURLOPT_POST => false, | |
| CURLOPT_RETURNTRANSFER => true, | |
| ); | |
| curl_setopt_array($curl, $curlConfig); | |
| $result = curl_exec($curl); | |
| curl_close($curl); | |
| $resultSet = json_decode($result, true); | |
| ?> | |
| <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.10/css/jquery.dataTables.css"> | |
| <body class="page-header-fixed page-quick-sidebar-over-content"> | |
| <?php include_once('includes/header.php');?> | |
| <div class="page-container"> | |
| <?php include_once 'includes/sidebar.php';?> | |
| <section class="page-content-wrapper orders-section"> | |
| <div class="page-content clearfix"> | |
| <div id="ordersModule" class="col-md-10 col-md-offset-1 col-sm-12 col-sm-offset-0"> | |
| <h3 class="page-title"> My Product Orders </h3> | |
| <div class='panel panel-primary'> | |
| <div class='panel-heading'> Product Orders </div> | |
| <section> | |
| <table class='table table-striped table-bordered table-hover' id="datatable_orders"> | |
| <thead> | |
| <tr> | |
| <th width="15%"> Order Date </th> | |
| <th width="15%"> Order Number </th> | |
| <th width="15%"> Total </th> | |
| <th width="10%"> Quantity </th> | |
| <th width="10%"> Status </th> | |
| <th width="15%"> View Products </th> | |
| <th width="20%"></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <!-- Load Products Table --> | |
| </tbody> | |
| </table> | |
| </section> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| </div> | |
| <!-- trigger modal --> | |
| <section class="modal fade" id="modal_orders" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-keyboard="true" data-backdrop="static"> | |
| <div class="modal-dialog modal-lg"> | |
| <div class="modal-content"> | |
| <div class="modal-header"> | |
| <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| <h4 class="modal-title" id="myModalLabel">Ordered Product List</h4> | |
| </div> | |
| <div class="modal-body"> | |
| <h4><b>Order Number: <span id="remote_uuid"></span></b></h4> | |
| <ul class="nav nav-tabs"> | |
| <li class="active"><a data-toggle="tab" href="#products-tab">Products</a></li> | |
| <li><a data-toggle="tab" href="#vouchers-tab">Vouchers</a></li> | |
| </ul> | |
| <div class="tab-content"> | |
| <div id="products-tab" class="tab-pane fade in active"> | |
| <table class='table table-striped table-bordered table-hover clearfix'> | |
| <thead> | |
| <tr> | |
| <th width="20%"> Product Name </th> | |
| <th width="10%"> Quantity </th> | |
| <th width="20%"> Image </th> | |
| <th width="10%"> Price </th> | |
| <th width="20%"> Actions </th> | |
| </tr> | |
| </thead> | |
| <tbody id="product-target"> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div id="vouchers-tab" class="tab-pane fade"> | |
| <table class='table table-striped table-bordered table-hover clearfix'> | |
| <thead> | |
| <tr> | |
| <th width="20%"> Voucher Code </th> | |
| <th width="20%"> Voucher Name </th> | |
| <th width="10%"> Quantity </th> | |
| <th width="20%"> Image </th> | |
| <th width="10%"> Price </th> | |
| <th width="20%"> Actions </th> | |
| </tr> | |
| </thead> | |
| <tbody id="voucher-target"> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="modal-footer"> | |
| <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <script id="product-template" type="x-tmpl-mustache"> | |
| {{#products}} | |
| <tr> | |
| <td>{{ name }}</td> | |
| <td>{{ quantity }}</td> | |
| <td><img src={{ primary_image }} class='img-responsive' /></td> | |
| <td>P {{ selling_price }}</td> | |
| <td> | |
| {{#actions}} | |
| <button class="btn btn-primary btn-action-products" data-product-url={{ actions.url }}>{{ actions.text }}</button> | |
| {{/actions}} | |
| {{^actions}} | |
| Success | |
| {{/actions}} | |
| </td> | |
| </tr> | |
| {{/products}} | |
| {{^products}} | |
| <tr><td colspan="6">No Products. Please proceed to Vouchers Tab</td></tr> | |
| {{/products}} | |
| </script> | |
| <script id="voucher-template" type="x-tmpl-mustache"> | |
| {{#vouchers}} | |
| <tr> | |
| <td>{{ uuid }}</td> | |
| <td>{{ name }}</td> | |
| <td>{{ quantity }}</td> | |
| <td><img src={{ primary_image }} class='img-responsive' /></td> | |
| <td>P {{ selling_price }}</td> | |
| <td> | |
| {{#actions}} | |
| <button class="btn btn-primary btn-action-products" data-product-url={{ url }}>{{ text }}</button> | |
| {{/actions}} | |
| {{^actions}} | |
| Success | |
| {{/actions}} | |
| </td> | |
| </tr> | |
| {{/vouchers}} | |
| {{^vouchers}} | |
| <tr><td colspan="6">No Vouchers. Please proceed to Products Tab</td></tr> | |
| {{/vouchers}} | |
| </script> | |
| <?php include_once 'includes/footer_nio_closing.php';?> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.0/mustache.min.js"></script> | |
| <script type="text/javascript" src="js/new_orders.js"></script> | |
| <script type="text/javascript" src="js/neworders_modal.js"></script> | |
| <script type="text/javascript"> | |
| function getOrders(api,userid,access_token,pageNum,total) { | |
| Orders.init(api,userid,access_token,pageNum,total); | |
| } | |
| var api = "http://v2.api.onesupershop.com"; | |
| var userid = "<?php echo $_SESSION['beone_new_user_id'];?>"; | |
| var access_token = "<?php echo $_SESSION['access_token'];?>"; | |
| var total = "<?php echo $resultSet['total']; ?>"; | |
| getOrders(api,userid,access_token,1,total); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment