6 replies [Last post]
heli's picture
Offline
Joined: 01/12/2009
Juice: 11

I need to import approximately 10,000 products with downloadable files into my Drupal 5 site. I can do this with a TSV file using node import module - but it does not associate the Download files.

Is there any way that I can associate files with already existing product nodes without opening each one and doing it manually?
For instance, if I know the relevant 'fid' and 'nid' can I write a SQL INSERT INTO statement which adds the data to the uc_product_features table? (I use phpMyAdmin).

Or is there a better way to go about this?

Any help would be greatly appreciated.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Batch associate Downloadable Files with Product nodes

Honestly, I don't think anyone's done this before, and if they have no code has come out of it. (That's reasonable, because it's going to specific to the site, really.) So your best bet is to just figure out the queries you need and get a script going to automate the process for you. You need to add the appropriate rows to the product features tables as well.

heli's picture
Offline
Joined: 01/12/2009
Juice: 11
Re: Re: Batch associate Downloadable Files with Product nodes

Thanks for getting back to me and for this wonderful module. I just tested and managed to associate files with already existing product nodes by inserting data into both the 'file products table' and the 'product features table'.

My method was laborious as I have no background in programming and writing scripts (relied on Excel and phpMyAdmin) - but it did work, and the files can now be downloaded by users upon order completion.

I'm curious when you say that associating files to already existing product nodes is "going to specific to the site" - part of the reason I posted the support request was I thought this would be a common requirement for those needing to import products with associated file Downloads such as music downloads or photographs. I was under the impression that there was a glaringly obvious check box, contributed module, or script that I had missed (which is often the case).

Thanks again for getting back to me - it helped give me the confidence to keep trying.

Regards
Heli

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Re: Batch associate Downloadable Files with Product node

Awesome. Glad you got it working! Cool

dom_b's picture
Offline
Joined: 02/26/2010
Juice: 71
heli wrote: Thanks for
heli wrote:

Thanks for getting back to me and for this wonderful module. I just tested and managed to associate files with already existing product nodes by inserting data into both the 'file products table' and the 'product features table'.

My method was laborious as I have no background in programming and writing scripts (relied on Excel and phpMyAdmin) - but it did work, and the files can now be downloaded by users upon order completion.

I'm curious when you say that associating files to already existing product nodes is "going to specific to the site" - part of the reason I posted the support request was I thought this would be a common requirement for those needing to import products with associated file Downloads such as music downloads or photographs. I was under the impression that there was a glaringly obvious check box, contributed module, or script that I had missed (which is often the case).

Thanks again for getting back to me - it helped give me the confidence to keep trying.

Regards
Heli

I have the same problem as this and thought it would be a common problem as well! I can batch import products using node_import from csv files and it will associate uploaded product images but it cant add the download product feature. Did you find an easier way of doing it than phpMyadmin? Im trying to work it out for a friend but it needs to be simple as possible. Node import is perfect if only it added download paths at the same time.

dom_b's picture
Offline
Joined: 02/26/2010
Juice: 71
Re: heli wrote: Thanks for

I haven't had any luck in finding a solution to this problem so maybe there is another way around this. Could I create a CCK field called 'downloads' say and then when cron is run it is inserted into the download/product features table? I wouldn't actually know how to set this up but maybe somebody has automated something similar or can tell me which fields need to be inserted where in the database? Thanks.

I realise this is free software and everything is community driven etc but are we saying that Ubercart can be created from scratch but nobody knows how to batch import downloads!? Is this feature impossible to implement!? I've looked at node_import code over and over and cannot work out whats going on but I know nothing about PHP etc.

dom_b's picture
Offline
Joined: 02/26/2010
Juice: 71
Re: Batch associate Downloadable Files with Product nodes

If anybody is interested I gave up on using the File feature in Ubercart as nobody seems to have any interest in it at all! I am now going to use 'UC Sell CCK Fields Access' instead.

http://www.ubercart.org/contrib/15122

With this you can set a CCK File field and then when people purchase the download they can see the link for that file/image/link whatever. This way you can use node_import and add as many products as you like in one go. In my case many thousands!

All I need to work out now is how to show a list of previously purchased products.