8 replies [Last post]
wqmeng's picture
Offline
Joined: 07/12/2008
Juice: 33
Was this information Helpful?

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.

PreviewAttachmentSize
uc_order_upload.zip10.85 KB
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Why the upload file list is missing? Module Upload file by c

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>.
wqmeng's picture
Offline
Joined: 07/12/2008
Juice: 33
thank you TR, I am sorry not

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.zip 11.56 KB
mediamash's picture
Offline
Joined: 09/30/2008
Juice: 6
Re: thank you TR, I am sorry not

hello wqmeng, what is the status of this module?

the2ndday's picture
Offline
Joined: 10/08/2008
Juice: 2
any update?

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

Anybody's picture
Offline
Joined: 12/01/2008
Juice: 9
Re: any update?

Is there anything new according to this "problem"???

I'd really need a module like this.

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Hi you all. I'm really

Hi you all.

I'm really interested on something like that for a shop I'm building right now. I've had a look at the code despite I'm not a very good coder. I've contacted wqmeng but considering that he has not answered on several months I'll try to review the module. I've been thinking on how solving that issue as easily as possible and I think that the answer could be to upload the file as "usual" on drupal, create an attribute as textfield and while uploading copy the path on that attribute field. That way we could upload the file using drupal tools and manage the path as an attribute using ubercart tools. Hmmm, let's see if I manage to get to work. Any help would be appreciated!!! Laughing out loud

johngflower's picture
Offline
Joined: 01/04/2009
Juice: 88
This would be handy

Just being a squeaky wheel...

I too would like to see this module created. It'd be very useful for any business that provides custom products and services.

johngflower's picture
Offline
Joined: 01/04/2009
Juice: 88
.

*bump*