2 replies [Last post]
kanisrufus's picture
Offline
Joined: 10/02/2009
Juice: 3
Was this information Helpful?

I apologize if this was double posted.

I wrote a java program to pull products, product types and categories into the drupal database from an xml file but I am missing some relationships and have not been able to figure out what they are yet.

Product categories and types are stored as term_data under the catalog vocabulary and are related to nodes in the node table via term_node. Nodes and uc_products have also been populated as well as the nodes vid and nid being put in the content_type_product table.
Can anyone give me a list of tables that have to have product and node references in order for things to work correctly?

The current problems are:
* parts do not show up in the catalog.
* parts do not display correctly from the admin>store admin>products screen. The names do not show up and they are all listed as orphaned.
* I get warning: Invalid argument supplied for foreach() in C:\development\eCommerce\xampp\htdocs\sites\all\modules\cck\content.module on line 1284 errors

Also, the field vid is used in so many places that I am confused on a table to table basis what its purpose is...sometimes version id, sometimes primary key, sometimes vocabularyid it seems.

Thanks for any pointers in the correct direction,

Kanisrufus

zeezhao's picture
Offline
Joined: 04/23/2008
Juice: 969
Re: importing products from and external database

I suggest you look at the node_save() function in drupal to understand all the tables it hits.

Also, have a look at this link - although this is in php, it will give you some leads on what to do in java: http://www.unibia.com/unibianet/node/31

justageek's picture
Offline
Bug Finder
Joined: 10/29/2008
Juice: 189
agreed

you will have a lot more luck writing php code using the Drupal framework to create your nodes. Trying to do the sql yourself is going to be extremely difficult, while creating simple import scripts in php should not be hard, I am working on one now that doesn't look like it will take long at all to complete.

If the only way to connect to the first system is via Java, I'd put the data into intermediate tables that you understand, then pull the data into Drupal using php and those tables.

There is also a great Migrate module, but it doesn't immediately support Ubercart, at least I could not get it to work "out of the box". It does have a powerful api, but in the end it was quicker for me to write php code in a standalone migrate tool than to research their api.