<?php //it is called by the cart when the user types his coupon number. session_start(); require 'model/db.php'; $discount = isset($_GET['discount']) ? $_GET['discount'] : ""; $coupons = getCoupons(); $_SESSION['discount'] = -1; foreach ($coupons as $coupon) { if ($coupon['number'] == $discount) { $_SESSION['discount'] = 1; } } header('Location: cart.php');
function content() { ?> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Coupons</h1> </div> <!-- /.col-lg-12 --> </div> <!-- /.row --> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> Coupon Details </div> <!-- /.panel-heading --> <div class="panel-body"> <div class="dataTable_wrapper"> <table class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>ObjectId</th> <th>Title</th> <th>Type</th> <th>Coupon Image</th> <th>Brand</th> <th>Visit Threshold</th> <th>Current Usage</th> <th>Max Usage</th> <th>Start Date Time</th> <th>End Date Time</th> </tr> </thead> <tbody> <?php $coupons = getCoupons(); // print_r($brands[2]); //echo $brands[2]->brandImage->getUrl(); //getting image //exit; foreach ($coupons as $coupon) { ?> <tr class="gradeA"> <td><?php echo $coupon->objectId; ?> </td> <td><?php echo $coupon->title; ?> </td> <td><?php echo $coupon->type; ?> </td> <td><a href="<?php echo $coupon->file; ?> "><img src="<?php echo $coupon->file; ?> " alt="<?php echo $coupon->file; ?> Logo" width="40"></a> </td> <td><a href="<?php echo $coupon->brand->brandImage; ?> "><img src="<?php echo $coupon->brand->brandImage; ?> " alt="<?php echo $coupon->brand->name; ?> Logo" width="40"> <?php echo $coupon->brand->name; ?> </a></td> <td><?php echo $coupon->visitThreshold; ?> </td> <td><?php echo $coupon->currentUsage; ?> </td> <td><?php echo $coupon->maxUsage; ?> </td> <td><?php echo $coupon->startDateTime->format('Y-m-d H:i:s'); ?> </td> <td><?php echo $coupon->endDateTime->format('Y-m-d H:i:s'); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- /.table-responsive --> </div> <!-- /.panel-body --> </div> <!-- /.panel --> </div> <!-- /.col-lg-12 --> </div> <!-- /.row --> </div> <?php }
protected function setInfoJigoshop() { include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/jigoshop/functionsJigoshop.php'; $this->id_order = $this->row['ID']; $this->createdDate = gmdate("Y-m-d\\TH:i:s\\Z", strtotime($this->row['post_date_gmt'])); $this->modifiedDate = gmdate("Y-m-d\\TH:i:s\\Z", strtotime($this->row['post_modified_gmt'])); $this->shipoption = getInformation($this->row, 'shipping_service'); $this->status = getStatus($this->row); $this->firstname = getInformation($this->row, 'billing_first_name'); $this->middlename = ''; $this->lastname = getInformation($this->row, 'billing_last_name'); $this->company = getInformation($this->row, 'billing_company'); $this->address = getInformation($this->row, 'billing_address_1'); $this->xaddress = ''; $this->street2 = getInformation($this->row, 'billing_address_2'); $this->street3 = ''; $this->city = getInformation($this->row, 'billing_city'); $this->state = getInformation($this->row, 'billing_state'); $this->postcode = getInformation($this->row, 'billing_postcode'); $this->country = getInformation($this->row, 'billing_country'); if ('' != $this->company) { $this->residential = 'false'; } $this->phone = getInformation($this->row, 'billing_phone'); $this->email = getInformation($this->row, 'billing_email'); $this->fax = ''; $this->website = ''; $this->shipfirstname = getInformation($this->row, 'shipping_first_name'); $this->shiplastname = getInformation($this->row, 'shipping_last_name'); $this->shipaddress = getInformation($this->row, 'shipping_address_1'); $this->shipstreet2 = getInformation($this->row, 'shipping_address_2'); $this->shipxaddress = getInformation($this->row, 'shipping_address_1'); $this->shipcity = getInformation($this->row, 'shipping_city'); $this->shipstate = getInformation($this->row, 'shipping_state'); $this->shippostcode = getInformation($this->row, 'shipping_postcode'); $this->shipcountry = getInformation($this->row, 'shipping_country'); $this->cardtype = getInformation($this->row, 'payment_method_title'); $this->freight = getInformation($this->row, 'order_shipping'); // Shipping Fee $this->tax = (double) getInformation($this->row, 'order_tax_no_shipping_tax') + (double) getInformation($this->row, 'order_shipping_tax'); //Tax Fee $this->discount = (double) getInformation($this->row, 'order_discount'); // Discount $this->fees = ''; // Add Fee global $wpdb; $time = strtotime($this->date . ' UTC'); $dateInLocal = date("Y-m-d H:i:s", $time); $table = $wpdb->prefix . "postmeta"; $result = $wpdb->get_row("SELECT * FROM " . $table . " WHERE post_id = " . $this->row['ID'] . " and meta_key = 'order_items'", ARRAY_A); $object = unserialize($result['meta_value']); foreach ($object as $key => $value) { array_push($this->items, new Item($this->software, $this->date, $value, $result['meta_id'])); } /* Les coupons */ if (getCoupons($this->row['ID']) != null) { $coupons = getCoupons($this->row['ID']); foreach ($coupons as $coupon) { array_push($this->coupons, 'Coupon : ' . $coupon['code']); } } // La note customer if ($this->row['post_excerpt'] != null) { array_push($this->coupons, $this->row['post_excerpt']); } }