Hello, eglaw.
Thanks again for your module.
Problem:
information about the PVT table summary is displayed only in the footer of the form, but not in the bottom panel. The output in the panel would be more logical, because with large orders, it is important to see the final figures of the order before your eyes.
I tried to implement this as follows:
in "commerce_pvt/src/Plugin/views/area/TableSummary.php" in function "viewsForm" rewrite following rows:

  $form['footer'] = [
        '#type' => 'container',
        '#weight' => 100,
      ];

      $form['footer']['summary'] = [
        '#type' => 'item',
        '#markup' => $markup,
        '#prefix' => '<div class="order-total-line">',
        '#suffix' => '</div>',
      ];

to these ones:

 //      $form['footer'] = [
      //        '#type' => 'container',
      //        '#weight' => 100,
      //      ];

      $form['actions']['summary'] = [
        '#type' => 'button',
        '#attributes' => [
          'disabled' => TRUE,
          'class' => ['order-total-line'],
        ],
        '#value' => $markup,
      ];

Everything works, but this, IMHO, is another crutch. Is it possible to get the same effect in a more correct way?

best regards,

savage

Comments

savage1974 created an issue. See original summary.

savage1974’s picture

Issue summary: View changes
eglaw’s picture

StatusFileSize
new160.01 KB

Hi,

first-thing-first you can always HOOK_form_alter in a custom module/theme and move, break, alter form-elements as you wish, without any further interventions.

Then, i don't quite understand what you mean with:

…information about the PVT table summary is displayed only in the footer of the form, but not in the bottom panel.

bottom panel => $form['actions'] ? If yes, then why should the table summary go there? It's not an action, but a simple markup, therefor i separated them into 2 different containers.
Yet again:

…important to see the final figures of the order before your eyes.

Just make the footer area of the form somehow scrollable in Fixed position with CSS inside your theme, or alter the form twig template and move it elsewhere...

Also, remember that the FormView (a drupal core view rendered as a Form) is not as simple and straightforward as a SimpleView (which shows data).
PVT structure





Cheers

savage1974’s picture

StatusFileSize
new330.12 KB

Hello, eglaw
Thank you for your answer.
1. css styles (via position: absolute)- not a variant at all. I "played" with it and the result was bad
2. "information about the PVT table summary is displayed only in the footer of the form, but not in the bottom panel." - see pic. 1
3. HOOK_form_alter - agree with you. I used a tip from the atricle and went easy. I'll make a hook and write the code here.

best regards

eglaw’s picture

Anyway - that's Theming questions ... it's nowhere near the modules functionality's concern.
So based on these observations the only thing (maybe) is to add a checkbox on table summary configuration form to make it sticky or something like that... and that'll be a feature request (which i am not ready to make right now).
You can propose the solution into a patch, i'll gladly look into it and merge if so.

Peace, #staysafecovid19

maximkashuba’s picture

I suggest adding a new block `Commerce PVT summary` which can be placed anywhere on the page.
It provides the same summary data of the product variations added to the cart and has its own config. it is updated via ajax too the same as the cart block.

Here is my patch.

  • eglaw committed db34ab1 on 8.x-1.x authored by maximkashuba
    Issue #3124264 by maximkashuba, eglaw: Summary to form's bottom pane
    
eglaw’s picture

Status: Active » Fixed

Thx for patch

eglaw’s picture

Status: Fixed » Closed (fixed)