scottcwilson / zencart_fedexrest

Zen Cart shipping module for FedEx, using the new RESTful API.
Other
0 stars 3 forks source link

Display Ground Economy (smartpost) #4

Open njcyx opened 10 months ago

njcyx commented 10 months ago

Not sure if anyone use it other than me, again.

Add the following code near line 194 if (MODULE_SHIPPING_FEDEX_REST_GROUND_ECONOMY == 'true') { $this->types['SMART_POST'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_REST_HANDLING_FEE);

Under unction install(), add the following code. $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Ground Economy', 'MODULE_SHIPPING_FEDEX_REST_GROUND_ECONOMY', 'true', 'Enable FedEx Ground', '6', '57', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");

$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('FedEx Hub ID (Ground Economy)', 'MODULE_SHIPPING_FEDEX_REST_HUB_ID', '', 'Enter FedEx Hub ID', '6', '3', now())");

Under function keys(), add the following code. 'MODULE_SHIPPING_FEDEX_REST_GROUND_ECONOMY',

Two important changes:

  1. Under $rate_data section, add if (MODULE_SHIPPING_FEDEX_REST_GROUND_ECONOMY == 'true') { $rate_data ["requestedShipment"]["smartPostInfoDetail"] = [ "hubId" => MODULE_SHIPPING_FEDEX_REST_HUB_ID, "indicia" => "PARCEL_SELECT", ];

  2. Near line 414. Change from "carrierCodes" => ["FDXG", "FDXE"], to "carrierCodes" => ["FDXG", "FDXE", "FXSP"],

This point is very important, otherwise there is no quote for smartpost.

scottcwilson commented 9 months ago

Deferring for now.

njcyx commented 6 months ago

Also, near line 328, change the following line:

$this->fedex_shipping_weight = $shipping_weight;

To

$this->fedex_shipping_weight = ($shipping_weight < 1 ? 1 : $shipping_weight);

The minimum weight for ground economy is 1 lb. When weight is lower than 1 lb, I can still get a quote but the rate is incorrect (much higher).