AbanteCart Community

AbanteCart Development => Customization help => Topic started by: Geoffrey on July 13, 2017, 06:46:19 PM

Title: How to move Order Comments from g_s_2 to g_s_3 ?
Post by: Geoffrey on July 13, 2017, 06:46:19 PM
I'd like to move the Order Comments from guest_step_2 to guest_step_3 (confirm.tpl). 

There are three steps.  I need help with the 3rd step. 

Step 1
Create a heading title for the comment box on the guest_step_3 (confirm) page.
Method: create a new language key: Block = checkout_confirm, Key = heading_title_joe, Translation = Add Comments about your Order here:    .

Step 2
Insert the new heading title into the form body of confirm.tpl.
Method: open confirm.tpl, on about line 42, add this:
Code: [Select]
<h4 class="heading4"><?php echo $heading_title_joe?></h4>
Step 3
Add the comment registerbox immediately under the heading title, like this:
Code: [Select]
<div class="registerbox">
<div class="content">
<?php echo $form['comment']; ?>
</div>
</div>

Step 3 didn't work because I don't know how to code. 

The confirm.tpl file does not recognize $form['comment'] the same way that the guest_step_2.tpl file does because <?[i don't know]; ?!!crap!* != [good outcome] ?qhq?>{bbq}.

I'm sure this is an easy one.  Any help?
Title: Re: How to move Order Comments from g_s_2 to g_s_3 ?
Post by: eCommerce Core on July 14, 2017, 03:22:14 PM
This is because step 2 controller adds comment value

https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/guest_step_2.php#L410

It is not available in step #3

You need to know PHP in order to make this change in
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/guest_step_3.php
Title: Re: How to move Order Comments from g_s_2 to g_s_3 ?
Post by: Geoffrey on October 18, 2017, 06:33:12 PM
This is what I tried:

/storefront/controller/pages/checkout/guest_step_3.php

On line 76, insert this:

Code: [Select]
if ($this->request->is_POST()){
                    $this->session->data['comment'] = $this->request->post['comment'];
                    $this->extensions->hk_ProcessData($this);
        }

On line 165, insert this:

Code: [Select]
$form = new AForm();
$form->setForm(array ('form_name' => 'guest'));
$this->data['form']['form_open'] = $form->getFieldHtml(
array (
    'type'   => 'form',
                    'name'   => 'guest',
                    'action' => $action,
                    'csrf' => true
                )
        );

$this->data['form']['comment'] = $form->getFieldHtml(
array (
'type'  => 'textarea',
'name'  => 'comment',
'value' => $this->data['comment'],
'attr'  => ' rows="3" style="width: 99%" '));

/storefront/controller/pages/checkout/guest_step_2

Remove (comment out) line 114 and lines 411-417. 

////mytemplate/pages/checkout/confirm.tpl

On line 70, insert this:

Code: [Select]
<div class="ted"><h4 class="heading4"><?php echo $text_comment_dave?></h4></div>

<div class="registerbox">
<div class="content">
<?php echo $form['comment']; ?>
</div>
</div>

////mytemplate/pages/checkout/guest_step_2.tpl

Remove (comment out) the heading, registerbox, and form-comment from guest_step_2.

Outcome:

The Order Comments box is now located on GS3-Confirm page, but it doesn't work. 
The customer comments are not transmitted to AC system.  They cannot be viewed anywhere, they don't exist.

Can you help? 

Thanks.
Title: Re: How to move Order Comments from g_s_2 to g_s_3 ?
Post by: Geoffrey on October 19, 2017, 03:22:44 PM
Anyone?