Page 1 of 1

Amazon-style Expected Delivery Date

Posted: Mon Jul 23, 2018 9:07 pm
by OC2PS
Go to Extension page

Purpose
OpenCart allows showing stock status on product page by default. However, 7-14 days still requires a bit of "decoding". Besides, what does "Stock status: 7-14 days" really mean? Does it mean that shop will ship in 7-14 days or does it mean that customer will receive in 7-14 days?

We would like to make things simpler for the customers. We want an extension that shows expected delivery date (range) upfront. No ambiguity. No confusion.

For each product, this extension will determine the expected date range of delivery, similar to what Amazon does on product pages, and order confirmation emails.

Made for
The extension has been written for the OpenCart Default theme, and should work with most themes that follow the same structure, nomenclature, etc.
Compatible with
Image

Installation v 3.0+ and Update
  • Upload the ocmod archive at Extensions > Extensions Installer.
  • Visit Extensions > Modifications and hit Refresh.
  • Visit Extensions > Extensions, Modules, hit Install next to Expected Delivery Date.
    Extensions EDD.png

    Extensions EDD.png (42.84 KiB) Viewed 4019 times

Setup
  • On Extensions > Extensions > Modules, hit Edit next to Expected Delivery Date.
  • Fill up the details (in days) for each status and geo zone.
    Expected Delivery Date.png

    Expected Delivery Date.png (135.27 KiB) Viewed 4019 times

Frequently Asked Questions
  1. Does this extension work with my theme? It has been developed for OpenCart Default theme, and should work with most themes that use the same structure.
  2. Does this extension work with Journal 2 theme? Yes!
  3. Does this extension work with OpenCart 3.x? Yes.
  4. Does this extension work with OpenCart 1.x/2.x? No. And no plans either.
  5. The extension adds date to product page but not to customer order email. You are using some extension that modifies emails being sent. If you use Power Email Editor to create beautiful custom emails, add the mergetag

    Code: Select all

    {{expected_delivery}}
    in the email template where you'd like the expected delivery date to appear. If you use some other extension for editing emails, you'll need to ask the author of that extension to not mess with the default email.
  6. I have an idea. Great! Post it as a reply to this thread.
  7. I am having a problem with this extension. Please click Get Support on this page.
Screenshots

Stock theme
iMac.png

iMac.png (82.62 KiB) Viewed 4019 times

Journal 2 theme
iMac Journal.png

iMac Journal.png (181.56 KiB) Viewed 4019 times


Re: Amazon-style Expected Delivery Date

Posted: Thu Jun 04, 2020 1:57 am
by Hug
hi.if i buy the extension is there anyone here for support?

Re: Amazon-style Expected Delivery Date

Posted: Wed Jun 17, 2020 8:09 pm
by head_dunce
Is there a demo of this somewhere I can see? Not sure why the opencart marketplace has images that are so small you can't read them.

Re: Amazon-style Expected Delivery Date

Posted: Sat Jun 27, 2020 6:50 pm
by head_dunce
I made some slight modifications to the extension, and it's doing exactly as I want now. Thank you.

Re: Amazon-style Expected Delivery Date

Posted: Sun Feb 28, 2021 9:48 am
by head_dunce
I'm experimenting with this further and now have the expected delivery showing on the checkout page which is HUGE for me. This will clear up a LOT of customer calls and emails. Here's where I'm at on a dev server

Code: Select all

/var/www/html/catalog/view/theme/journal3/template/journal3/checkout/cart.twig
AFTER
<small v-if="product.recurring" v-html="product.recurring"></small>
PUT
<br v-if="product.expected_delivery"/>
<span v-if="product.expected_delivery" v-html="product.expected_delivery"></span>

#######################################################

/var/www/html/system/library/cart/cart.php
public function getProducts()
- add in the stock_status_id
AFTER
'recurring'       => $recurring
PUT
,
'stock_status_id' => $product_query->row['stock_status_id']

#######################################################

/var/www/html/catalog/controller/journal3/checkout.php
- load modules
- add function for date format
- add code to calculate

AFTER
$this->load->language('checkout/checkout');
PUT
		$this->load->language('extension/module/estimate_delivery_date');
		$this->load->model('catalog/product');
---------------------------------------------------------------
BEFORE
private function products() {
PUT
	private static function dateFormatToStrftime($dateFormat) {
		$caracs = array(
			'd' => '%d', 'D' => '%a', 'j' => '%e', 'l' => '%A', 'N' => '%u', 'w' => '%w', 'z' => '%j',
			// Removing S
			'S' => 'th',
			'W' => '%V',
			'F' => '%B', 'm' => '%m', 'M' => '%b',
			'o' => '%G', 'Y' => '%Y', 'y' => '%y',
			'a' => '%P', 'A' => '%p', 'g' => '%l', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S',
			'O' => '%z', 'T' => '%Z',
			'U' => '%s'
		);
		return strtr((string)$dateFormat, $caracs);
	}
---------------------------------------------------------------
BEFORE 
$result[] = array(
PUT
			$days = unserialize($this->config->get('module_estimate_delivery_date_data'));
			$estimate_stock = array("min" => $days['stock_status'][$product['stock_status_id']]['min'],
						"max" => $days['stock_status'][$product['stock_status_id']]['max'],
			);
			$geo_zone_id = $this->model_catalog_product->getGeoZoneId();
			$sort_order = false;
			foreach($days['shipping_method'] as $key => $method){
				if($sort_order === false || $sort_order > $this->config->get($key . '_sort_order')){
					$sort_order = $this->config->get($key . '_sort_order');
					$estimate_shipping = array('min' => $method['geo_zone'][$geo_zone_id]['min'], 'max' => $method['geo_zone'][$geo_zone_id]['max']);
				}
			}
			$expected_delivery = '';
			if( ( $estimate_stock['min'] >=0 )&&( $estimate_stock['max'] > 0 ) ){
				$locale = $this->model_catalog_product->getLanguageLocale();
				setlocale(LC_TIME, array_reverse(explode(",", $locale)));
				$expected_delivery = 'Estimated delivery: ';
				$expected_delivery .= utf8_encode(strftime($this->dateFormatToStrftime($this->language->get('date_format_long')), strtotime("+".($estimate_stock['min']+$estimate_shipping['min'])." weekdays")));
				$expected_delivery .= " - ".utf8_encode(strftime($this->dateFormatToStrftime($this->language->get('date_format_long')), strtotime("+".($estimate_stock['max']+$estimate_shipping['max'])." weekdays")));
				
			}
---------------------------------------------------------------
AFTER
'thumb2x'    => $thumb2x,
PUT
'expected_delivery' => $expected_delivery


It looks like I can also use the order comments to put the expected delivery range on the order itself (emails and login info.) We follow up on orders with API calls from another system I wrote that gives expected ship dates, so between the two the customers should be well informed cutting down on a lot of questions. Still working on this, but this is HUGE for my company. Thank you!