I would like to provide an order comment text area during checkout for customers to fill in.

I added such a field via the 'Manage fields' tab of the order; admin/commerce/config/order/fields
But the field doesn't show up during checkout.
It's only available for admins.

How would you implement this?

CommentFileSizeAuthor
#5 commerce_order_comment.zip1.43 KBpieterdc

Comments

rszrama’s picture

My ideal solution would involve getting the Comment module to work on entities other than Node. Your approach can work, but you're going to need to create your own checkout pane that can populate that field with whatever value the customer enters during checkout.

pieterdc’s picture

You would like the comment module because customer and merchant could then keep commenting on an order.
And we could then use an existing comment-notify module to well.. I see.

That would require the comment module as you mention, to be node-independent.
We could support #731724: Convert comment settings into a field to make them work with CMI and non-node entities

But that doesn't solve the fact that the current 'Manage fields' tab of the order; admin/commerce/config/order/fields has unclear consequences.
Adding a field doesn't expose it to the customer ( / author, for input).
Which makes it hard to grasp.

Should we use something like http://drupal.org/project/field_group and expose every order field_group as a checkout pane?
Store admins could then put those fields somewhere in the checkout flow, via admin/commerce/config/checkout/form
That would be dynamic, I guess.

rszrama’s picture

So, I think it'd be very cool to be able to add fields to orders and automatically get corresponding checkout panes, but I don't think we'll be supporting that in core for now. It's just a hunch, but that feels like more than our stated goal of a somewhat minimalism... but it should be easy for a module to expose a UI to do that. I'm already doing this with the customer profile reference field in a sense. The problem with some fields is that you just need to get some hard logic involved that requires code, but for simple fields like textfields and select lists, I bet it would be a great way for people to add things to the checkout form.

Yeah, that sounds like a contributed module that needs to happen... I'm sure I'll get to it if no one else does first. : D

pieterdc’s picture

Ok, thinking about core functionality.

As the line-item manager is (currently the only) field of an order, and appears on the cart page (for input), it would make sense for every other order field (added on the 'manage fields' page of 'order') to also appear on that page (for input), doesn't it?

pieterdc’s picture

Status: Active » Needs work
StatusFileSize
new1.43 KB

Just made a custom module that fits my needs.
I requires you to firstly manually add a field_order_message_author and a field_order_message field to the list of order fields.

Just sharing...

rszrama’s picture

Component: Order » Contributed modules
Status: Needs work » Postponed

One observation, Peter - you could use the Field CRUD API to create the fields. That's what we're doing throughout Commerce for things like default price fields and reference fields.

pcambra’s picture

Status: Postponed » Fixed

Thanks PieterDC, I've used your module as base for http://drupal.org/project/commerce_order_comment

WilliamV’s picture

I will use this module as well. Thank you for the contribution.

pieterdc’s picture

Thanks for continuing this work, pcambra.

WilliamV’s picture

I filtered out the author field as i think this isn't required for my project.

Your module gives the possibility to create 'custom field-panes' by changing field types and formats.
I would like to create a 'collect-date-pane' wheras a user can enter a date and time ('date'-fields with popup) for collecting his order as none of the orders are shipped. The date-modules would be required for the field right?
I only have a lack of programming knowledge, so, anyone can help resolving my problem?

I've created a new issue as well as this doesn't belong here (it is based upon the creation of the same principals though).
Grtz & Thx!

hunziker’s picture

I have created module mentioned in post #3.

You can create a new field group for the order entity and then a corresponding pane is available. The project can be found here:
Commerce Fieldgroup Panes

The latest commit should be already full functional.

For the comment module it would be nice, if we can create something more flexible. Such that we can have multiple comments per order and have different visibilities (per role).

rszrama’s picture

Oooh! Very cool. Excited to check this one out. : D

hunziker’s picture

I add the review pane callback. The module is only about 100 lines of code. So there is only small chance that a bug is remain in it. So I add a first release candidate.

Next nice feature would be the possibility to control the activation of a pane by rules. Is such functionality a part of the core or should this implemented by a contribution?

pcambra’s picture

Nice one hunziker, do you think we should mark commerce order comment as obsolete and redirect people to yours?

hunziker’s picture

The problem is that for comments we need something different to my approach. Currently the comment module does the same as I do. So it is obsolete, but normally the administrator wants to add memos, send directly comments to the customer and so on. Therefore we need a comment module. My approach can only add fields of the order entity to the checkout process, but not complete new entities like "comments".

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ahimsauzi’s picture

hunziker, is that mean that adding a not to the admin field via rules is not possible at this time? I am looking for a solution that will add a not to any of the fields if certain conditions exist (UC conditional actions hello?).

murz’s picture

Also we can use Reply module for creating comments into order entity.

stijnbousard’s picture

Issue summary: View changes

Post #11 using the Commerce Fieldgroup Panes module is the way I used to add a comment field to an order.
Works like a charm.

The usage is clearly explained in the following vimeo:
https://commerceguys.com/blog/commerce-module-tuesday-commerce-fieldgrou...

Thanks!