[Solved] E-commerce - how to add user editable fields

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 205
Joined: Sun Sep 05, 2010 6:11 am

[Solved] E-commerce - how to add user editable fields

Post by chrisbt »

Could someone please point me in the right direction of how to add user editable fields into an e-commerce site. I need to have the users enter their prescription (for eye glasses) either before or after they have added a product to the cart.

There are multiple free format fields required for this, rather than using predefined Product attributes.

I'm using the excellent suite of Calguys E-commerce modules: Products, Orders, Cart, etc.

I've been trawling the forum all day and haven't found a solution yet. Even a pointer in the right direction would be excellent. Thanks
Last edited by chrisbt on Sat Dec 10, 2011 4:27 pm, edited 1 time in total.
User avatar
flatcap1
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 16, 2011 3:13 pm

Re: E-commerce - how to add user editable fields

Post by flatcap1 »

I need to do a similar thing (allow the user to enter embroidery text to personalise garments). I've tried modifying the "AddToCart" template or using jQuery to change a dummy dropdown field (product attribute) to a <input type="text"> control but I get errors each time.

There must be a simpe way to do this....anyone?
User avatar
flatcap1
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 16, 2011 3:13 pm

Re: E-commerce - how to add user editable fields

Post by flatcap1 »

I've got round this problem by storing the personalised data into session cookies which I then dump into the Order Notes field at checkout.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 205
Joined: Sun Sep 05, 2010 6:11 am

Re: E-commerce - how to add user editable fields

Post by chrisbt »

Thanks for the update. I'll look to do something similar.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: E-commerce - how to add user editable fields

Post by applejack »

Can't you just use a custom field predefined drop down for left eye, right eye ?
User avatar
flatcap1
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 16, 2011 3:13 pm

Re: E-commerce - how to add user editable fields

Post by flatcap1 »

He could have a drop down list of all prescription values e.g. +2, +1.5, +1, +0.5, 0, -0.5 etc. but I suspect he wants a free format text box like I needed.
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 205
Joined: Sun Sep 05, 2010 6:11 am

Re: E-commerce - how to add user editable fields

Post by chrisbt »

Yes, is a mixture of predefined drop downs plus some free format fields. My issue is about how to store this data before the user has created a user account. It sounds like using cookies is the best option that is available this side of HTML5 unless there is any other options?
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 205
Joined: Sun Sep 05, 2010 6:11 am

Re: E-commerce - how to add user editable fields

Post by chrisbt »

I've made a slight improvement to this solution.
- at the AddToCart stage I save all the user editable fields into a cookie.
- in Calguys Ecommerce Base > Supplier Settings, I append the cookie value (containing the user editable field values) onto the 'Line Item Description Template' that generates the 'summary' field for that item in the cart. Then in ViewCart I can access that data on a per item basis and format it as I wish. :)
User avatar
flatcap1
Forum Members
Forum Members
Posts: 24
Joined: Tue Aug 16, 2011 3:13 pm

Re: E-commerce - how to add user editable fields

Post by flatcap1 »

chrisbt wrote:I've made a slight improvement to this solution.
- at the AddToCart stage I save all the user editable fields into a cookie.
- in Calguys Ecommerce Base > Supplier Settings, I append the cookie value (containing the user editable field values) onto the 'Line Item Description Template' that generates the 'summary' field for that item in the cart. Then in ViewCart I can access that data on a per item basis and format it as I wish. :)
Sorry, I'm just having trouble understanding where the 'summary' field is displayed or if I have it disabled how to enable it. I've put some dummy text in the 'Line Item Description Template' but can't see it appearing anywhere. Also, what code did you use to display the cookie value (I used jQuery). Many thanks, Steve
User avatar
chrisbt
Dev Team Member
Dev Team Member
Posts: 205
Joined: Sun Sep 05, 2010 6:11 am

Re: [Solved] E-commerce - how to add user editable fields

Post by chrisbt »

In the 'Cart - Add/Edit Viewcart Form Template' the summary field is referenced by: {$oneitem->summary}

In the 'Line Item Description Template' you can retrieve the cookie using: {$smarty.cookies.yourcookiename} (After it has been set using jquery)

Chris
Post Reply

Return to “Modules/Add-Ons”