Why the upload file list is missing? Module Upload file by client

Posts: 2
Joined: 07/12/2008

Hi,

I am now working on a custom module which allows the client upload files to their order, I find many people are finding module like this, yet no one is out there.

I work base on the upload module, change some code to let it work on the product node and submit the upload files list.

The big problem is when click the 'add to cart' button, all the uploaded files information is missing when the 'uc_cart_view_form' shows.

I tried to hook 'add_to_cart_data', 'form_submit', and other apis , nothing work with it.

Anyone have some experience with this?

Any help is appreciated, thank you.

FYM,
This module still not work, if you want to test this, be carefully.

AttachmentSize
uc_order_upload.zip10.85 KB
Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Hmm, to me it sounds like you're going about it all the wrong way. Upload only works to attach files to a *node*. Orders are not nodes. If you want to attach files to Products, all you have to do is enable the Upload module, no modifications necessary. But this will attach the file to the Product node, which associates it with the Product for *all* users, not for one particular user or order. Even without looking at your code, I don't see how it could work since you don't seem to be creating any tables to hold your data (no .install file).

To attach the data to the order, you're going to have to write a module and create a table in the database holding the file/order relation. Then you're going to have to implement hook_order() to load/save your data with the $order object. Then some input form to allow the user to enter the files. I'm pretty sure this has been discussed in the forums before, but off the top of my head I don't know where to look for it.

--

<tr>.

Posts: 2
Joined: 07/12/2008

thank you TR,

I am sorry not upload all the file in my first post.
I have created a table 'uc_order_files' to store the uploaded files to associates with the order.

Here is my plan,
1 Alternate the product node form to add fields to upload the files, I hook the form_alter api, (DONE)
2 use the misc/upload.js to upload files and create the upload file list to the product node form, (DONE)
3 Post the uploaded files list with the product node form and add the files list to the cart. I have thought this should be finished by hook the 'add_to_cart_data' or 'form_submit' APIs, yet no luck, I can't get them to work. All the files list posted is missing after click 'add to cart' button. ()
4 View the uploaded files in the 'uc_cart_view_form',
5 Store the uploaded files list to the table 'uc_order_files' after client click 'review order' button. Here I will implement the 'hook_order()' function.

As there are no uploaded file list show in the 'hook_add_to_cart_data', I will try to add them to the cart from a stored session array $_SESSION['file_previews']. But I think it is not the right way to add them to cart, anyway.

If you find there are problems in my plan or you know another way to do it, Please share your idea here. I appreciate it.

thank you.

AttachmentSize
uc_order_upload.zip11.56 KB
Posts: 3
Joined: 09/30/2008

hello wqmeng, what is the status of this module?

Posts: 1
Joined: 10/08/2008

This idea looks really great.
Have you done any update?