Q: How to allow users to upload business cards on my print store

Posts: 20
Joined: 01/06/2008
Uber Donor

I am creating a print store that allows users to buy business cards online.

Because this is a fairly dynamic order I am not quite sure how to go about it and would appreciate any help from you Ubercart experts.

A few options customers will have:

  1. Upload the design themselves
  2. Front and Back or just Front printing
  3. Different Card Stocks
  4. Ability to buy different sets with discounts (250, 500 save 5%, 1000 save 15%, etc)
  5. More options in future...

I am fumbling this around in my head trying to figure out a smart way to architect it.

I am leaning towards using the attributes module pretty heavily for most of the features like front and back printing, card stock and things like this.

For the user uploads I am thinking of maybe doing some type of custom image node that gets parented to the business card product node. Perhaps they select their attributes, upload their image(s) and then click add to cart.

For the different card sets with discounts I am not quite sure on that yet. Maybe have 3 or 4 different business card nodes where each one has a different price?

I'm still not all the way decided on how to handle this and any help, tips or advice would be much appreciated.

Thanks!
Quinton

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

My thoughts here are all speculative since I haven't accomplished this myself or even really attempted to work it out... but!

I've recommended a multi-step solution like this in the past:

  1. Require users to create an account if they want to purchase customized business cards. Explain it as they need to do this so their creations can be saved for future purchases.
  2. Create a business card node type that uses CCK fields and such to create the business card.
  3. Create the business card product that users never actually see. Here's why... you can create a custom form or a cart link that adds this product to the cart with the appropriate attributes/options set to get the price and choices right. When the customer tries to browse to this page, I'd just redirect them to their "portfolio" of business cards... probably most easily accomplished w/ a view listing their business card nodes.
  4. When an order is checked out, if I were you I'd create a copy of the customer's "template" node just in case they make changes later. Let them know this, so they don't expect last minute changes to show up in their order. Obviously, the copy you make shouldn't be editable by them, but it wouldn't be a bad idea for them to have viewing access to it somehow to verify they get their order properly.

Those are my thoughts, and it requires you to fill in the blanks in a few places w/ other modules and some custom code. Check out the cart links docs here and in the module settings page itself for more info.

Posts: 20
Joined: 01/06/2008
Uber Donor

Thank you very much for the response Ryan. This seems like a pretty good way and pretty similar to what I was thinking. I will give this a go and let you guys know how it ends up.

Thanks!
Quinton

Posts: 20
Joined: 05/05/2008

Hi there, I'm working on a similar problem with custom orders and was wondering if you've made any headway with the approach described above. Any additional feedback would be greatly appreciated. Thanks, Z.

Posts: 16
Joined: 05/06/2008

Thank you !!!!
This is exactly what I needed fom my stikers site!!
********^_^***********

Posts: 23
Joined: 07/16/2008
Getting busy with the Ubercode.

I was curious if anyone has actually got this working and if so what steps did you take.

I'm about to start work on a "custom oil painting" website in which users upload a photo and then we send mail them the oil painting.

Any help would be appreciated

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

j0rd, I think I have the perfect solution for you, I just have to get in touch with the client about the project's completion. Basically, it'd let your users fill out a custom node creation form and then purchase a product that reference the node. You'd be able to use those nodes in your workflow to hold the file attachment and any comments about the work. I'll try to ping back here when it's posted.

Posts: 23
Joined: 07/16/2008
Getting busy with the Ubercode.

Thanks a bunch Ryan. Let me know the progress.

I've followed your advice in the original post. I've created a node with a module (then added CCK fields to it) for my template node. Once the user submits this node, i add it to my cart on node_insert() with uc_cart_add_item(). I use this instead of uc_cart_links as uc_cart links are not able to add $item->data. After the node is submitted and the item is added to the cart, i redirect the user to "cart" with node_form_submit() and it shows the user their current cart.

I'm using hook_form_alter to edit the cart's form (uc_cart_view_form) to display the image and title from my node instead of the products image and title. I've also edited the link on the "product title" to be "node/$NID/edit".

On my nodes update. If check and see if my node's nid matches any of the node ids which exist in my shopping cart. If it's the same node, I remove that entry from the cart, then re-add it with the edited details. I do this by storing the node reference in $item[data][mynid] and then iterating through the current carts items ( returned by uc_cart_get_contents() ) then using uc_cart_remove_item() to remove them, should a dupe exist.

This is getting rather hackish, but it could all be properly abstracted. At the moment I don't have time to do it myself, but it could be done. I'm interested to see what you've come up with. Posted this so that other know how they can go about doing something similar.

Issues I've run into code digging:

function hook_cart_display aka. uc_product_cart_display
This hook is not accessible from normal modules. This would be useful to change things like the link in the "product title". Also this hook doesn't allow one to change the product cart images.

in function uc_cart_view_form

$form['items'][$i]['image']['#value'] = uc_product_get_picture($display_item['nid']['#value'], 'cart');

imho. uc_product_get_picture should be changed to module_invoke("get_picture", $display_item['nid']['#value'], 'cart');
or even better module_invoke("get_picture", $display_item, 'cart');

This would allow someone who's created their own product module to determine how to display their image and use some logic against variables they've added to their "$items"

Posts: 57
Joined: 08/23/2007

Hi Ryan,

I too am very interested in what you're describing, as we're currently building a site for a textile printer who wants customers to upload an image as part of their order. I appreciate j0rd's last post, but have the impression something like this (and what you describe generally) can be done without all the hacks. So I'm putting in my own .02 for hearing your input on the more straightforward way of doing this rather than (or as well as) getting into all the issues there.

Thanks!

Jim

--

(Drupal^Ubercart) * (Design^Development^Hosting) = Sundays Energy

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

For those interested, I posted up UC Node Checkout just now... I have to come fill in some of the documentation and make a contrib post here on Ubercart.org, but it's there in CVS. I imagine it'll get packaged up as a snapshot release tonight. Smiling

Posts: 3
Joined: 09/30/2008

it would be interesting to add a custom page after the order/payment to upload the files. In this case if you have 30 products you would have to create 30 node checkouts by hand isn't it?

maybe this would be a better module ? -> http://www.ubercart.org/forum/support/5644/why_upload_file_list_missing_...

grtz
mm