Comments

smccabe created an issue. See original summary.

geek-merlin’s picture

Priority: Normal » Major

Yes. Daring to raise prio as this is so counter-intuitive.

jnrfred’s picture

StatusFileSize
new47.54 KB
new17.84 KB

This is a patch to display order comments.

order-commets

smccabe’s picture

Status: Active » Needs work
StatusFileSize
new11.33 KB

This is the default look for order activity

Default Order Activity Screenshot

And the above screenshot from Fred is a simple basic custom one. I'd like to use the default commerce look, but push an improvement to commerce core as well.

@jjpoole can you take a look at it?

jjpoole’s picture

@smccabe
Are these 2 different things? comments vs order activity?

ps. visually they both look OK

jnrfred’s picture

StatusFileSize
new2.23 KB
new33.5 KB

The attached screenshot is using the default commerce order activity for the order comments as another way to display order comment as suggested by @smccabe. One issue is that, when a comment is added, you will need to reload the page to see recent comment. Will have to figure a way to show comment after it's added without reloading entire page manually.

order-comment

jjpoole’s picture

Ah, ok makes sense. Couple notes:
Need to sync the vocabulary. ie. are we calling it a "note" or "comment" or "message" ? then make sure buttons and column headers match.
Might make sense to have the "Message" column first, as it is probably the most important content.

smccabe’s picture

@jnrfred if you just have it reload via ajax when the comment is added it should work fine.

Agree with jason about flipping columns, but that should be a commerce patch.

smccabe’s picture

StatusFileSize
new7.66 KB

Well this issue is just the devil itself, I ended up down the rabbit hole of some PHP memory allocation issue related to late static bindings, which was not fun.

Anyways, I've got a work around in for that and this patch is closer to done, I've cleaned up the ajax and simplified the interface as per Anders Paulsen's suggestions. There is no longer any specific save buttons or ajax, notes just save on any regular form submits, making it cleaner.

Still outstanding

  • Tests!
  • Parking orders doesn't correctly save the message for some reason.
jnrfred’s picture

@smccabe your patch fails to apply.
commerce_pos-display_order_comments-2950975-9.patch:17: trailing whitespace.

Checking patch src/Form/POSForm.php...
error: while searching for:
use Drupal\Core\Url;
use Drupal\commerce_price\Entity\Currency;
use Drupal\user\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**

error: patch failed: src/Form/POSForm.php:14
error: src/Form/POSForm.php: patch does not apply

Also, need to remove dpm($comment) from code

+  public function saveOrderComment(array &$form, FormStateInterface $form_state) {
+    $order = $this->entity;
+
+    $comment = $form_state->getValue([
+      'order_comments',
+      'add_order_comment',
+      'order_comment_text'
+    ]);
+
+    dpm($comment);
+
jnrfred’s picture

Got the parking order to save order comments and did some code clean up as well for today.

smccabe’s picture

Status: Needs work » Needs review

The last submitted patch, 9: commerce_pos-display_order_comments-2950975-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work
smccabe’s picture

Status: Needs work » Needs review
StatusFileSize
new17.69 KB

Updated and added tests.

Status: Needs review » Needs work

  • smccabe committed 7846b16 on 8.x-2.x authored by jnrfred
    Issue #2950975 by jnrfred, smccabe, jjpoole, axel.rutz: Display Order...
smccabe’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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