Forums / Addon Shipping Modules / Interlink /Geopost Ship@Ease Export Module for Zen

Interlink /Geopost Ship@Ease Export Module for Zen

Results 1 to 20 of 22
30 Sep 2007, 09:20
#1
calljj avatar

calljj

Zen Follower

Join Date:
Mar 2007
Posts:
253
Plugin Contributions:
2

Interlink /Geopost Ship@Ease Export Module for Zen

If anyone is interested i have written a file export module that can be used to create the automated files required by the Interlink/Geopost group Ship@Ease software.

If there is interest i will submit for the downloads area.

Kind Regards

James

www.janetsystems.com
30 Sep 2007, 14:18
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi James, I believe that there will be interest in this, and that this too would be well worth submitting to the downloads section.
01 Oct 2007, 10:39
#3
calljj avatar

calljj

Zen Follower

Join Date:
Mar 2007
Posts:
253
Plugin Contributions:
2

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Now available to download!

As i've written in the notes, i wrote this to fulfill my needs, not the masses, but will provide a great easy starting point to go from.
01 Oct 2007, 17:34
#4
garyclay avatar

garyclay

New Zenner

Join Date:
Jun 2007
Posts:
3
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi James,

We are really interested in using your module.

We currently use the web interface for ship@ease through Interlink Express and I was unaware there was a standalone system for this.

Did you have to request to use the standalone programme rather than the web interface?

I asked Geopost customer automation but they seemed a little vague on getiing setup with this and said we would need an engineer to come and install the software.
06 Oct 2008, 13:40
#5
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Long time since anyone has commented on this thread .. but

I have just installed the mod and hoping to use it with a new project ,
I have configured the shipping status to only go when its at level 2 processing . but it creates a file for an order that is still at Pending.

am I missing something ?

Thanks for any info.
07 Oct 2008, 09:23
#6
calljj avatar

calljj

Zen Follower

Join Date:
Mar 2007
Posts:
253
Plugin Contributions:
2

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Probably around line 75 in the shipease.php file

change the line
if ($statustoship <SHIP_EASE_STATUS)


to

if ($statustoship = SHIP_EASE_STATUS)


Set the number that you wish to use for creating the files, i.e 1 normally is recieved orders, 2 is processing, 3 is dispatched etc.

Hope this helps,

James
07 Oct 2008, 14:37
#7
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Thanks for the quick reply , gave me the hint I needed .

changed the line 75 to

[PHP]if ($statustoship == SHIP_EASE_STATUS) {[/PHP]

Also removed some unwanted fields , now ready to implement shi@ease THANK YOU
26 Oct 2008, 20:01
#8
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

I wonder is anyone can help out with some php Logic Syntax ? ( php not my strong point ! )
I am having to adjust my SHip at ease output so that it does not include orders we are going to ship via royalmail .

So I have added the line [php]$shiptype = $orders->fields['shipping_module_code'];[/php]
I now need to do a compare on that value .. so if $shiptype does not equal "royalmail"
thats the bit I am strugling on ... :blush:

[php]if ($statustoship == SHIP_EASE_STATUS) and ($shiptype != "royalmail") {[/php]

Yep my syntax sucks and it errors.:blush:

thanks.
27 Oct 2008, 21:33
#9
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

solved it myself again !

just missing some brackets it seems ...
[PHP]
if (($statustoship == SHIP_EASE_STATUS) and ($shiptype != "free")) { [/PHP]

so now you could export your interlink file for only certain shipping types.
03 Nov 2008, 16:02
#10
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Does anyone fancy re writing the export part of this mod to create the file in true CSV ?

I have made as many modifications to is as I can , but stuck on creating the true CSV format so that the ship@ease program will recognise it without me importing into excel first and then saving as CSV .

I think it could be as simple as adding in the line breaks but cant work out where to put this in .

Get in touch .

MARK
21 Nov 2008, 09:59
#11
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

If anyone is interested , or having Interlink do their shipping , I have now altered the original mod to create a true CSV file that the ship@ease client accepts , alo included order comments on the outputted labels , and give you the option to only print labels for certain shipment types.

James or Calljj still gets the respect he deserves for creating this original mod, I have simply altered it with help from the IT guys at Interlink to fit thier product.
05 Feb 2009, 10:57
#12
pekler avatar

pekler

New Zenner

Join Date:
Feb 2009
Posts:
1
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi,

I am trying to do the same thing myself at the moment. Do you have the module you have worked on publicly available? I spotted this mod:- Geopost/Interlink SHIP@EASEIintegration, but it hasn't been updated since 2007.

There dosnt seem to be a great deal of open source out there yet to work with Interlink Express.

Mik
05 Feb 2009, 13:59
#13
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Here is the altered file , its set up for how I need to use it , but its commented in places and pretty generic anyway. Any problems let me know and I will see if I can help. [PHP]<?php
/**
* shipease.php
*
* @package ship @ ease
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @copyright Portions Copyright 2003 Andrew Berezin
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: shipease.php, v 1.0 15.8.2007 5:54 James Fitch [email protected]$

/*

TODO List

*/
require('includes/application_top.php');

@define('SHIP_EASE_DIRECTORY', 'ship/');
@define('SHIP_EASE_OUTPUT_BUFFER_MAXSIZE', 1024*1024);
@define('SHIP_EASE_USE_CPATH', 'false');

define('NL', "<br />\n");

$count=0;

require(zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] .'/', 'shipease.php', 'false'));

echo TEXT_SHIP_EASE_STARTED . NL;
echo TEXT_SHIP_EASE_FILE_LOCATION . DIR_FS_CATALOG . SHIP_EASE_DIRECTORY . SHIP_EASE_OUTPUT_FILENAME . NL;

if (isset($_GET['feed']) && $_GET['feed'] == "yes") {
if (is_dir(DIR_FS_CATALOG . SHIP_EASE_DIRECTORY)) {
if (!is_writeable(DIR_FS_CATALOG . SHIP_EASE_DIRECTORY)) {
echo ERROR_SHIP_EASE_DIRECTORY_NOT_WRITEABLE . NL;
die;
}
} else {
echo ERROR_SHIP_EASE_DIRECTORY_DOES_NOT_EXIST . NL;
die;
}

$stimer_feed = microtime_float();
@set_time_limit(0);

$output_buffer = "";

if(!zen_ship_fwrite('', 'open')) {
echo ERROR_SHIP_EASE_OPEN_FILE . NL;
die;
}



$orders_query = "SELECT *
FROM " . TABLE_ORDERS . "
ORDER BY orders_id ASC";


$stimer = microtime_float();
$orders = $db->Execute($orders_query);
$timer['$orders->mySQL'] += microtime_float()-$stimer;

while (!$orders->EOF) {

$statustoship=$orders->fields['orders_status'];
$datestatus = $orders->fields['date_purchased'];
$shiptype = $orders->fields['shipping_module_code'];

$sum=0;
$totalweight =0;



//if ($statustoship <SHIP_EASE_STATUS) { this was the original line
// the next line means it only creates the file for those orders set to SHIP_EASE_STATUS ( processing )
if ($statustoship == SHIP_EASE_STATUS) {
//if (($statustoship == SHIP_EASE_STATUS) and ($shiptype != "rm1stpacketsf")) { I use this to not ship stuff sent royalmail

$orderid=$orders->fields['orders_id'];

$proid_query="SELECT *
FROM " . TABLE_ORDERS_PRODUCTS . " as t1 WHERE t1.orders_id = $orderid";
// next line grabs the comments to output on the interlink labels
$comments_query ="SELECT comments FROM orders_status_history WHERE `orders_id` = $orderid ORDER BY orders_status_history_id
LIMIT 1";


$Orderedproduct = $db->Execute($proid_query);
// sum total weight

while (!$Orderedproduct->EOF) {

$prodid = $Orderedproduct->fields['products_id'];
$prodnum = $Orderedproduct->fields['products_quantity'];

$Ordercomments = $db->Execute($comments_query);
$actualcomment1 = substr($Ordercomments->fields['comments'], 0, 25);$Ordercomments->fields['comments'];
$actualcomment2 = substr($Ordercomments->fields['comments'], 25, 25);$Ordercomments->fields['comments'];

$proids_query="SELECT *
FROM " . TABLE_PRODUCTS." as t2 WHERE t2.products_id = $prodid ";

$Orderedproductweight = $db->Execute($proids_query) ;

$sum = $Orderedproductweight->fields['products_weight'];

$sum=$sum * $prodnum;

$totalweight=$totalweight+$sum;


$Orderedproduct->MoveNext();

}


if ($totalweight > SHIP_EASE_MINWEIGHT) {
if ($totalweight < SHIP_EASE_MAXWEIGHT) {






$stimer = microtime_float();

$orderref=$orders->fields['orders_id'];

$output = array();
$output["orderid"]="000$orderref";
$output["jobtype"]= SHIP_EASE_JOB;
$output["custacc"]= SHIP_EASE_ACC;
$output["title"] = zen_ship_sanita($orders->fields['customers_name'], true);
$output["address1"] = zen_ship_sanita($orders->fields['delivery_street_address']);
$output["address2"] = zen_ship_sanita($orders->fields['delivery_suburb']);
$output["town"] = zen_ship_sanita($orders->fields['delivery_city']);
$output["county"] = zen_ship_sanita($orders->fields['delivery_state']);
$output["Postcode"] = zen_ship_sanita($orders->fields['delivery_postcode']);
$output["Instructions"] = zen_ship_sanita($actualcomment1);
$output["Instructions2"] = zen_ship_sanita($actualcomment2);
$output["Qtyoflabels"] = SHIP_EASE_QUAN;
$output["Service"] =SHIP_EASE_CODE ;
//$output["Timeslot"] ="" ;
//$output["total_weight"] = $totalweight;
$output["total_weight"] = 1; // I set the total weight to 1kg but you can have this as teh line above
$output["Delivery_date"] = $orders->fields['date_purchased'];
$output["User_Field_1"] = zen_ship_sanita(SHIP_EASE_INFO);
$output["User_Field_2"] ="";
$output["Workstn"] ="";
$output["Email"] =zen_ship_sanita($orders->fields['customers_email_address']);
$output["Email2"] ="";
$output["Telephone"] =SHIP_EASE_TEL;
$output["Contact"] ="";
$output["Description"] ="";
$output["Currency"] ="";
$output["Consignment value"] =($orders->fields['order_total']);
$output["Country"] =zen_ship_sanita($orders->fields['delivery_country']);
$output["Insurance"] =zen_ship_sanita(SHIP_EASE_INS);
$output["Userfield 3"] ="";
$output["Userfield 4"] ="";
$output["Account"] =000;

zen_ship_fwrite($output);

$count=$count+1;

}

}

}


$stimer = microtime_float();
$orders->MoveNext();

$timer['$orders->mySQL'] += microtime_float()-$stimer;
}



zen_ship_fwrite('', 'close');

// @chmod(DIR_FS_CATALOG . SHIP_EASE_DIRECTORY . SHIP_EASE_OUTPUT_FILENAME, 0644);

$timer_feed = microtime_float()-$stimer_feed;
$percent_other = 0;
$time_other = $timer_feed;
if(SHIP_EASE_STAT === true) {
echo 'Execution time:<br />';
echo '<table cellspace="2" border="1px">';
echo '<tr><td>Function</td><td>Execution time</td><td>Percent</td></tr>';
foreach($timer as $func => $time) {
$percent_total += ($time*100)/$timer_feed;
$time_other -= $time;
echo '<tr><td>' . $func . '</td><td align="right">' . number_format($time, 6) . '</td><td align="right">' . round(($time*100)/$timer_feed, 2) . '%</td></tr>';
}
echo '<tr><td><i>Other</i></td><td align="right"><i>' . number_format($time_other, 6) . '</i></td><td align="right"><i>' . round(($time_other*100)/$timer_feed, 2) . '%</i></td></tr>';
echo '<tr><td><b>Total</b></td><td align="right"><b>' . number_format($timer_feed, 6) . '</b></td><td align="right"><b>' . round(($timer_feed*100)/$timer_feed, 2) . '%</b></td></tr>';
echo '</table>';
}
//$orders->RecordCount()
echo TEXT_SHIP_EASE_FEED_COMPLETE . ' ' . SHIP_EASE_TIME_TAKEN . ' ' . sprintf("%f " . TEXT_SHIP_EASE_FEED_SECONDS, number_format($timer_feed, 6) ) . ' ' . $count . TEXT_SHIP_EASE_FEED_RECORDS . NL;

}

function zen_ship_fwrite($output, $op='fwrite') {
global $timer;$stimer = microtime_float();
static $fp;
static $output_buffer = "";
static $title_row = false;
switch ($op) {
case 'open':
$retval = $fp = fopen(DIR_FS_CATALOG . SHIP_EASE_DIRECTORY . SHIP_EASE_OUTPUT_FILENAME, "wb");
break;
case 'fwrite':
if(!$title_row) {
$title_row = $output;
}
$buf = array();
foreach($title_row as $key=>$val) {
$buf[] = (isset($output[$key]) ? $output[$key] : '');
// var_dump($key, $output[$key]);echo '<br />';
}
$output = implode(",", $buf);
if(strlen($output_buffer) > SHIP_EASE_OUTPUT_BUFFER_MAXSIZE) {
$retval = fwrite($fp, $output_buffer, strlen($output_buffer));
$output_buffer = "";
}
//$output = rtrim($output) . "\n";
$output = rtrim($output) . "\r\n";
if(strtolower(CHARSET) != 'utf-8')
$output_buffer .= utf8_encode($output);
else
$output_buffer .= $output;
break;
case 'close':
if(strlen($output_buffer) > 0) {
$retval = fwrite($fp, $output_buffer, strlen($output_buffer));
$output_buffer = "";
}
fclose($fp);
break;
}
$timer[__FUNCTION__] += microtime_float()-$stimer;
return $retval;
}

function zen_ship_sanita($str, $rt=false) {
global $timer;$stimer = microtime_float();
$str = strip_tags($str);
$str = str_replace(array("\t" , "\n", "\r"), ' ', $str);
$str = str_replace(",", " ", $str);
$str = preg_replace('/\s\s+/', ' ', $str);
// $str = str_replace(array("®", "®", "©", "©", "™", "™"), ' ', $str);
$str = htmlentities(html_entity_decode($str));
$in = $out = array();
$in[] = "®"; $out[] = '(r)';
$in[] = "©"; $out[] = '(c)';
$in[] = "™"; $out[] = '(tm)';
// $str = str_replace($in, $out, $str);
if($rt) $str = str_replace(array('>'), ' ', $str);
$str = trim($str);
//$str = "\"$str\"";

$timer[__FUNCTION__] += microtime_float()-$stimer;
return $str;
}


function ftp_get_error_from_ob() {
$out = ob_get_contents();
ob_end_clean();
$out = str_replace(array('\\', '<!--error-->', '<br>', '<br />', "\n", 'in <b>'),array('/', '', '', '', '', ''),$out);
if(strpos($out, DIR_FS_CATALOG) !== false){
$out = substr($out, 0, strpos($out, DIR_FS_CATALOG));
}
return $out;
}

function microtime_float() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
?>[/PHP]
16 May 2011, 18:15
#14
dunk avatar

dunk

Zen Follower

Join Date:
Dec 2007
Posts:
184
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi,

Someone asked this earlier in the thread but I couldn't see a reply...

Is this mod in any way compatible with Interlink's Ship@Ease online system or do we need to use their standalone software? We were never offered this software when we switched to Interlink but I guess it's available from their IT dept.

We've been manually entering details into the online version of Interlink's Ship@Ease system for a while but order volumes have reached the point where we really need to automate the process.
26 Jan 2012, 10:16
#15
davx avatar

davx

New Zenner

Join Date:
Nov 2009
Posts:
80
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

A bit late but you can download the most up-to-date version from here...http://www.stevedunne.co.uk/dsl/index.htm (the creator)

Along with good interfacing guides. You will however need to contact interlink/dpd/geopost for master access codes to input your contract/acc number, label settings etc.

we took our own tack and set up buttons within the orders to simply extract the address information and service from the database, then used ssh2 for php extension to directly send the files to the computer where the software/thermal printers live.

Cheers
13 Aug 2015, 14:20
#16
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Desperate for a working version of this on 1.5+

Does anyone know what needs to be changed for this to work?
02 Nov 2015, 15:06
#17
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

In case someone comes across this post looking for the same thing, I am currently writing a shipping module which connects to the API to insert the shipping details ready to print the labels. I will package it up into an add on at some point and upload it.
24 Nov 2015, 11:32
#18
paperman avatar

paperman

New Zenner

Join Date:
Apr 2011
Posts:
18
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi Joe

I am looking to implement interlink shipping so that would be really great. What are you using for the rating? Do you have API access for this?

Thanks for any help etc!

Simon
24 Nov 2015, 12:49
#19
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi,

I'm not sure if you need interlink to enable access, or if it is already enabled. The username and password for the API is the same as the one you will use to log in to their control panel.

What I have done, is added the code which will add the shipment to Interlink to the checkout_process.php file just after emails are sent out.

It is one class file, and one file you will need to insert code into. If you have multiple payment methods, you will need to put the code in the relevant checkout_process files.

My code is a bit bodged at the moment, and can be done better. I can't guarantee how well it's going to work for you either, but it's a place to start

http://www.imglnk.uk/files/zencart_interlink_v0.1.zip

It works fine for us at the moment, new orders automatically get put into the "Shipment Review" page on interlink, you will likely need to go in and amend the service you require.
26 Nov 2015, 17:27
#20
paperman avatar

paperman

New Zenner

Join Date:
Apr 2011
Posts:
18
Plugin Contributions:
0

Re: Interlink /Geopost Ship@Ease Export Module for Zen

Hi That is great I will give that a go.

Thanks

Simon