Post by wafflemeister » Fri May 17, 2019 12:39 am

I am using an old version of FedEx Global Live Rates on OpenCart 1.5.6.4. The extension has the ability to show the Estimated delivery date, which seems to have flaws when estimating delivery dates over weekends. At this point I prefer to show something like '3 Business Days' rather than trying to show dates to not upset customers. Can the below code be modified to do this? Thank you in advance.

Code: Select all

				if ($this->config->get($classname . '_' . $service) != '1') { continue; }

			    $package_count = '';
				if ($this->config->get($classname . '_package_count')) {
					$package_count = ' (' . ($rate['Package_Count'] . $this->language->get('text_pkg')) . ')';
				}

				$delivery_time = '';
				if ($this->config->get($classname . '_transit')) {
					if (!empty($rate['Transit']) && $rate['Transit'] != 'UNKNOWN') {
						if (strpos($rate['Transit'], 'DAY') !== false) {
							$xtransitTime = $transitTime[$rate['Transit']];
						} else {
							$xtransitTime = strtotime($rate['Transit']);
						}

						// Prevent weekends
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						} else {
							// Cutoff Time. Add day to shipping
							if (is_numeric($this->config->get('fedex_wsdl_cutoff'))) {
								if ((int)date('H') > (int)$this->config->get('fedex_wsdl_cutoff') || date('H') == '00') {
									$xtransitTime += 86400;
								}
							}
						}

						// Customer says I need to do this again to handle 3 day select issue for orders on wednesday
						// Not sure why yet. Haven't looked. But if it works, that's all that matters for now
						// Prevent weekends - Cleanup + Fridays
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						}


						$delivery_time =  ' (' . ($this->language->get('text_delivery_time') . date($this->language->get('date_format_short'), $xtransitTime)) . ')';
					}
				}

Active Member

Posts

Joined
Fri Jun 21, 2013 11:10 pm

Post by straightlight » Sat May 18, 2019 12:05 am

Create a new service request in the Commercial Support section of the forum to get this done as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by khnaz35 » Fri May 15, 2020 3:44 pm

wafflemeister wrote:
Fri May 17, 2019 12:39 am
I am using an old version of FedEx Global Live Rates on OpenCart 1.5.6.4. The extension has the ability to show the Estimated delivery date, which seems to have flaws when estimating delivery dates over weekends. At this point I prefer to show something like '3 Business Days' rather than trying to show dates to not upset customers. Can the below code be modified to do this? Thank you in advance.

Code: Select all

				if ($this->config->get($classname . '_' . $service) != '1') { continue; }

			    $package_count = '';
				if ($this->config->get($classname . '_package_count')) {
					$package_count = ' (' . ($rate['Package_Count'] . $this->language->get('text_pkg')) . ')';
				}

				$delivery_time = '';
				if ($this->config->get($classname . '_transit')) {
					if (!empty($rate['Transit']) && $rate['Transit'] != 'UNKNOWN') {
						if (strpos($rate['Transit'], 'DAY') !== false) {
							$xtransitTime = $transitTime[$rate['Transit']];
						} else {
							$xtransitTime = strtotime($rate['Transit']);
						}

						// Prevent weekends
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						} else {
							// Cutoff Time. Add day to shipping
							if (is_numeric($this->config->get('fedex_wsdl_cutoff'))) {
								if ((int)date('H') > (int)$this->config->get('fedex_wsdl_cutoff') || date('H') == '00') {
									$xtransitTime += 86400;
								}
							}
						}

						// Customer says I need to do this again to handle 3 day select issue for orders on wednesday
						// Not sure why yet. Haven't looked. But if it works, that's all that matters for now
						// Prevent weekends - Cleanup + Fridays
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						}


						$delivery_time =  ' (' . ($this->language->get('text_delivery_time') . date($this->language->get('date_format_short'), $xtransitTime)) . ')';
					}
				}
what is the extension name or url to download ?

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by straightlight » Fri May 15, 2020 6:51 pm

khnaz35 wrote:
Fri May 15, 2020 3:44 pm
wafflemeister wrote:
Fri May 17, 2019 12:39 am
I am using an old version of FedEx Global Live Rates on OpenCart 1.5.6.4. The extension has the ability to show the Estimated delivery date, which seems to have flaws when estimating delivery dates over weekends. At this point I prefer to show something like '3 Business Days' rather than trying to show dates to not upset customers. Can the below code be modified to do this? Thank you in advance.

Code: Select all

				if ($this->config->get($classname . '_' . $service) != '1') { continue; }

			    $package_count = '';
				if ($this->config->get($classname . '_package_count')) {
					$package_count = ' (' . ($rate['Package_Count'] . $this->language->get('text_pkg')) . ')';
				}

				$delivery_time = '';
				if ($this->config->get($classname . '_transit')) {
					if (!empty($rate['Transit']) && $rate['Transit'] != 'UNKNOWN') {
						if (strpos($rate['Transit'], 'DAY') !== false) {
							$xtransitTime = $transitTime[$rate['Transit']];
						} else {
							$xtransitTime = strtotime($rate['Transit']);
						}

						// Prevent weekends
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						} else {
							// Cutoff Time. Add day to shipping
							if (is_numeric($this->config->get('fedex_wsdl_cutoff'))) {
								if ((int)date('H') > (int)$this->config->get('fedex_wsdl_cutoff') || date('H') == '00') {
									$xtransitTime += 86400;
								}
							}
						}

						// Customer says I need to do this again to handle 3 day select issue for orders on wednesday
						// Not sure why yet. Haven't looked. But if it works, that's all that matters for now
						// Prevent weekends - Cleanup + Fridays
						if (date('D', $xtransitTime) == 'Sat') {
							$xtransitTime += (86400*2);
						} elseif (date('D', $xtransitTime) == 'Sun') {
							$xtransitTime += 86400;
						}


						$delivery_time =  ' (' . ($this->language->get('text_delivery_time') . date($this->language->get('date_format_short'), $xtransitTime)) . ')';
					}
				}
what is the extension name or url to download ?
If the extension does NOT involve a license!

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 19 guests