EDI Integration

Posts: 42
Joined: 10/01/2007

Looking for some one to help me with EDI Integration. We need a small program written which can export order data from ubercart and import the results from our fulfillment house back into ubercart.

Looking to to get this done asap.

Please email me at john at ridgeworksinc.com

Thanks

John

Posts: 99
Joined: 08/08/2007
Bug FinderGetting busy with the Ubercode.Not Kulvik

we're currently working on an EDI module for ubercart -> tinyERP. Not sure if this is of any use to you, but if you let us know what type of dataset you're looking for to be exported, that might help.

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Our B&M operation is based on an ERP called BOSS by BossLogics but it appears to be comparable to TinyERP on first blush. I would be interested in staying abreast of your EDI issues going forward. There are undoubtedly parallels to our efforts. Have you examined the solution that integrates TinyERP with Joomla? I'm wondering if that lends any insight into the architecture of the EDI effort?

Steve

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I'm in the process of making a generic EDI module that will be posted up soon. It's a solution for flavoflav that will hopefully be usable by other folks... using some keyword replacement on export patterns to folks can customize it to whatever their crazy fulfillment house is asking for. This will be based on the old FTP way of doing things...

Posts: 42
Joined: 10/01/2007

woot! this will be helpful to many...I am happy to sponsor it.

Now giftcards are the next bounty - anyone?

J -

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The module has been uploaded for testing here:
http://www.ubercart.org/contrib/1515

The default settings are per the specifications from flavoflav's client, so others will need to modify these to make use of it. Smiling

Posts: 42
Joined: 10/01/2007

I set up my directory structure for the import export and archive directories, but I still have the red box telling I need to setup directories after I hit save.

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Oof... change line 105 to:

<?php
  trim
(variable_get('uc_edi_order_import_archive_dir', '')) == '' ||
?>

It was working on mine b/c I saved it previously w/ the old variable name. That should take care of the problem.

Posts: 42
Joined: 10/01/2007

The files are not writing into my directories when I use export.

do these directories have to be in the drupal root? Right now I have them outside the html root.

John

Posts: 42
Joined: 10/01/2007

ok that fixed the dialog box - but export file still do not end up in the right place or anywhere Smiling

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Are any PHP errors turning up in the logs? Perhaps it's a write error? I chmodded those directories to be world writable in testing...

Posts: 42
Joined: 10/01/2007

This was a permission issue. The file which is outputed is not a 100% clean file:

<p>COH  1017    14      2399    2399    WS      1       999999  Name of      3627 Brook St.          xxxxxx       CA     92343  United States
!products</p>

Above is a sample - each record is wrapped in tags - we need to remove that.

J -

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Very interesting... I'll troubleshoot that first thing in the morning.

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I'm curious if the text you posted was coming from the export preview page or an actual export file?

Also, there were several places in the code where I still had uc_edi_ spelled as uc_edit_... I kept making that typo the whole time I coded. Eye-wink I uploaded a fixed version, but you can just do a find/replace if you need to.

Posts: 42
Joined: 10/01/2007

It came from the actual export file - every record is enclosed with tags...

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The functions involved here are _export_orders(), uc_edi_generate_order_export(), and uc_edi_create_export(). None of these add any tags or perform any sort of filtering... Are you viewing this in Notepad or some other text editor, or is it possible you're viewing it in Firefox and the browser is adding the tags?

Posts: 42
Joined: 10/01/2007

its was Fckeditor that was doing this - fixed.

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Nice. I wonder if there's a way to tell Drupal not to use WYSIWYG editors on certain textareas... Puzzled

Posts: 42
Joined: 10/01/2007

ok I am close to production here - but I would like to add some more fileds into my export, like the order creation date - so I tried !created as a field - but I get 1191269612 in response - how would I get the order date in human readable form exported?

Also not sure if this is a bug in edi module or not but when I create an order via the shop and then go in and modify the order - lets say chnage the quantity from 1 to 5 - then export the SKU number is not in the export.

j -

Posts: 108
Joined: 10/31/2007
Getting busy with the Ubercode.

Hi Ryan and all.

I would like to know if that module is similar to the new Import/Export options on alpha8.

Posts: 42
Joined: 10/01/2007

bump

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The SKU issue is interesting... I don't know why the SKU should be wiped just by changing the quantity... is it still showing on the order edit screens? Also, hadn't thought about the date thing. An extra bit o' code would be needed to format that value using date().

Posts: 42
Joined: 10/01/2007

how much code?

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Example, on line 638, if you inserted the following code:

<?php
  $values
['!created_date'] = date('m/d/Y', $order['created']);
?>

It should let you use the !created_date token in an export pattern to represent the created timestamp in the MM/DD/YYYY format. Check out http://php.net/date for more format information.

Posts: 42
Joined: 10/01/2007

Okay I added it - but Ll it does is print !created_date in the export file. keep in mind I do not know much about php and code

J -

629 // Returns a list of replacement values for product export patterns.
630 function uc_edi_order_product_values($order) {
631 $order = (array) $order;
632
633 foreach (array_keys($order) as $key) {
634 if (!is_array($order[$key]) && !is_object($order[$key])) {
635 $values['!'. $key] = $order[$key];
636 }
637 }
638 $values['!created_date'] = date('m/d/Y', $order['created']);
639 $values['!batch_id'] = variable_get('uc_edi_order_next_batch_id', 1000);
640 $values['!#'] = variable_get('uc_edi_order_product_line_number', 1); 641 variable_set('uc_edi_order_product_line_number', $values['!#'] + 1);
642
643 return $values;
644 }

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

My apologies... I forgot some additional changes were made to my local copy. You actually need to remove the code from your line 638 and move it up into the function uc_edi_order_values() between these lines:

<?php
 
}

 
// Build the products lines.
?>

Posts: 42
Joined: 10/01/2007

thanks that fixed it... one other question along the same lines how would I grab the contents of the Order Comments field?

John

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

There really isn't an easy way to do that... you'd need a DB query to load any comments related to the order and some nice way to chunk them all together in the event that there's more than 1 or to discern which to include if you only want one.

Posts: 4
Joined: 10/07/2007

First I want to say, this is a great contribution to the Ubercart module.

But it's not completely working for me, I posted an issue regarding this module here.

Is anybody having the same problem? Or is there a simple sollution to this.

Thanks

Joris