Changeset 2650104
- Timestamp:
- 12/28/2021 05:46:29 PM (4 years ago)
- File:
-
- 1 edited
-
shiip/trunk/shiip.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shiip/trunk/shiip.php
r2636352 r2650104 17 17 * Plugin URI: https://app.goshiip.com/ 18 18 * Description: The only shipping app you will ever need for your business. You can “Shiip” with top logistics companies at half their standard rates 19 * Version: 1.0. 319 * Version: 1.0.4 20 20 * Author: Shiip LLC 21 21 * Author URI: https://goshiip.com/ … … 40 40 * Rename this for your plugin and update it as you release new versions. 41 41 */ 42 define( 'SHIIP_VERSION', '1.0. 3' );42 define( 'SHIIP_VERSION', '1.0.4' ); 43 43 44 44 … … 914 914 } 915 915 } 916 917 class WC_ShiipMethod_JUMIA extends WC_Shipping_Method { 918 /** 919 * Constructor for your shipping class 920 * 921 * @access public 922 * @return void 923 */ 924 public function __construct() { 925 $this->id = 'JUMIA'; 926 $this->init(); 927 } 928 929 /** 930 * Init your settings 931 * 932 * @access public 933 * @return void 934 */ 935 public function init() { 936 } 937 /** 938 * calculate_shipping function. 939 * 940 * @access public 941 * @param mixed $package 942 * @return void 943 */ 944 public function calculate_shipping($package = array()) { 945 946 947 $rates = getRates("jumia",$package); 948 949 $parse = json_decode($rates); 950 951 $kwikamt = "0"; 952 $estDays = "Same Day Delivery"; 953 954 $redisKey = ""; 955 $rateId = ""; 956 957 958 959 if($parse->data->rates == null){ 960 return ; 961 } 962 963 $redisKey = $parse->data->redis_key; 964 965 966 $rate = $parse->data->rates; 967 968 if($rate->currency == "NGN"){//only show ngn 969 970 $estDays = "Same Day Delivery"; 971 972 973 if($rate->estimated_days == null){ 974 $kwikamt = $rate->amount; 975 }else{ 976 $estDays = $rate->estimated_days; 977 $kwikamt = $rate->amount; 978 } 979 980 $rateId = $rate->courier->id; 981 982 } 983 984 985 $rate = array( 986 'id' => "JUMIA", 987 'label' => "JUMIA - " .$estDays, 988 'cost' => $kwikamt, 989 'calc_tax' => 'per_item', 990 'meta_data' => array("rateId" => $rateId,"redisKey" => $redisKey) 991 ); 992 993 994 // Register the rate 995 if(isset($kwikamt) && $kwikamt != NULL && $kwikamt > 0){ 996 $this->add_rate($rate); 997 } 998 } 999 } 916 1000 917 1001 } … … 924 1008 //for now this plugin is for only nigerian vendors 925 1009 926 $methods['shiip'] = 'WC_ShiipMethod';1010 // $methods['shiip'] = 'WC_ShiipMethod'; 927 1011 $methods['shiipDHL'] = 'WC_ShiipMethod_DHL'; 928 $methods['shiipFEDEX'] = 'WC_ShiipMethod_FEDEX'; 1012 $methods['shiipJUMIA'] = 'WC_ShiipMethod_JUMIA'; 1013 // $methods['shiipFEDEX'] = 'WC_ShiipMethod_FEDEX'; 929 1014 // $methods['shiipGIG'] = 'WC_ShiipMethod_GIG'; 930 $methods['shiipKXPRESSBIKE'] = 'WC_ShiipMethod_KONGABIKE';1015 // $methods['shiipKXPRESSBIKE'] = 'WC_ShiipMethod_KONGABIKE'; 931 1016 $methods['shiipKXPRESSVAN'] = 'WC_ShiipMethod_KONGAVAN'; 932 1017 // remove gokada for now $methods['shiipGOKADA'] = 'WC_ShiipMethod_GOKADA';
Note: See TracChangeset
for help on using the changeset viewer.