Exemple #1
0
<?php

session_start();
if (isset($_SESSION["user"])) {
    $user = $_SESSION["user"];
} else {
    $user = "";
}
$id = $_GET["id"];
include "include/util.php";
$con = connect_db();
mysql_select_db("eswap", $con);
$nickname = getNickName($user, $con);
$item_info = getItemInfo($id, $con);
$proposer_name = getNickName($item_info["Email"], $con);
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="/eSwap/css/banner.css" type="text/css">
	<link rel="stylesheet" href="/eSwap/css/footer.css" type="text/css">
	<link rel="stylesheet" href="/eSwap/css/sign_up.css" type="text/css">
  <script src="js/nav_display.js" type="text/javascript"></script>
  <script src="js/mail.js" type="text/javascript"></script>
  <script src="js/simpleajax.js" type="text/javascript"></script>
	<title>eSwap</title>
</head>
<body>
	<?php 
Exemple #2
0
 case 'getvendors':
     RestLog("Getting List of Vendors");
     require_once "getvendors.php";
     getVendors();
     break;
 case 'getinventory':
     //08.25.2015 ghh -  added getinventory request
     RestLog("Getting Inventory");
     require_once "getinventory.php";
     getInventory($requestvars, $responsetype);
     break;
 case 'getiteminfo':
     //08.25.2015 ghh -  added getinventory request
     RestLog("Getting Item Information");
     require_once "getiteminfo.php";
     getItemInfo($requestvars, $responsetype);
     break;
 case 'getmodel':
     //08.25.2015 ghh -  added getinventory request
     RestLog("Getting Model Info");
     require_once "getmodel.php";
     getModel($requestvars, $responsetype);
     break;
 case 'getorderstatus':
     //08.25.2015 ghh -  added getinventory request
     RestLog("Getting Order Status");
     require_once "getorderstatus.php";
     getOrderStatus($requestvars, $responsetype);
     break;
 default:
     die(RestUtils::sendResponse(400, 'Error 16542: Bad Request'));
 protected function setInfoWoocommerce()
 {
     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/woocommerce/functionsWoocommerce.php';
     $this->itemID = $this->row['order_item_id'];
     $this->productID = getItemInfo($this->row, '_product_id');
     if (null == (int) getItemInfo($this->row, '_variation_id')) {
         // Dans ce cas le variation Id vaut l'id du produit ce qui est bon
         $variationId = getItemInfo($this->row, '_product_id');
     } else {
         // Dans ce cas l'id est celui de la variation qui va permettre d'aller cherche le sku et le prix
         $variationId = getItemInfo($this->row, '_variation_id');
     }
     // On ajoute les attributs
     global $wpdb;
     $table = $wpdb->prefix . "woocommerce_order_itemmeta";
     $results = $wpdb->get_results("SELECT * FROM " . $table . " WHERE order_item_id = " . $this->row['order_item_id'], ARRAY_A);
     foreach ($results as $row) {
         if (substr($row['meta_key'], 0, 1) != "_") {
             // On regarde si pour cet item il existe des extra options : différent de 0
             // Si oui on enlève les champs qui on un id supérieur à celui de la ligne _tmcartepo_data : le plugin est vraiment mal fichu en base de donnée
             if (isAttributeTMOption($this->row['order_item_id']) != 0) {
                 if ($row['meta_id'] < isAttributeTMOption($this->row['order_item_id'])) {
                     array_push($this->attributes, new Attribute($this->software, $this->date, $row['meta_key'], $row['meta_value']));
                 }
             } else {
                 array_push($this->attributes, new Attribute($this->software, $this->date, $row['meta_key'], $row['meta_value']));
             }
         }
     }
     // On ajoute les attributs dans le cas ou on a des Extra product Options
     if (isAttributeTMOption($this->row['order_item_id']) != 0) {
         $tab = getTMOptionTab($this->row['order_item_id']);
         foreach ($tab as $option) {
             array_push($this->attributes, new Attribute($this->software, $this->date, $option['value'], 'Extra Options(s)', $option['price']));
         }
     }
     // On veut dans tous les cas enregistrer l'id du produit original pour avoir le bon nom
     $productId = getItemInfo($this->row, '_product_id');
     if (null != getProductInfo($variationId, '_sku')) {
         $this->code = getProductInfo($variationId, '_sku');
         $this->sku = getProductInfo($variationId, '_sku');
     } else {
         $this->code = getProductInfo($productId, '_sku');
         $this->sku = getProductInfo($productId, '_sku');
     }
     $this->name = getProductName($productId);
     $this->quantity = getItemInfo($this->row, '_qty');
     // Cas ou on a woocommerce Composite Products
     $this->price = getItemInfo($this->row, '_line_total');
     if (isComposed($this->row)) {
         $this->unitprice = 0;
     } else {
         // On regarde si il y a le plugin woocommerce-bulk-discount woocommerce-bulk-discount.php
         if (is_plugin_active_custom("woocommerce-bulk-discount/woocommerce-bulk-discount.php")) {
             //$this->unitprice = getProductInfo( $variationId, '_price' );
             // On met le prix au cas où le variation id ne soit pas présent dans le champ
             $this->unitprice = getProductInfo($variationId, '_price');
             $bulkInfo = getProductInfo($this->row['order_id'], '_woocommerce_t4m_discount_coeffs');
             if ($bulkInfo) {
                 $bulkData = json_decode($bulkInfo);
                 foreach ($bulkData as $key => $value) {
                     if ($key == $variationId && $value->coeff != 1) {
                         // Si le variation id est présent on remplace le prix
                         $this->unitprice = $value->coeff * $value->orig_price;
                         //var_dump( $value->coeff );
                     }
                 }
                 //var_dump( $bulkData );
             }
             //echo 'nico' . $bulkInfo;
         } else {
             $this->unitprice = getProductInfo($variationId, '_price');
         }
     }
     // Si le poid du variation vaut 0 on prend celui du parent
     if (0 != getProductInfo($variationId, '_weight')) {
         $this->weight = wooWeightNormal(getProductInfo($variationId, '_weight'), 'lbs');
     } else {
         $this->weight = wooWeightNormal(getProductInfo($productId, '_weight'), 'lbs');
     }
     // Les images
     $image = wp_get_attachment_image_src(get_post_thumbnail_id($variationId), 'Single Thumbs');
     $imageThumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($variationId), 'Product Thumbs');
     if ($image[0] == null) {
         // Cas ou on a pas d'image pour le variation product
         $image = wp_get_attachment_image_src(get_post_thumbnail_id($this->productID), 'Single Thumbs');
     }
     if ($imageThumbnail[0] == null) {
         // Cas ou on a pas d'image pour le variation product
         $imageThumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($this->productID), 'Product Thumbs');
     }
     $this->image = $image[0];
     $this->imageThumbnail = $imageThumbnail[0];
 }
            } else {
                $err = 2;
            }
        }
        if ($t) {
            downloadaFile();
        } else {
            header("Location: ./dwn1.php?err={$err}");
        }
        break;
    case 'getitemcount':
        getItemCount();
        echo "\n----------------------------------------------------------------------------------------------------\n";
        break;
    case 'getitemlist':
        getItemsList();
        echo "\n----------------------------------------------------------------------------------------------------\n";
        break;
    case 'getiteminfo':
        getItemInfo();
        echo "\n----------------------------------------------------------------------------------------------------\n";
        break;
    case 'changeexpiration':
        changeExpiration();
        echo "\n----------------------------------------------------------------------------------------------------\n";
        break;
    case 'deleteitem':
        deleteItem();
        echo "\n----------------------------------------------------------------------------------------------------\n";
        break;
}