Plugin Directory

Changeset 2830540


Ignore:
Timestamp:
12/08/2022 09:58:23 AM (3 years ago)
Author:
shiptimizeplugins
Message:

issue in getting labels for shops with custom order numbers

Location:
shiptimize-for-woocommerce/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • shiptimize-for-woocommerce/trunk/constants.php

    r2819261 r2830540  
    44define( 'SHIPTIMIZE_API_URL', 'https://api.pakketmail.nl/v3' );
    55define( 'SHIPTIMIZE_BRAND', 'Shiptimize' );
    6 define( 'SHIPTIMIZE_VERSION', '3.1.62' );
     6define( 'SHIPTIMIZE_VERSION', '3.1.64' );
    77define( 'SHIPTIMIZE_CREATE_ACCOUNT', 'https://www.shiptimize.me/quote/' );
    88define( 'SHIPTIMIZE_CHECKOUT', 0);
  • shiptimize-for-woocommerce/trunk/includes/admin/class-shiptimize-order-ui.php

    r2772699 r2830540  
    7070      if (isset($response->response->ClientReferenceCodeList)) {
    7171        foreach($response->response->ClientReferenceCodeList as $labelresult) {
    72           $order = new WooShiptimizeOrder($labelresult->ReferenceCode);
     72          $order = new WooShiptimizeOrder($labelresult->ShopItemId);
    7373          $status = ShiptimizeOrder::$LABEL_STATUS_NOT_REQUESTED;
    7474          $msg =  '';
     
    8989          $msg = $order_meta->message . $msg; 
    9090          $labelresult->message = $msg;
    91           $order->set_label_meta($labelresult->ReferenceCode,$status,$labelurl,$msg);
     91          $order->set_label_meta($labelresult->ShopItemId,$status,$labelurl,$msg);
    9292        }   
    9393      } 
  • shiptimize-for-woocommerce/trunk/includes/class-woo-shiptimize-order.php

    r2819261 r2830540  
    483483    }
    484484
     485    WooShiptimize::log("Updating tracking $tracking_id for order [$this->ShopItemId]");
    485486    $this->add_message($this->get_formated_message($shiptimize->translate("api sent trackingId:").' '.$tracking_id));
    486487
     
    655656       
    656657        $items = $this->woo_order->get_items();
     658
     659        if(!is_array($items)) {
     660          return array();
     661        }
     662
    657663        $weight = 0;
    658664
     
    980986            else { // error we want to ignore
    981987              WooShiptimize::log("Ignoring error $error->Id for $order->ShopItemId $error->Tekst ");
     988             
    982989              array_push($labelorders, $order->ShopItemId);               
    983990            }
     
    9981005
    9991006    if (!empty($labelorders)) {
    1000       $labelresponse = WooShiptimize::get_api()->post_labels_step1($labelorders);
     1007      // The api receives client references make sure we're sending that and not ShopItemIds
     1008      $labelReference = array();
     1009      foreach ($labelorders as $orderid) {
     1010        $reference = apply_filters( 'woocommerce_order_number', $orderid,  wc_get_order( $orderid ) );
     1011        array_push($labelReference, $reference);
     1012        WooShiptimize::log("label for order id $orderid  ref $reference");
     1013      }
     1014
     1015      $labelresponse = WooShiptimize::get_api()->post_labels_step1($labelReference);
    10011016      $labelresponse->ErrorList = $errors;
    10021017      WooShiptimize::log( "Labelresponse " . json_encode($labelresponse) );
  • shiptimize-for-woocommerce/trunk/includes/core/class-shiptimize-order.php

    r2819261 r2830540  
    643643        $this->Description = $this->escape_text_data($this->Description);
    644644   
    645         if(strlen($this->Description) > 255 ){
     645        if($this->Description && strlen($this->Description) > 255 ){
    646646            $this->Description = substr( $this->Description, 0, 255); 
    647647            $chars = str_split($this->Description); 
     
    655655        }
    656656
    657         if(strlen($this->PostalCode) > 15){
     657        if($this->PostalCode && strlen($this->PostalCode) > 15){
    658658            $originalPostalCode = $this->PostalCode;
    659659
    660660            $words = explode(" ", $this->PostalCode);
    661661            $validPostalCode = '';
    662             for ( $i = 0;  $i < count($words) && strlen($validPostalCode." " .$words[$i]) < 15 ; ++$i ){
     662            for ( $i = 0;  $i < count($words) && strlen($validPostalCode . " " . $words[$i]) < 15 ; ++$i ){
    663663                $validPostalCode .= ($i ? " " : "") . $words[$i];
    664664            }
  • shiptimize-for-woocommerce/trunk/readme.txt

    r2819311 r2830540  
    5959== Changelog ==
    6060
     61= 3.1.64 - 2022-11-16 =
     62* Fix - Error when creating labels from websites that use custom order numbers
     63
    6164= 3.1.63 - 2022-11-16 =
    6265* Fix - Error with Weight Based Shipping methods
  • shiptimize-for-woocommerce/trunk/shiptimize.php

    r2819311 r2830540  
    33 * Plugin Name: Shiptimize for WooCommerce
    44 * Description: Shiptimize for WooCommerce 
    5  * Version: 3.1.63
     5 * Version: 3.1.64
    66 * Author: Shiptimize
    77 * Author URI: https://shiptimize.me
Note: See TracChangeset for help on using the changeset viewer.