By robert_c on
Anyone know how to let the user upload an image to a customizable product in my Ubercart 2.x Drupal 6.x install? I was expecting to use an attribute but there is no image field.
I am aware there is a uc_node_checkout module but that takes the user to a new page once they add to cart which is not what i'm trying to do as i need the image upload field on the product page.
Any help would be great!
Thanks guys.
Comments
This might do
One way you could do this is to use the hook_order_pane() function. See the hook.php file in the ubercart doc folder. This is not a new page, but an alteration to the normal "checkout" page. In your callback, iterate through all the products in the cart and see if there is one (or more) that need a file uploaded. Create a form within this pane that asks for the file. You will need to save it somewhere when the order is finally confirmed. I realise this separates the upload from product selection but I am not sure you can do the upload at product selection stage. Unless you can use hook_form_alter() to mess with the attribute/options in the "add to cart" form.
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
First of all thanks for your
First of all thanks for your comments..
I've managed to get a file upload input field onto the product page but when I submit the page it doesnt process the file(upload it).
I have used hook_form_alter in a custom module to add an additional validation and submit function which saves the file but still the file will not upload and save.
Does anyone have any ideas?
Thanks in advance!
files upload node
As I understand it, a file upload is connected to a node via the upload table which has fields for nid and fid. So you need to have a node to connect it to. Which node is this? Do you want uploaded files attached to the product? You may have to do this 'manually' in the submit like
You might want to check that you can upload a file to a "normal" node like a page to make sure that folder permissions are ok and upload actually works outside of your modifications. Temp folder set up etc.
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
Hi Paul, I managed to get the
Hi Paul,
I managed to get the image upload section to work and i've also got the file saved in a custom folder, added to the database and assign it to the right content.
The latest problem I have is that I want it to display a link in the cart (cart, cart review, order) sections so the customer can click on the link to check the image they just uploaded and have it still be ther ein the order completion page so the client can click on it to download the image for that product.
I've used hook_product_description to output the link via l() but drupal outputs the link as code and not rendered as a clickable link.
I cannot find what I need to do to change this so it renders the link instead of outputing the code for the link.
Any help would be great...
Just figured it out... who'd of thought a little t() would be so mean!