Extend uc_importer to export as CSV

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:patch (needs review)
Description
Project: 
Ubercart

The attached patch modifies uc_importer to allow exporting products (nothing else yet) in CSV format. The format is compatible with that used in http://www.ubercart.org/contrib/5221 . It adds a select box on the product export page to allow choosing between xml and csv.

The modifications in general try to extend the uc_importer code in a way that allows flexibility and provides some skeleton code for this, but I realised afterwards that it would have been even better to modify it to provide a hook to allow implementing different formats via other modules, but don't have time to modify it now.

Version: 
Ubercart 1.3
PreviewAttachmentSize
uc_importer.module.csv_export.diff13.83 KB
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Use diff -up to output a

Use diff -up to output a unified format patch (-u) that includes the function name before each hunk of code (-p). This makes it easy to figure out how the lines of code were changed.

oliver coleman's picture
Offline
Bug Finder
Joined: 01/09/2008
Juice: 210
Diff was considering white space in lines
Assigned to:Lyle» oliver coleman

Thanks for the tip, Lyle, have made new patch in unified format with function names before code hunks. The main problem I was concerned with was that vast swathes of code that hadn't changed (I thought) were being put in the diff. The vast swathes of code had actually been indented one step, and diff was considering whitespace. The new patch ignores whitespace changes.

Jmmb's picture
Offline
Joined: 08/23/2007
Juice: 296
Invalid Output Format
Assigned to:oliver coleman» Jmmb

Thanks for the patch. I applied it and now can see the "Format" select box at /admin/store/products/export.

I then tried selecting some products and doing the export as CSV, but each time I get:

"No data to export. This might be due to an invalid output format being selected"

It works okay with XML, but not CSV. Any ideas why this is happening?

Jim

(Drupal^Ubercart) * (Design^Development^Hosting) = Sundays Energy