Changeset 3352162
- Timestamp:
- 08/28/2025 04:48:18 PM (7 months ago)
- Location:
- fivepost/trunk
- Files:
-
- 4 added
- 5 edited
-
assets/templates (added)
-
assets/templates/mail (added)
-
assets/templates/mail/neworder.tpl (added)
-
classes/fivepost-wp.class.php (modified) (3 diffs)
-
classes/shipping.class.php (modified) (3 diffs)
-
files/.htaccess (modified) (1 diff)
-
fivepost.php (modified) (2 diffs)
-
languages/fivepost-wp.pot (added)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fivepost/trunk/classes/fivepost-wp.class.php
r3344658 r3352162 301 301 require_once(FIVEPOST_PLUGIN_DIR.'classes/shipping.class.php'); 302 302 303 $shipping_method = new \Fivepost_Shipping_Method(); 304 305 if($shipping_method->has_settings() && $shipping_method->get_option('api_key')) { 306 $adapter = new CurlAdapter(15, ($shipping_method->get_option('service_enlog') === 'yes') ); 307 $sdk = new Sdk($adapter, '', null, $shipping_method->get_option('api_wtype')); 308 $request = new JwtGenerate(); 309 $request->setApikey($shipping_method->get_option('api_key')); 310 311 $jwt = $sdk->jwtGenerate($request)->getResponse(); 312 313 $adapter = new CurlAdapter(15, ($shipping_method->get_option('service_enlog') === 'yes') ); 314 $sdk = new Sdk($adapter, $jwt->getJwt(), null, $shipping_method->get_option('api_wtype')); 315 316 $page_number = get_option('fivepost-page-number', 0); 317 $request = new PickupPoints(); 318 $request->setPageNumber($page_number)->setPageSize(1000); 319 320 $result = $sdk->pickupPoints($request)->getResponse(); 321 322 if($result->getSuccess() && !empty($result->getContent()->getFields())) { 323 $values = []; 324 325 foreach ($result->getContent()->getFields() as $point) { 326 if(empty($point['rate'])) continue; 327 $values[] = [ 328 'id'=>$point['id'], 329 'name'=>addslashes($point['name']), 330 'partner_name'=>addslashes($point['partnerName']), 331 'type'=>addslashes($point['type']), 332 'additional'=>(!empty($point['additional']) ? addslashes($point['additional']) : ''), 333 'work_hours'=>!empty($point['workHours']) ? json_encode($point['workHours']) : '[]', 334 'full_address'=>!empty($point['fullAddress']) ? addslashes($point['fullAddress']) : '', 335 'address_country'=>(!empty($point['address']) && !empty($point['address']['country'])) ? addslashes($point['address']['country']) : '', 336 'address_zip_code'=>(!empty($point['address']) && !empty($point['address']['zipCode'])) ? addslashes($point['address']['zipCode']) : '', 337 'address_region'=>(!empty($point['address']) && !empty($point['address']['region'])) ? addslashes($point['address']['region']) : '', 338 'address_region_type'=>(!empty($point['address']) && !empty($point['address']['regionType'])) ? addslashes($point['address']['regionType']) : '', 339 'address_city'=>(!empty($point['address']) && !empty($point['address']['city'])) ? addslashes($point['address']['city']) : '', 340 'address_city_type'=>(!empty($point['address']) && !empty($point['address']['cityType'])) ? addslashes($point['address']['cityType']) : '', 341 'address_street'=>(!empty($point['address']) && !empty($point['address']['street'])) ? addslashes($point['address']['street']) : '', 342 'address_house'=>(!empty($point['address']) && !empty($point['address']['house'])) ? addslashes($point['address']['house']) : '', 343 'address_building'=>(!empty($point['address']) && !empty($point['address']['building'])) ? addslashes($point['address']['building']) : '', 344 'latitude'=>(!empty($point['address']) && !empty($point['address']['lat'])) ? floatval($point['address']['lat']) : 0, 345 'longitude'=>(!empty($point['address']) && !empty($point['address']['lng'])) ? floatval($point['address']['lng']) : 0, 346 'metro_station'=>(!empty($point['address']) && !empty($point['address']['metroStation'])) ? addslashes($point['address']['metroStation']) : '', 347 'max_cell_width'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellWidth'])) ? intval($point['cellLimits']['maxCellWidth']) : 0, 348 'max_cell_height'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellHeight'])) ? intval($point['cellLimits']['maxCellHeight']) : 0, 349 'max_cell_length'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellLength'])) ? intval($point['cellLimits']['maxCellLength']) : 0, 350 'gabs_hash'=> \Fivepost_Shipping_Method::makeDimensionsHash( 351 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellWidth'])) ? intval($point['cellLimits']['maxCellWidth']) : 0, 352 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellHeight'])) ? intval($point['cellLimits']['maxCellHeight']) : 0, 353 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellLength'])) ? intval($point['cellLimits']['maxCellLength']) : 0 354 ), 355 'max_weight'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxWeight'])) ? intval($point['cellLimits']['maxWeight']) : 0, 356 'return_allowed'=>!empty($point['returnAllowed']) ? boolval($point['returnAllowed']) : 0, 357 'timezone'=>!empty($point['timezone']) ? addslashes($point['timezone']) : '', 358 'phone'=>!empty($point['phone']) ? addslashes($point['phone']) : '', 359 'cash_allowed'=>!empty($point['cashAllowed']) ? boolval($point['cashAllowed']) : 0, 360 'card_allowed'=>!empty($point['cardAllowed']) ? boolval($point['cardAllowed']) : 0, 361 'loyalty_allowed'=>!empty($point['loyaltyAllowed']) ? boolval($point['loyaltyAllowed']) : 0, 362 'ext_status'=>!empty($point['extStatus']) ? addslashes($point['extStatus']) : '', 363 'locality_fias_code'=>!empty($point['localityFiasCode']) ? addslashes($point['localityFiasCode']) : '', 364 'delivery_sl'=>(!empty($point['deliverySL']) && !empty($point['deliverySL'][0]) && !empty($point['deliverySL'][0]['Sl'])) ? intval($point['deliverySL'][0]['Sl']) : 0, 365 'rates'=>!empty($point['rate']) ? json_encode($point['rate']) : '[]', 366 'last_mile_warehouse_id'=>(!empty($point['lastMileWarehouse']) && !empty($point['lastMileWarehouse']['id'])) ? addslashes($point['lastMileWarehouse']['id']) : '', 367 'last_mile_warehouse_name'=>(!empty($point['lastMileWarehouse']) && !empty($point['lastMileWarehouse']['name'])) ? addslashes($point['lastMileWarehouse']['name']) : '', 368 'date_sync'=>date('Y-m-d H:i:s') 369 ]; 370 371 if (!empty($point['rate'])) { 372 global $wpdb; 373 foreach ($point['rate'] as $r) { 374 $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->base_prefix}fivepost_tarifs` WHERE `tname` = %s;",$r['rateType'])); 375 if (!$row) $wpdb->insert($wpdb->base_prefix.'fivepost_tarifs',['tname'=>$r['rateType']]); 376 } 377 } 378 } 379 $coltypes=[ 380 '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', 381 '%s','%s','%s','%s','%s','%s','%f','%f','%s','%d', 382 '%d','%d','%d','%d','%d','%s','%s','%d','%d','%d', 383 '%s','%s','%d','%s','%s','%s','%s' 384 ]; 385 if(!empty($values)) { //correct bugs in points 386 global $wpdb; 387 for ($i=0;$i<=count($values)-1;$i++) { 388 foreach ($values[$i] as &$vl) { 389 $vl = preg_replace('/\r/','',$vl); 390 $vl = preg_replace('/\n/','',$vl); 391 } 392 unset($vl); 393 } 394 foreach ($values as $val) $wpdb->replace($wpdb->base_prefix.'fivepost_pickup_points',$val,$coltypes); 395 } 396 397 update_option('fivepost-page-number', $page_number + 1); 398 } else { 399 update_option('fivepost-page-number', 0); 400 update_option('fivepost-update-date', date('Y-m-d')); 401 } 303 $page_number = get_option('fivepost-page-number', 0); 304 $loadPageResult = $this->loadPointsPage($page_number); 305 if ($loadPageResult['ans']) { 306 update_option('fivepost-page-number', $page_number + 1); 307 } else { 308 update_option('fivepost-page-number', 0); 309 update_option('fivepost-update-date', date('Y-m-d')); 402 310 } 403 311 } … … 427 335 } 428 336 // /modify_table_if_need 429 337 if (!isset($_POST['pgn'])) { 338 wp_send_json([ 339 'ans' => false, 340 'code'=>-3 //pgn not defined 341 ]); 342 wp_die(); 343 } 344 $page_number = intval($_POST['pgn']); 345 346 $loadPageResult = $this->loadPointsPage($page_number); 347 wp_send_json($loadPageResult); 348 wp_die(); 349 } 350 351 private function loadPointsPage($page_number) 352 { 430 353 $shipping_method = new \Fivepost_Shipping_Method(); 354 $loadPointResult = [ 355 'ans' => false, 356 'code' => 0, 357 'isf' => 0, 358 'isl' => 0, 359 'pgn' => 0, 360 'tot' => 0, 361 ]; 362 431 363 if($shipping_method->has_settings() && $shipping_method->get_option('api_key')) { 432 if (!isset($_POST['pgn'])) {433 wp_send_json([434 'ans' => false,435 'code'=>-3 //pgn not defined436 ]);437 wp_die();438 }439 $page_number = intval($_POST['pgn']);440 441 364 $adapter = new CurlAdapter(15, ($shipping_method->get_option('service_enlog') === 'yes') ); 442 365 $sdk = new Sdk($adapter, '', null, $shipping_method->get_option('api_wtype')); 443 366 $request = new JwtGenerate(); 444 367 $request->setApikey($shipping_method->get_option('api_key')); 368 445 369 $jwt = $sdk->jwtGenerate($request)->getResponse(); 370 446 371 $adapter = new CurlAdapter(15, ($shipping_method->get_option('service_enlog') === 'yes') ); 447 372 $sdk = new Sdk($adapter, $jwt->getJwt(), null, $shipping_method->get_option('api_wtype')); … … 453 378 $values = []; 454 379 $decoded = $result->getDecoded(); 455 $curpg = $decoded->number; 456 $totalpgs = $decoded->totalPages; 457 $is_first = $decoded->first; 458 $is_last = $decoded->last; 380 381 $loadPointResult['isf'] = $decoded->first; 382 $loadPointResult['isl'] = $decoded->last; 383 $loadPointResult['pgn'] = $decoded->number + 1; 384 $loadPointResult['tot'] = $decoded->totalPages; 459 385 460 386 foreach ($result->getContent()->getFields() as $point) { 461 if(empty($point['rate'])) continue; 462 $values[] = [ 463 'id'=>$point['id'], 464 'name'=>addslashes($point['name']), 465 'partner_name'=>addslashes($point['partnerName']), 466 'type'=>addslashes($point['type']), 467 'additional'=>(!empty($point['additional']) ? addslashes($point['additional']) : ''), 468 'work_hours'=>!empty($point['workHours']) ? json_encode($point['workHours']) : '[]', 469 'full_address'=>!empty($point['fullAddress']) ? addslashes($point['fullAddress']) : '', 470 'address_country'=>(!empty($point['address']) && !empty($point['address']['country'])) ? addslashes($point['address']['country']) : '', 471 'address_zip_code'=>(!empty($point['address']) && !empty($point['address']['zipCode'])) ? addslashes($point['address']['zipCode']) : '', 472 'address_region'=>(!empty($point['address']) && !empty($point['address']['region'])) ? addslashes($point['address']['region']) : '', 473 'address_region_type'=>(!empty($point['address']) && !empty($point['address']['regionType'])) ? addslashes($point['address']['regionType']) : '', 474 'address_city'=>(!empty($point['address']) && !empty($point['address']['city'])) ? addslashes($point['address']['city']) : '', 475 'address_city_type'=>(!empty($point['address']) && !empty($point['address']['cityType'])) ? addslashes($point['address']['cityType']) : '', 476 'address_street'=>(!empty($point['address']) && !empty($point['address']['street'])) ? addslashes($point['address']['street']) : '', 477 'address_house'=>(!empty($point['address']) && !empty($point['address']['house'])) ? addslashes($point['address']['house']) : '', 478 'address_building'=>(!empty($point['address']) && !empty($point['address']['building'])) ? addslashes($point['address']['building']) : '', 479 'latitude'=>(!empty($point['address']) && !empty($point['address']['lat'])) ? floatval($point['address']['lat']) : 0, 480 'longitude'=>(!empty($point['address']) && !empty($point['address']['lng'])) ? floatval($point['address']['lng']) : 0, 481 'metro_station'=>(!empty($point['address']) && !empty($point['address']['metroStation'])) ? addslashes($point['address']['metroStation']) : '', 482 'max_cell_width'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellWidth'])) ? intval($point['cellLimits']['maxCellWidth']) : 0, 483 'max_cell_height'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellHeight'])) ? intval($point['cellLimits']['maxCellHeight']) : 0, 484 'max_cell_length'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellLength'])) ? intval($point['cellLimits']['maxCellLength']) : 0, 485 'gabs_hash'=> \Fivepost_Shipping_Method::makeDimensionsHash( 486 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellWidth'])) ? intval($point['cellLimits']['maxCellWidth']) : 0, 487 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellHeight'])) ? intval($point['cellLimits']['maxCellHeight']) : 0, 488 (!empty($point['cellLimits']) && !empty($point['cellLimits']['maxCellLength'])) ? intval($point['cellLimits']['maxCellLength']) : 0 489 ), 490 'max_weight'=>(!empty($point['cellLimits']) && !empty($point['cellLimits']['maxWeight'])) ? intval($point['cellLimits']['maxWeight']) : 0, 491 'return_allowed'=>!empty($point['returnAllowed']) ? boolval($point['returnAllowed']) : 0, 492 'timezone'=>!empty($point['timezone']) ? addslashes($point['timezone']) : '', 493 'phone'=>!empty($point['phone']) ? addslashes($point['phone']) : '', 494 'cash_allowed'=>!empty($point['cashAllowed']) ? boolval($point['cashAllowed']) : 0, 495 'card_allowed'=>!empty($point['cardAllowed']) ? boolval($point['cardAllowed']) : 0, 496 'loyalty_allowed'=>!empty($point['loyaltyAllowed']) ? boolval($point['loyaltyAllowed']) : 0, 497 'ext_status'=>!empty($point['extStatus']) ? addslashes($point['extStatus']) : '', 498 'locality_fias_code'=>!empty($point['localityFiasCode']) ? addslashes($point['localityFiasCode']) : '', 499 'delivery_sl'=>(!empty($point['deliverySL']) && !empty($point['deliverySL'][0]) && !empty($point['deliverySL'][0]['Sl'])) ? intval($point['deliverySL'][0]['Sl']) : 0, 500 'rates'=>!empty($point['rate']) ? json_encode($point['rate']) : '[]', 501 'last_mile_warehouse_id'=>(!empty($point['lastMileWarehouse']) && !empty($point['lastMileWarehouse']['id'])) ? addslashes($point['lastMileWarehouse']['id']) : '', 502 'last_mile_warehouse_name'=>(!empty($point['lastMileWarehouse']) && !empty($point['lastMileWarehouse']['name'])) ? addslashes($point['lastMileWarehouse']['name']) : '', 503 'date_sync'=>date('Y-m-d H:i:s') 387 if (empty($point['rate'])) continue; 388 389 $pointObject = [ 390 'id' => $point['id'], 391 'name' => addslashes($point['name']), 392 'partner_name' => addslashes($point['partnerName']), 393 'type' => addslashes($point['type']), 394 'additional' => addslashes($point['additional'] ?? ''), 395 'work_hours' => !empty($point['workHours']) ? json_encode($point['workHours']) : '[]', 396 'full_address' => self::clearValueFromDB($point['fullAddress'] ?? ''), 397 'address_country' => '', 398 'address_zip_code' => '', 399 'address_region' => '', 400 'address_region_type' => '', 401 'address_city' => '', 402 'address_city_type' => '', 403 'address_street' => '', 404 'address_house' => '', 405 'address_building' => '', 406 'latitude' => 0, 407 'longitude' => 0, 408 'metro_station' => '', 409 'max_cell_width' => 0, 410 'max_cell_height' => 0, 411 'max_cell_length' => 0, 412 'gabs_hash' => \Fivepost_Shipping_Method::makeDimensionsHash(0, 0, 0), 413 'max_weight' => 0, 414 'return_allowed' => boolval($point['returnAllowed'] ?? false), 415 'timezone' => addslashes($point['timezone'] ?? ''), 416 'phone' => addslashes($point['phone'] ?? ''), 417 'cash_allowed' => boolval($point['cashAllowed'] ?? false), 418 'card_allowed' => boolval($point['cardAllowed'] ?? false), 419 'loyalty_allowed' => boolval($point['loyaltyAllowed'] ?? false), 420 'ext_status' => addslashes($point['extStatus'] ?? ''), 421 'locality_fias_code' => addslashes($point['localityFiasCode'] ?? ''), 422 'delivery_sl' => (!empty($point['deliverySL']) && !empty($point['deliverySL'][0]) && !empty($point['deliverySL'][0]['Sl'])) ? intval($point['deliverySL'][0]['Sl']) : 0, 423 'rates' => !empty($point['rate']) ? json_encode($point['rate']) : '[]', 424 'last_mile_warehouse_id' => '', 425 'last_mile_warehouse_name' => '', 426 'date_sync' => date('Y-m-d H:i:s') 504 427 ]; 428 if (!empty($point['address'])) { 429 $pointObject['address_country'] = self::clearValueFromDB($point['address']['country'] ?? ''); 430 $pointObject['address_city'] = self::clearValueFromDB($point['address']['city'] ?? ''); 431 $pointObject['address_city_type'] = self::clearValueFromDB($point['address']['cityType'] ?? ''); 432 $pointObject['address_zip_code'] = self::clearValueFromDB($point['address']['zipCode'] ?? ''); 433 $pointObject['address_region'] = self::clearValueFromDB($point['address']['region'] ?? ''); 434 $pointObject['address_region_type'] = self::clearValueFromDB($point['address']['regionType'] ?? ''); 435 $pointObject['address_street'] = self::clearValueFromDB($point['address']['street'] ?? ''); 436 $pointObject['address_house'] = self::clearValueFromDB($point['address']['house'] ?? ''); 437 $pointObject['address_building'] = self::clearValueFromDB($point['address']['building'] ?? ''); 438 $pointObject['latitude'] = floatval($point['address']['lat'] ?? 0); 439 $pointObject['longitude'] = floatval($point['address']['lng'] ?? 0); 440 $pointObject['metro_station'] = self::clearValueFromDB($point['address']['metroStation'] ?? ''); 441 } 442 if (!empty($point['cellLimits'])) { 443 $pointObject['max_weight'] = intval($point['cellLimits']['maxWeight'] ?? 0); 444 $pointObject['max_cell_width'] = intval($point['cellLimits']['maxCellWidth'] ?? 0); 445 $pointObject['max_cell_height'] = intval($point['cellLimits']['maxCellHeight'] ?? 0); 446 $pointObject['max_cell_length'] = intval($point['cellLimits']['maxCellLength'] ?? 0); 447 $pointObject['gabs_hash'] = \Fivepost_Shipping_Method::makeDimensionsHash( 448 $pointObject['max_cell_width'], 449 $pointObject['max_cell_height'], 450 $pointObject['max_cell_length'] 451 ); 452 } 453 if (!empty($point['lastMileWarehouse'])) { 454 $pointObject['last_mile_warehouse_id'] = self::clearValueFromDB($point['lastMileWarehouse']['id'] ?? ''); 455 $pointObject['last_mile_warehouse_name'] = self::clearValueFromDB($point['lastMileWarehouse']['name'] ?? ''); 456 } 457 $values[] = $pointObject; 505 458 506 459 if (!empty($point['rate'])) { 507 460 global $wpdb; 508 461 foreach ($point['rate'] as $r) { 509 $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->base_prefix}fivepost_tarifs` WHERE `tname` = %s;", $r['rateType']));510 if (!$row) $wpdb->insert($wpdb->base_prefix .'fivepost_tarifs',['tname'=>$r['rateType']]);462 $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->base_prefix}fivepost_tarifs` WHERE `tname` = %s;", $r['rateType'])); 463 if (!$row) $wpdb->insert($wpdb->base_prefix . 'fivepost_tarifs', ['tname' => $r['rateType']]); 511 464 } 512 465 } 513 466 } 514 $coltypes =[515 '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',516 '%s', '%s','%s','%s','%s','%s','%f','%f','%s','%d',517 '%d', '%d','%d','%d','%d','%s','%s','%d','%d','%d',518 '%s', '%s','%d','%s','%s','%s','%s'467 $coltypes = [ 468 '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 469 '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%s', '%d', 470 '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%d', '%d', '%d', 471 '%s', '%s', '%d', '%s', '%s', '%s', '%s' 519 472 ]; 520 if (!empty($values)) { //correct bugs in points473 if (!empty($values)) { //correct bugs in points 521 474 global $wpdb; 522 for ($i =0;$i<=count($values)-1;$i++) {475 for ($i = 0; $i <= count($values) - 1; $i++) { 523 476 foreach ($values[$i] as &$vl) { 524 $vl = preg_replace('/\r/', '',$vl);525 $vl = preg_replace('/\n/', '',$vl);477 $vl = preg_replace('/\r/', '', $vl); 478 $vl = preg_replace('/\n/', '', $vl); 526 479 } 527 480 unset($vl); 528 481 } 529 foreach ($values as $val) $wpdb->replace($wpdb->base_prefix .'fivepost_pickup_points',$val,$coltypes);482 foreach ($values as $val) $wpdb->replace($wpdb->base_prefix . 'fivepost_pickup_points', $val, $coltypes); 530 483 } 531 484 532 wp_send_json([ 533 'ans' => true, 534 'isf' => $is_first, 535 'isl' => $is_last, 536 'pgn' => $curpg+1, 537 'tot' => $totalpgs 538 ]); 539 485 $loadPointResult['ans'] = true; 540 486 } else { 541 wp_send_json([ 542 'ans' => false, 543 'code'=>-2 //Error or NoData 544 ]); 545 wp_die(); 487 $loadPointResult['ans'] = false; 488 $loadPointResult['code'] = -2; //Error or NoData 546 489 } 547 548 549 490 } else { 550 wp_send_json([ 551 'ans' => false, 552 'code'=>-1 //not configured 553 ]); 554 wp_die(); 555 } 556 557 558 559 wp_send_json([ 560 'ans' => true 561 ]); 562 wp_die(); 491 $loadPointResult['ans'] = false; 492 $loadPointResult['code'] = -1; //not configured 493 } 494 495 return $loadPointResult; 496 } 497 498 private static function clearValueFromDB($string) { 499 return addslashes(preg_replace("/[\"|\\\\]/", '', $string)); 563 500 } 564 501 -
fivepost/trunk/classes/shipping.class.php
r3061801 r3352162 9 9 10 10 class Fivepost_Shipping_Method extends \WC_Shipping_Method { 11 12 const API_DIMENSION_UNIT = 'cm'; 13 const API_WEIGHT_UNIT = 'g'; 11 14 12 15 const SHIPPING_METHOD_ID = 'fivepost_shipping_method'; … … 476 479 477 480 for ($i = 1; $i <= $item['quantity']; $i++) { 478 $cargoItemWeight = wc_get_weight($product->get_weight(), 'g');479 $cargoItemLength = $product->get_length();480 $cargoItemWidth = $product->get_width();481 $cargoItemHeight = $product->get_height();481 $cargoItemWeight = intval(round(wc_get_weight(floatval($product->get_weight()), self::API_WEIGHT_UNIT, get_option('woocommerce_weight_unit', 'g') ))); 482 $cargoItemLength = intval(round(wc_get_dimension(floatval($product->get_length()), self::API_DIMENSION_UNIT, get_option('woocommerce_dimension_unit', 'mm') ))); 483 $cargoItemWidth = intval(round(wc_get_dimension(floatval($product->get_width()), self::API_DIMENSION_UNIT, get_option('woocommerce_dimension_unit', 'mm') ))); 484 $cargoItemHeight = intval(round(wc_get_dimension(floatval($product->get_height()), self::API_DIMENSION_UNIT, get_option('woocommerce_dimension_unit', 'mm') ))); 482 485 483 486 if(empty($cargoItemWeight)) 484 $cargoItemWeight = (float) wc_get_weight($this->get_option('default_item_weight'), 'g', 'kg');487 $cargoItemWeight = intval(wc_get_weight($this->get_option('default_item_weight'), 'g', 'kg')); 485 488 if(empty($cargoItemLength)) 486 $cargoItemLength = (float)$this->get_option('default_item_length');489 $cargoItemLength = floatval($this->get_option('default_item_length')); 487 490 if(empty($cargoItemWidth)) 488 $cargoItemWidth = (float)$this->get_option('default_item_width');491 $cargoItemWidth = floatval($this->get_option('default_item_width')); 489 492 if(empty($cargoItemHeight)) 490 $cargoItemHeight = (float)$this->get_option('default_item_height');493 $cargoItemHeight = floatval($this->get_option('default_item_height')); 491 494 492 495 $cargoItem = new CargoItem(); … … 599 602 private function _prepare_points_filter($shipment, $destination) { 600 603 $filter = [ 601 '(date_sync >= \''.(new \DateTime())->modify('-10 day')->format('Y-m-d').'\')'604 //'(date_sync >= \''.(new \DateTime())->modify('-10 day')->format('Y-m-d').'\')' 602 605 ]; 603 606 -
fivepost/trunk/files/.htaccess
r3061801 r3352162 1 -
fivepost/trunk/fivepost.php
r3344658 r3352162 4 4 Plugin URI: 5 5 Description: 5Post — федеральный логистический сервис, дочернее подразделение X5 Group. Мы осуществляем доставку заказов из интернет-магазинов и маркетплейсов наших партнеров в пункты выдачи заказов и постаматы в магазинах "Пятёрочка" или "Перекрёсток". 6 Version: 1.0. 66 Version: 1.0.7 7 7 Author URI: https://ipol.ru 8 8 Text Domain: fivepost-wp … … 16 16 exit; // Exit if accessed directly 17 17 18 const FIVEPOST_PLUGIN_VERSION = '1.0. 6';18 const FIVEPOST_PLUGIN_VERSION = '1.0.7'; 19 19 const FIVEPOST_PLUGIN_REQUIRES = '5.0'; 20 20 const FIVEPOST_PLUGIN_TESTED = '5.8.2'; -
fivepost/trunk/readme.txt
r3344658 r3352162 5 5 Requires at least: 5.0.0 6 6 Tested up to: 5.9.3 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 51 51 == Frequently Asked Questions == 52 52 53 Вы можете получить поддержку, оставить обращение на портале партнера <https://fivepost.ru/partners-portal/requests>, тематика: "Вопросы по интеграции"53 Вы можете получить поддержку, оставить обращение на портале партнера <https://fivepost.ru/partners-portal/requests>, тематика: "Вопросы по интеграции" 54 54 55 55 = Не сохраняются настройки модуля =
Note: See TracChangeset
for help on using the changeset viewer.