106 replies [Last post]
futurist's picture
Offline
Joined: 08/08/2007
Juice: 114

I'm trying to migrate products from a shop that uses a MS Access db to UC. I first converted the data to MySQL and am now building the XML file for import. Is it right that uc_importer.module currently does import CCK image fields but doesn't export them?

I found a typo on line 212 in uc_importer.module:
$xml .= _uc_importer_export_manufacturers($dataa['manufacturers']);
should be:
$xml .= _uc_importer_export_manufacturers($data['manufacturers']);

Also, the return was commented out at the end of the function, so it didn't write any file:
return file_save_data($xml, file_directory_path() .'/uc_export.xml', FILE_EXISTS_REPLACE);

Glad ubercart.org is back(ed up?...)

CpILL's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 549
I'm keen to see a CSV import

I'm keen to see a CSV import module happening (or write one myself). I was thnking that perhaps going from

Excel -> CSV -> XML -> Ubercart

would be the way forward since the XML importer already exists. Is there a spec for the XML that Ubcercart likes?

Now that I'm thinking about it perhaps Excel could export to XML and then a general XSLT template could be developed to et this in the UC preferred format?

Uberdevelopment www.tsd.net.au/blog

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
There is a schema definition

There is a schema definition available at http://www.ubercart.org/files/store.xsd, so if anything's an approved version, that would be it. It's been changing with the importer module as I figure out the best ways to do things, but it should be fairly stable now.

Guest (not verified)
Guest's picture
Re: There is a schema definition

+1 for CSV -> Store

futurist's picture
Offline
Joined: 08/08/2007
Juice: 114
Re: There is a schema definition

I have added some custom fields (year, condition, accessories etc) to my product content type. I don't quite understand if such fields can be populated using the current importer module. Can you give me an example "snippet" that shows how data for such fields would be represented in the XML?

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: There is a schema definition

So far I've come up with something like the attached file. I didn't put any information about the kind of field because I think it's the user's responsibility to make sure the content fields are set up right on both sites. The <value> tags may be named something different for different fields, especially if they store more than one piece of information per field.

AttachmentSize
cck_fields_export.xml 1.15 KB
macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
xml -> ubercart

Thanks Lyle. Now how would I import your xml file into Ubercart - just fire up importexportapi in Drupal and point it to the xml file?

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: xml -> ubercart

When you have the uc_importer module enabled, there's a form in admin/store/products/import that you can go to that's specifically designed for Übercart files. My importer is independent of importexportapi mostly because it threw a bunch of errors at me whenever I looked at it's pages. So I started from scratch and made a custom solution.

Edit: Actually, the URL might be different depending on your version. I can't remember when I changed it, but you might need to go to admin/store/import instead. It's a normal menu item, so you should see it in the menu links wherever it is.

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
uc_importer

Ok thanks - that makes sense. Where can I get my hands on the uc_importer module? It doesn't seem to be on this site (at least, a site search comes up blank) and google only has one reference to it - at bazaar.ubercart.org - but it's not in cvs on drupal.org - could you please post it here as an attachment or let me know where I can download it?

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: uc_importer

Ah! Sorry about that. I keep forgetting what's been done since the last release, so I figured since it's in the bazaar repository you had access to it.

Here it is.

AttachmentSize
uc_importer.tar.gz 9.6 KB
macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Super-fast reply day!

Thanks for the super-fast replies! I don't know how to access the bazaar repository, so some guidelines somewhere would be quite helpful at some point. But for now I'm going to start playing with the module and see if I can start importing products Eye-wink

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Excellent

Ok, this looks great. Easy to use too. I've got over 100 products in csv which I'll now format into the correct xml definitions - the only question is the unique_hash key. I see it's a field in the uc_products table - do I need to generate a similar (unique) hash per product in my xml importing - or can I leave it blank? I take it that it's there for some reason to uniquely identify a product?

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Re: Excellent

Don't worry - I just found that you generate the hash in the import code.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Excellent

Yeah, the unique hash is preparation for a module that's to be used for multi-site setups. It would allow you to make a change to a product on one site, and then export that product to the other sites automatically. Because the node ids can be different, Übercart generates the unique_hash when the node is first created, allowing the module to find the right product to change.

druru's picture
Offline
Brain Stormer
Joined: 08/08/2007
Juice: 228
Re: Re: Re: Excellent

I'm a little confused. Why the third abstraction from csv -> XML -> uc and not just csv -> uc?

I imagine it's to potentially make future imports of other "types" easier (write to one interface) but it kind of creates just as much work doesn't it (at least for the person that's going to have to import the data and covert each set of data (csv etc) to the uc xml spec == 2 conversions instead of one)?

i'm biased towards csv because that's what i'm going to use to import (Eye-wink) and outside of it, i'm not sure how many different import methods actually are used in practice? If there aren't many other methods, that extra abstraction to xml might be wasted? csv is supported by php so it's a straight shot if someone builds out csv -> uc importer. And i could see people using it a lot and fairly easily. But maybe not

xml is valid i'm sure, i just haven't gone down the path yet so wondering why all the emphasis is being placed on it or what benefits it brings by using it? Maybe your importer magically insulates the coding of the actual cck fields and such that would have to be changed for every individual use of an import script.

if i had a second to breathe, i'd have finished an uc csv import script (not a module) by now but unfortunately i don't. Sad.

imho, a standardized and documented import is THE thing that uc needs right now above all else. Otherwise store conversions can't take place. That means "most" uc implementations are "probably" going to be brand new store implementations or ideas. Or that others have written their own private import scripts to complete their stores.

thanks

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Re: Re: Excellent

druru, I went with XML mostly because I was familiar with it. (I really wanted to use YAML, but PHP doesn't have an easy library for it, and everybody said no one would know what to do with it.) While CSV is technically simpler, I wasn't sure I would be able to represent things like attributes and categories easily because you don't know how many each product is going to have. I'm sure there's a technique that most people know, but I didn't, and I didn't try to find out what it was.

I would say that the two conversion steps is only useful if you already have a way to generate a CSV file of your store. If it has all of the compatible data, I think it would be easier to make XML from that than trudging through the database again.

I agree that the importer needs to be documented. I think it's as abstract as it can get because I'm using functions like node_save() and drupal_execute() whenever the data is retrieved from the XML file. I don't think I (personally) will write any other import methods, but I think anyone who wants to can emulate what's already been done.

druru's picture
Offline
Brain Stormer
Joined: 08/08/2007
Juice: 228
I'll now format into the


I'll now format into the correct xml definitions

How does one take a csv file and format it into *xml* definitions? What *are* the xml definitions? Is there documentation on the uc site or is this info specified in the zip file? I guess i'm wondering what the xml definition actually means.

And can this formatting be done quickly and easily with find and replace in the spreadsheet app or vi or some other editor, or is it mostly a manual op for each record?

thanks

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Field definitions

The xml field definitions are here: http://www.ubercart.org/files/cck_fields_export.xml

Or you can install the uc_importer.module and do a single product export, then take a look at the generated xml file. The xml is pretty self-explanatory.

I'm going to be writing something today which will convert my csv product file into xml. It'll be a bit of (standalone, for now) php code which will take csv as input (initially by pasting into a textarea), do the formatting stuff and then give xml as output (either in pre tags or in a textarea again). I've defined some extra CCK fields within my product type so my solution won't suit everyone. Step 2 would be to map csv fields to CCK fields dynamically - I guess since this is something a lot of people want right now there'd be a bit of demand for it?

Lyle, shall I go ahead and upload this as a contrib module once it's done? It won't be anywhere near mature - but the version I'll upload should help prepare a csv file for import into the vanilla product definition.

As for your other question, druru, why not import the csv directly into the database? Good question! I haven't looked at the uc_import module much yet, but that's the code that Lyle has written and I'm happy to work within it. If you want to go ahead and write your own csv importer, go for it Smiling Just make sure you generate the hash key in the correct way (line 762 in uc_importer.module)...

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
converter code

I'm using the converter at http://www.bytemycode.com/snippets/snippet/448/ to convert my .csv into xml. I'm about 1/2 way through so far - got the php script to read in values from the xml file. Now I'm mapping those values across to the Ubercart product field values - and adding in capacity for CCK fields.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: uc_importer

The original importer module only works with PHP5 because of Simple XML. Because I found JSimpleXML from Joomla! which works in PHP4, I've rewritten the importer to use it in case anyone's still stuck in PHP4.

Edit: Removed due to errors. See below for an updated module.

futurist's picture
Offline
Joined: 08/08/2007
Juice: 114
Re: Re: Re: uc_importer

Hmm, any idea concerning my image import and category issues? Thank you.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Re: Re: uc_importer

Spent this afternoon typing this out: http://www.ubercart.org/docs/user/354/importing_data

The part your looking for is "/store/products/product/fields" and right after. Hope it's helpful.

futurist's picture
Offline
Joined: 08/08/2007
Juice: 114
Your new documentation is a

Your new documentation is a great help. However, I'm still confused concerning image import. The XPath /store/products/product/image appears in the schema definition but not in the documentation. So I dropped the 'image' element from my product and instead tried the following (assuming that image type fields should now appear similarly to text type fields in the XML):

<fields>
  <field>
    <name>field_image_cache</name>
    <delta>
      <value>http://mysite/import/example.jpg</value>
    </delta>
  </field>
  ...text type fields...
</fields>

An image file 'example.jpg' exists in the 'import' dir. But that doesn't work either. Can you please tell us if image import works at all with the module and if yes, give a short example on how the XML should look?

@macgeek: Sometimes I noticed that disabling and then re-enabling a module made it appear in admin.

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Newbie error

Ah, newbie error. That did the trick, thanks Smiling

Nevmoor (not verified)
Guest's picture
Re: Newbie error

This is great! I am slowly 'getting it'. I need to do the importer for PHP4 so I am going to use the above advice for changing the code to get it to work. If I can get this down, I will be able to do 3 or 4 online stores in the next couple of months!! I will definitely keep up with these forums.
BTW does anyone have a suggestion for a PHP editor? I have DW but that doesnt cut it for me.
I am doing all these changes to a subfolder of an active site on shared hosting,which I know is a little dangerous but since it's not really up I hope I don't crash anything!

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: Newbie error

OK I am starting to 'get it'. I have been playing around with this a bit. Now I need to make the.module change for the PHP importer so I can try to export an example product. macgeek, whenever you get you script done let me know! I am no programmer at all, but I can manipulate code once I understand a little of how it all works. Keep up the good work everybody!! UC is a great module for drupal

hugslife's picture
Offline
Joined: 08/08/2007
Juice: 6
Re: Re: Newbie error

Thanks, Lyle! Cheers all around! Now, about that YAML... Smiling

futurist's picture
Offline
Joined: 08/08/2007
Juice: 114
No more orphaned products

No more orphaned products after import! I had set up product categories in admin, added some products manually and then tried to import more using uc_importer. But the imported products didn't have any category assigned to them. Here is how it works (thanks, Lyle):

Since you know ahead of time which products go in which category, you should "import" those categories too. Since they'll have the same name in the XML and the database, the importer will recognize the duplicate and decide what to do based on its configuration. Since the default is "do nothing", it will map the to the term id and be able to put the products in the right place when it gets to them. Considering that you already have the products with the right term id, you can give the tags the same number. It's only used as a reference.

(I think this should go in the documentation.)

The only missing thing now is image import...

psynaptic's picture
Offline
Early adopter... addicted to alphas.Not KulvikTheminator
Joined: 08/28/2007
Juice: 731
Categories not being assigned to products

I'm actually having issues importing products at the moment. Everything is working fine apart from categories. The categories themselves are importing properly but categories are not assigned to the products. I've attached my XML file in case anyone can see why this isn't working.

I checked uc_importer.module but can't find where the categories are being assigned to the products.

Any ideas?

AttachmentSize
uc_export.xml 8.27 KB
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Categories not being assigned to products

For whatever reason, the categories aren't assigned to the imported product if the uc_catalog module isn't enabled. Your XML looks good to me, so that might be the issue.

psynaptic's picture
Offline
Early adopter... addicted to alphas.Not KulvikTheminator
Joined: 08/28/2007
Juice: 731
Imported content is missing some (not all) newlines

Thanks so much Lyle, that's exactly what it was!

Some of the imported content is a bit malformed.

There is a category in my XML named 'Sofas & Chairs', when this is imported it becomes 'Sofas&Chairs'.

The product description is like so in the XML:

Available in 6 colour ways: Natural, Brown wash, Ivory, Sea blue, Olive and Black. The Louise chair by Lloyd Loom is a classic shape and design. There is an optional seat cushion available. Lloyd loom is enjoying a strong revival and is being incorporated into styles for dining furniture, bedrooms, kitchens and conservatories.

Lloyd Loom grew from strength to strength as their furniture became increasingly popular. It could be seen on ocean liners, in hotels and tea rooms; it became the standard issue for the British Army and RAF all over the world; it even graced the Royal Boxes at Wimbledon, Henley and Twickenham.

Using experience gained on the factory floor has proved invaluable in recreating the original shapes and manufacturing techniques. The design department concentrates on strict adherence to original designs and on an ever developing modern collection.

but ends up like this in the database:

Available in 6 colour ways: Natural, Brown wash, Ivory, Sea blue, Olive and Black. The Louise chair by Lloyd Loom is a classic shape and design. There is an optional seat cushion available. Lloyd loom is enjoying a strong revival and is being incorporated into styles for dining furniture, bedrooms, kitchens and conservatories.Lloyd Loom grew from strength to strength as their furniture became increasingly popular. It could be seen on ocean liners, in hotels and tea rooms; it became the standard issue for the British Army and RAF all over the world; it even graced the Royal Boxes at Wimbledon, Henley and Twickenham.

Using experience gained on the factory floor has proved invaluable in recreating the original shapes and manufacturing techniques. The design department concentrates on strict adherence to original designs and on an ever developing modern collection.

The custom CCK field is like so in the XML:

Double (4'6"): W 156cm x D 210cm x H 129cm
Kingsize (5'): W 171cm x D 217cm x H 129cm
Super Kingsize (6'): W 201cm x D 217cm x H 129cm

Bedding not included

and ends up like this in the database:

Double (4'6"): W 156cm x D 210cm x H 129cmKingsize (5'): W 171cm x D 217cm x H 129cmSuper Kingsize (6'): W 201cm x D 217cm x H 129cmBedding not included

Notice how the description doesn't have all newlines removed.

Any idea why this might be?

Nevmoor (not verified)
Guest's picture
Re: Re: Re: uc_importer

I have just found this great set of modules and it looks like it will do everything I need BUT I am a n00b at drupal and know very little programming. I have read this thread and have created a CSV file from Excel of a list of products for a NEW store. I don't quite understand the steps needed to convert to XML>IMPORT to UC. Could you tell me how to use the script mentioned earlier in the thread? I have downloaded the TXT file but how do you execute the script??

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
csv importer

Hi Nevmoor - I'm working on a csv -> XML script as we speak. Once your data is in XML it's pretty simple to import it into Ubercart using the instructions earlier on this page. Might be an idea to export some of your products into XML using uc_importer.module and then import them back so that you start to get a feel for how the whole process works. I'll post my script on this page once I'm done Smiling

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Re: Re: Re: uc_importer

Thanks Lyle, the php4 version of the importer looks good. Just had 2 errors when I ran it - and they were silly fixes:

Line 744 I changed to:

        $fix = $product_data->unique_hash[0]->data();
        watchdog('importer', '<pre>'. print_r($fix, true) .'</pre>');
        if (!isset($fix)) {

Line 853 I changed to:

          $fix = $attribute_data->default_option[0]->data();
          $default_option = isset($fix) ? (string)$attribute_data->default_option[0]->data() : $attribute_data->options->option[0]->id[0]->data();

In both cases this has to do with php4 seemingly unable to process the following code within a larger

$product_data->unique_hash[0]->data()

But now that that's done, I installed the php4 module (by overwriting the other one in the uc_module folder) and it's not picking it up as a menu item in the store backend like it did with the latest version. Am I missing something?

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
Maybe?

This might be because I first used the php5 version and am only now using the php4 version. The link defined in the php4 version is "admin/store/products/export" and if I navigate there (with the module installed) it just takes me to the "admin/store/products" page. Suggestions?

Btw, in terms of progress with the csv -> xml converter (before I head to bed) is good (but slow): I've got it to generate the following code from my csv:

<products>
<product>
<type>product</type>
<name>Aciphex (Pariet)</name>
<manufacturer>Janssen-Ortho</manufacturer>
<cost>$49.10</cost>
<fields>
<field>
<name>field_generic_name</name>
<delta>
<value>Rabeprazole Sodium</value>
</delta>
</field>
<field>
<name>field_strength</name>
<delta>
<value>10mg</value>
</delta>
</field>
<field>
<name>field_type</name>
<delta>
<value>International Brand</value>
</delta>
</field>
<field>
<name>field_sabre_name</name>
<delta>
<value>Pariet 10mg Tabs (Janssen-Cilag)</value>
</delta>
</field>
<field>
<name>field_pack</name>
<delta>
<value>28</value>
</delta>
</field>
</fields>
</product>
</products>

I haven't yet enclosed it within a store tag and the catalog category. I've also got a CCK field which references a category within drupal and I'm not quite sure how to link that across (by term id? Does the importer support categories?)

ps - I'm doing this for a client, so NO I'm not selling pharmaceuticals and YES I'm making sure he isn't sending out ANY emails.

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: Maybe?

Just found out my client actually had a MS Access database as the original form of their product list! Access has an export to XML function. SO... I wanted to test this out.

I tried to export a product from UC and then re-import it.
all I got in the exported file was this:

<?xml version="1.0"?>
<store xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ubercart.org http://www.ubercart.org/files/store.xsd"></store>

What am I missing? I have taken the Access database and added/shifted the column orders to match the schema you guys linked to. I just want to get the import/export module working as step 1.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Maybe?

You have to press the "Select" button to get products in the bottom box before the exporter will pick them up. It's a bit convoluted, but it allows you to get products from more than one category at once. While the exporter works, it does need some polish and documentation still.

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: Re: Re: Maybe?

Actually I discovered a few things that were basically theme issues. To bad Drupal doesn't have a lot of folks doing cool themes. It's getting there but for us lazy folks it's difficult. I am going to stick with the default until the store is functional. Then I will reach out for help!!
I just exported my test product and everything lines up. Now I have to get the importer to work. My host has PHP4.3.11!! When I FTP the importer.module ( the renamed importer_php.module) into the importer module folder, I get a Drupal crash and the whole site locks up. I am probably doing something stupid, but it's just my code ignorance. I will try again this evening and let you guys know whats what.
THANKS!

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: Re: Re: Re: Maybe?

Getting this error again

Fatal error: Call to undefined function: simplexml_load_string() in /home/content/F/o/r/mysite/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 656

I know this has to do with the importer for php4 vs 5 simple xml but I don't know how to solve it.
Are all the code fixes mentioned in the above posts already coded into the latest uc_importer?

I also just got an error from the pathauto module:

warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /home/content/F/o/r/mysite/html/store/sites/all/modules/pathauto-5.x-2.0-beta2/pathauto/pathauto.inc on line 72.
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Re: Re: Re: Maybe?

Ah, I had nearly forgotten the code fixes. Here's the corrected file.

When you get it, you'll need to rename it to uc_importer.module and replace the module file you already have. Then, you should disable and re-enable it to make sure Drupal loads the correct thing. You were getting an error because it was still using the 5-only version.

Also, pathauto seems to be kind of broken. We'll forgive them because it's still in beta, but you might want to stick with previous versions until it gets sorted out.

AttachmentSize
uc_importer_php4.zip 8.33 KB
nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: Re: Re: Re: Re: Re: Maybe?

Lyle, I just dropped the importer module for PHP 4 in to the uc_importer folder( after renaming it of course) and I got another error:

Parse error: parse error, unexpected '(', expecting ',' or ')' in /home/content/F/o/r/myinfo/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 746

Is there anything I should be changing in the code that I don't know about?

BTW what is a good open source app to view/edit code?
Dreamweaver is a pain sometimes when you try to go line by line. It doesnt always show things on the 'right' line number consistently.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Re: Re: Re: Re: Re: Maybe?

I bet that's the same kind of error that macgeek caught earlier. Change that line to

<?php
       
if (!isset($product_data->unique_hash)){
?>

and that should take care of it. There's a few more lines that will do the same thing because of the isset(), so either change your copy or get the updated one in the post above.

Boo on Dreamweaver. We use jEdit, and I haven't found another text editor I like better.

macgeek's picture
Offline
Bug Finder
Joined: 08/15/2007
Juice: 36
export -> import isn't working

Hi Lyle

I've upgraded to php5 and am using the php5 version of uc_importer (dated August 9th - don't know if you've done updates on it since then?). Using that, if I export a single product and then use the resultant xml file to try to input, it gives me a failure:

    * warning: Invalid argument supplied for foreach() in /Users/roger/Sites/bestbuydrugs.net/website/ubercart/drupal-5.2/sites/all/modules/uc_importer/uc_importer.module on line 676.
    * warning: Invalid argument supplied for foreach() in /Users/roger/Sites/bestbuydrugs.net/website/ubercart/drupal-5.2/sites/all/modules/uc_importer/uc_importer.module on line 697.
    * warning: Invalid argument supplied for foreach() in /Users/roger/Sites/bestbuydrugs.net/website/ubercart/drupal-5.2/sites/all/modules/uc_importer/uc_importer.module on line 738.
    * warning: Invalid argument supplied for foreach() in /Users/roger/Sites/bestbuydrugs.net/website/ubercart/drupal-5.2/sites/all/modules/uc_importer/uc_importer.module on line 844.

These lines have to do with categories (I also have a few custom CCK fields - see my xml posted earlier on this page) - should my import be failing, or am I doing something wrong?

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
I got these errors tonight #

I got these errors tonight

# warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 656.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 658.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 670.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 676.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 697.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 738.
# warning: Invalid argument supplied for foreach() in /home/content/F/o/r/ForDivinity/html/store/sites/all/modules/uc_importer/uc_importer/uc_importer.module on line 758.

I got back to the original uc_importer for PHP5. I thought I had the schema right but I guess not.

nevmoor's picture
Offline
Joined: 08/17/2007
Juice: 29
Re: I got these errors tonight #

OK I did some quick work on my XML.
now the importer says it was successful but there are no new products added!!
I suspect that my XML must not be right. I have almost 400 products so I have to get this to work. Actually I probably could have done this by hand after all this time but I want to get this right!

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: I got these errors tonight #

bkudria had been having the same kind of problem on Friday, but we couldn't figure out the problem. I was able to take his XML and import it with no problems.

nevmoor, it sounds like you have a different problem, though. Post your XML so I can see if there's anything to change.

catorghans@drupal.org's picture
Offline
Joined: 08/16/2007
Juice: 72
SimpleStock

To use SimpleStock, every option should have it's own SKU (model).
But the import has no way to import a "model" to a product-option.
Is that on the todo list already?

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: SimpleStock

It wasn't, but I guess it can be. Shouldn't be a problem to get that working.

catorghans@drupal.org's picture
Offline
Joined: 08/16/2007
Juice: 72
Re: Re: SimpleStock

If i run the import twice, all the manufacturers,the attributes, the categories are overwritten (that was my option in the configuration), but the products are not.
It looks like the import needs the same "unique_hash" to be overwritten.
That does make sense, but wouldn't it also make sense that the SKU is used as an identifier for a product to be overwritten? Maybe as option in the config?

catorghans@drupal.org's picture
Offline
Joined: 08/16/2007
Juice: 72
aaah, function

aaah,

function uc_product_insert($node) always creates a new unique_hash.
So you cannot use the hash across systems right now.

I think I will get this bazaar thing working. I need the latest code.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: SimpleStock

I've committed a change to the importer (both versions) to handle product model adjustments. Attributes and options can now import and export their ordering and price and weight defaults. I've also fixed some problems in the PHP4 version that might have been causing problems for some of you.

I think there might still be issues with assigning options to products, especially if there are already existing options with the same name. I haven't isolated the problem yet, but it's something to be aware of.