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)) . ')';
					}
				}

New 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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


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 3 guests