28 replies [Last post]
flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Was this information Helpful?

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

japerry@drupal.org's picture
Offline
Bug FinderGetting busy with the Ubercode.Not Kulvik
Joined: 08/08/2007
Juice: 248
Re: EDI Integration

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.

StephenGWills's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik
Joined: 08/07/2007
Juice: 414
Re: Re: EDI Integration

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

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: EDI Integration

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: EDI Integration

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

Now giftcards are the next bounty - anyone?

J -

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: EDI Integration

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
one thing I notice

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.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: one thing I notice

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.

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: one thing I notice

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

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: one thing I notice

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: one thing I notice

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 -

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: one thing I notice

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

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: one thing I notice

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.

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: one thing I notice

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

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: one thing I notice

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?

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: one thing I notice

its was Fckeditor that was doing this - fixed.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one thing I notice

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one thing I notice

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 -

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Import/Export module

Hi Ryan and all.

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one thing I noti

bump

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one thing I

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().

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one thin

how much code?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: one

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.

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re:

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 }

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re:

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.
?>
flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re:

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

John

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re:

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.

Jorisvt's picture
Offline
Joined: 10/07/2007
Juice: 11
Problem with the field !data in export pattern

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

flavoflav's picture
Offline
Joined: 10/01/2007
Juice: 103
followup

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