Remove Comments

Open to all! Ask other shopowners for help.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Remove Comments

Post by heatherbell »

raiwa wrote: Thu Feb 08, 2024 5:34 pm Maybe:
The warning stays the same.


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Remove Comments

Post by heatherbell »

Omar_one wrote: Thu Feb 08, 2024 6:32 pmmaybe a start
Yes, but couldn't get it to hide the divs and label with css
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Remove Comments

Post by heatherbell »

ecartz wrote: Fri Feb 09, 2024 3:29 am we could look at moving the comment processing into a code segment so that you could disable it.
Definitely +1 to that
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Remove Comments

Post by raiwa »

ecartz wrote: Fri Feb 09, 2024 3:29 am Delete the first block entirely. For the second block:

Code: Select all

  <div class="form-group row">
    <label for="inputComments" class="col-form-label col-sm-4 text-sm-right"><?= ENTRY_COMMENTS ?></label>
    <div class="col-sm-8"><?= $comments_textarea ?></div>
  </div>
replace with Or use the class, something like

Code: Select all

<?= new Input('comments', ['value' => ''], 'hidden') ?>
You don't need the textarea, the variable, nor the id.
I did the second change suggested by @cartz and it works error free.

Make sure to do it in both pages, checkout_shipping.php and checkout_payment.php

You should also remove these code:

Code: Select all

  $comments_textarea = new Textarea('comments', [
    'cols' => '60',
    'rows' => '5',
    'id' => 'inputComments',
    'placeholder' => ENTRY_COMMENTS_PLACEHOLDER,
  ]);

  if (isset($_SESSION['comments'])) {
    $comments_textarea->set_text($_SESSION['comments']);
  }
Maybe you removed the first part and left the second part:

Code: Select all

 
  if (isset($_SESSION['comments'])) {
    $comments_textarea->set_text($_SESSION['comments']);
  }
Which could cause the error.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Remove Comments

Post by heatherbell »

raiwa wrote: Fri Feb 09, 2024 7:39 am I did the second change suggested by @cartz and it works error free.
Make sure to do it in both pages, checkout_shipping.php and checkout_payment.php
TY. As per OP, had not seen/changed Lines 149-154 checkout_shipping.php
So to clarify for future readers.
To remove or hide comments on checkout_shipping and checkout_payment:

checkout_shipping.php Lines 118-127
remove

Code: Select all

  $comments_textarea = new Textarea('comments', [
    'cols' => '60',
    'rows' => '5',
    'id' => 'inputComments',
    'placeholder' => ENTRY_COMMENTS_PLACEHOLDER,
  ]);

  if (isset($_SESSION['comments'])) {
    $comments_textarea->set_text($_SESSION['comments']);
  }
checkout_shipping.php Lines 149-154
change from

Code: Select all

  <div class="form-group row">
    <label for="inputComments" class="col-form-label col-sm-4 text-left text-sm-right"><?= ENTRY_COMMENTS ?></label>
    <div class="col-sm-8">
      <?= $comments_textarea ?>
    </div>
  </div>
to

Code: Select all

  <?= new Input('comments', ['value' => ''], 'hidden') ?>
checkout_payment.php Lines 118-121
change from

Code: Select all

  <div class="form-group row">
    <label for="inputComments" class="col-form-label col-sm-4 text-sm-right"><?= ENTRY_COMMENTS ?></label>
    <div class="col-sm-8"><?= $comments_textarea ?></div>
  </div>
to

Code: Select all

  <?= new Input('comments', ['value' => ''], 'hidden') ?>
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Remove Comments

Post by raiwa »

ecartz wrote: Fri Feb 09, 2024 3:29 am In the longer term, we could look at moving the comment processing into a code segment run by hook so that you could disable it.
I know that this is an old discussion. But I still believe that, at least, a partial modularisation and content/layout modules would be better and more user friendly than hooks.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 422 times

Re: Remove Comments

Post by burt »

This seems to imply that you removed the $comments_textarea (L18 - L26) rather than simply adding in "hidden" to the parameters.
heatherbell wrote: Fri Feb 09, 2024 5:53 am
burt wrote: Thu Feb 08, 2024 7:19 pm Add hidden;
And change this:
This changed the warning to:
PHP Warning: Undefined variable $comments_textarea in //templates/override/includes/pages/checkout_payment.php on line 105
Stack trace:
1. {main}() //checkout_payment.php:0
2. require() //checkout_payment.php:25
Not that it matters as you have found a solution now.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply