Plugin Directory

Changeset 1450948


Ignore:
Timestamp:
07/08/2016 03:21:17 AM (10 years ago)
Author:
crowderia
Message:

new minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boxrunner/trunk/ichain.php

    r1446198 r1450948  
    493493            $ProductCategoryName = $term->name;
    494494
    495             $product_info = array(
    496                 "AgreementID" => 0,
    497                 "BasicPrice" => isset($_POST["_regular_price"]) ? filter_var($_POST["_regular_price"],FILTER_SANITIZE_NUMBER_FLOAT) :'',
    498                 "BuyingPrice" => (float) "",
    499                 "Description" => isset($_POST["post_content"])? filter_var($_POST["post_content"],FILTER_SANITIZE_STRING) :'',
    500                 "ExternalNumber" => (int) isset($_POST["ID"])? filter_var($_POST["ID"],FILTER_SANITIZE_STRING): '',
    501                 "ExternalProductCategoryId" => isset($_POST["tax_input"]["product_cat"][1])?  filter_var($_POST["tax_input"]["product_cat"][1],FILTER_SANITIZE_STRING) :'',
    502                 "ExternalProductCategoryName" => $ProductCategoryName,
    503                 "InternalNumber" => 1,
    504                 "PartyID" => (int) $party_id,
    505                 "ProductID" => 0,
    506                 "ProductName" => isset($_POST["post_title"])?  filter_var($_POST["post_title"],FILTER_SANITIZE_STRING): '',
     495           $product_info = array(
     496                "AgreementID"=>0,
     497                "BasicPrice"=>  $_POST["_regular_price"],
     498                "BuyingPrice"=> (float)"",
     499                "Description"=> $_POST["post_content"],
     500                "ExternalNumber"=> (int)$_POST["ID"],
     501                "ExternalProductCategoryId"=>$_POST["tax_input"]["product_cat"][1],
     502                "ExternalProductCategoryName"=>$ProductCategoryName,
     503                "InternalNumber"=>1,
     504                "PartyID"=> (int)$party_id,
     505                "ProductID"=> 0,
     506                "ProductName"=> $_POST["post_title"],
    507507                "ProductImage" => $url,
    508                 "SellingPrice" => (float) isset($_POST["_regular_price"])?  filter_var($_POST["_regular_price"],FILTER_SANITIZE_STRING):'',
    509                 "Token" => wc_bxr_getiChain_token_auth(),
    510                 "Weight" => isset($_POST["_weight"])?  filter_var($_POST["_weight"],FILTER_SANITIZE_NUMBER_FLOAT):''
     508                "SellingPrice"=> (float)$_POST["_sale_price"],
     509                "Token"=>wc_bxr_getiChain_token_auth(),
     510                "Weight" => floatval($_POST["_weight"])
    511511            );
    512512
    513513            $data_string = json_encode($product_info);
     514
    514515            $ch = curl_init($result->url . "/product.create");
    515516            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     
    523524            $res = curl_exec($ch);
    524525            $info = json_decode($res);
    525 
    526526            if ($info->Success) {
    527527                global $status;
     
    547547            $order = new WC_Order($order_id);
    548548            $shipping_address = preg_split('/<br[^>]*>/i', $order->get_shipping_address());
     549
     550            $ComapnyServiceId=0;
     551            if ($ComapnyService=='BoxRunner Ecornomy(1days)') {
     552                $ComapnyServiceId=0;
     553            }else if($ComapnyService=='BoxRunner Express(1days)'){
     554                $ComapnyServiceId=1;
     555            }
    549556
    550557            $item_id = 0;
     
    555562            }
    556563            $order_info = array(
    557                 "BuyerID" => (int) $order->user_id,
    558                 "DeliveryAddress" => array(
    559                     "AddressLine1" => $order->shipping_address_1,
    560                     "AddressLine2" => $order->shipping_address_2,
    561                     "City" => $order->shipping_city,
    562                     "PostalCode" => $order->shipping_postcode,
    563                     "Country" => WC()->countries->countries[$order->shipping_country],
    564                     "Name" => $shipping_address[0]
    565                 ),
    566                 "CollectionName" => $shipping_address[0],
    567                 "CreatedBy" => $order->billing_email,
    568                 "Description" => "",
    569                 "OrderID" => (int) "",
    570                 "OrderNumber" => $order->get_order_number(),
    571                 "PartyID" => (int) $party_id,
    572                 "SellerID" => 0,
    573                 "Token" => wc_bxr_getiChain_token_auth(),
    574                 "OrderItems" => $order_item
    575             );
     564                    "BuyerID"=> (int)$order->user_id,
     565                    "DeliveryAddress"=> array(
     566                        "AddressLine1"=> $order->shipping_address_1,
     567                        "AddressLine2"=> $order->shipping_address_2,
     568                        "City"=> $order->shipping_city,
     569                        "PostalCode"=> $order->shipping_postcode,
     570                        "Country"=> WC()->countries->countries[$order->shipping_country],
     571                        "Name"=> $shipping_address[0]
     572                    ),
     573                    "CollectionName"=> $shipping_address[0],
     574                    "CreatedBy"=> $order->billing_email,
     575                    "Description"=> "",
     576                    "OrderID" => (int)"",
     577                    "OrderNumber"=> $order->get_order_number(),
     578                    "PartyID"=> (int)$party_id,
     579                    "SellerID"=> 0,
     580                    "Token"=> wc_bxr_getiChain_token_auth(),
     581                    "OrderItems"=>$order_item,
     582                    "ComapnyServiceId"=>$ComapnyServiceId
     583                );
    576584
    577585            $data_string = json_encode($order_info);
     586
    578587            $ch = curl_init($result->url . "/salesOrder.createorderwithorderitems");
    579588            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
Note: See TracChangeset for help on using the changeset viewer.