Hello,

I don't know how easily this can be done but here's what I need:

Using the e-commerce module to set up an online store, I need to be able to create customizable products, lets say for example a coffee mug with a personal name or slogan on it. The buyer should be able to select the mug and fill in their name/slogan in a textfield, when this item gets added to the cart it should be added as a individual product.. or at least with a "tag" indicating that it's been "customized" and what customization should take place. Possibily the customizing could incur an additional cost in some cases.

I've already managed to tweak the tangible product module code a bit to include a textfield for the custom name/slogan, but I've no idea how to get this customization to "attach itself" to the product in the cart...

Anyone know of any modules / code patches or whatever something like this?

Is there a better place I should be posting this btw?

Thanks!

Comments

Cerel’s picture

The good news : It's possible, and I've done that.
The bad news : My solution still have some problems, and you have to modify some of the core ecommerce files.

Basically the idea is to use the "data" object you get in the product api.

Here's what i can say (in an unordered way) :

  • Use the product api, and the data object (a3).
  • Watch out for subproducts as, if I'm not wrong, the data (or a3) is only used by them. So they don't expect to be altered. You'll have to "merge" two data objects at one point. The data from the subproducts module, and your "data". If you do it correctly it should work (you'll have both data objects, and the subproducts will work).
  • As said before, data is only used for subproducts (if i'm not wrong again), so, all the "ec core modules" expect the data to be built in a certain way. So you'll have to modify some files in order to fix some little bugs, mainly display bugs. Look for "/cart/review", and "transaction/view", These are the two locations where I saw the problems.

Ok, now here is how I've done it :

  1. When my product is added to cart (product api => 'cart add item') i check the data that's been passed. If the additional data has already been gathered, then i just do nothing. Otherwise I "break" the flow (look at cart.module -> cart add item, to understand what i mean).
    1. I save in the database whatever data is already there (for example some kind of subproduct data). For that i use this handy function "ec_checkout_hide_data".
    2. I change the $_REQUEST['destination'] to point to my form that will get the data from the user
    3. I return false, this will break the flow and redirect to my form
  2. (In the form). I gather the data from the user, and on the "_submit" function i do this :
    1. I retrieve the "hidden data" from the data base, then i merge that data with the data from the user.
    2. I invoke the cart_add_item function passing it the new merged data
      • This will trigger 1. again, but this time the additional data is there, so the item will be added to the cart
    3. Finally i redirect to the "initial" destination (before modifying $_REQUEST['destination'] you saved it, right ? :P)

And voila, you're done. Well, there are maybe some bugs left, but at least that's the way i did it and it works.

I hope this was helpful.

Oh, and you can also try the ecommerce mailing list

redarrow’s picture

Thanks very much for the lengthy response Cerel!

I'll be giving that a try.. it seems to be what I'm needing..

joe-b’s picture

I'd like to do exactly the same thing, in order to allow customers to add a personalization message to an apparel product to be sewn/printed onto an item of clothing.

I'd really appreciate seeing some code if you were willing, redarrow and Cerel. It seems to me like it should be something of an adaptation of the subproduct module to allow the user to insert their personalization text into a text box rather than just choosing from a drop-down list. Know what I mean...?

Thanks, in anticipation.

alanburke’s picture

Yep, some code would be great,

I need to do something similar:

I want customers to pay to enter an event;
So I need the ecommerce functionality, to handle payment.
Ecommerce also captures address details for shipping tickets.

but I also a Name, Date of Birth, and some other items.

These are 'one-off' products, in that each customer will have to supply different details to enter the event.
So you can't buy the 'customised item' more than once.

And yet, I want to allow a customer to regsiter multiple people in one transaction [using same shipping address].

Any code mentioned above, or even some general advice would be appreciated.

Regards
Alan

danfrist’s picture

Hey,

I've completed a full ecommerce site with a completely variable product. Custom Labels and Stickers! I talk about it in detail here.
-----------------------------
"Labels and Stickers"