Jump to content

Change place order message


kenio

Recommended Posts

Hi,

 

i got little problem with changing place of order message textarea from address step to payment step. By default it's in step 3(address), but i would like to have it only in step 5 (payment).

 

I tried to copy and delete this code from order-address.tpl

{if !$opc}
		<div id="ordermsg" class="clearfix">
			<p class="txt">{l s='If you would like to add a comment about your order, please write it below.'}</p>
			<p class="textarea"><textarea cols="60" rows="3" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p>
		</div>
		{/if}

and paste it to order-payment.tpl, ofcourse textarea appears, but not save any written text in it, also not show written text in backend etc. Like it not exist.

 

Is there any chance to get it work?

 

i would appreaciate for any help,

regards.

Link to comment
Share on other sites

Hi,

 

thanks for reply,

 

in OrderController.php in payment step (i think it's 5th step) i added this code, but it still don't work :(

 

end of my order-payment.tpl looks like that:

{if $opc}

<div id="opc_payment_methods-content">
{/if}
		
<div id="HOOK_PAYMENT">{$HOOK_PAYMENT}</div>
	
{if $opc}

</div>
{/if}

{else}
	
<p class="warning">{l s='No payment modules have been installed.'}</p>

{/if}

{if !$opc}
<div id="ordermsg" class="clearfix">
    <p class="txt">{l s='If you would like to add a comment about your order, please write it below.'}</p>
    <p class="textarea"><textarea cols="60" rows="3" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p>
</div>
{/if}

{if !$opc}
	
<p class="cart_navigation"><a href="{$link->getPageLink('order', true, NULL, "step=2")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
</p>

{else}
	
</div>

{/if}

</div>

and OrderController.php :

/**
	 * Payment step
	 */
	protected function _assignPayment()
	{
		global $orderTotal;

		// Redirect instead of displaying payment modules if any module are grefted on
		Hook::exec('displayBeforePayment', array('module' => 'order.php?step=3'));

		/* We may need to display an order summary */
		$this->context->smarty->assign($this->context->cart->getSummaryDetails());
		$this->context->smarty->assign(array(
			'total_price' => (float)($orderTotal),
			'taxes_enabled' => (int)(Configuration::get('PS_TAX'))
		));
		$this->context->cart->checkedTOS = '1';

		parent::_assignPayment();
		
		if (Tools::isSubmit('message'))
		$this->_updateMessage(Tools::getValue('message'));
	}
Link to comment
Share on other sites

no, it wasn't in <form>, i tried to add it but it still don't work and i think know why, if my thinking is right, it should be in form as you said and with submit button? in that last step there is no submit button cause of choice of payment which is <a href> links where each one of them reffer to payment view where is order button..

 

If i want to have order message in that step i must somehow change choice of payment from <a> links to <input type="radio"> buttons, and then add order submit button. Am i right?

Edited by kenio (see edit history)
Link to comment
Share on other sites

Hi,

 

i made some modifications,

 

example what i got in code:

<form id="payment" method="post">
    {if !$opc}
    <div class="payment-right">
        <div id="ordermsg" class="clearfix">
            <p class="txt">{l s='If you would like to add a comment about your order, please write it below.'}</p>
            <p class="textarea"><textarea cols="60" rows="3" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p>
        </div>
    </div>
    {/if}

    <input type="submit" class="exclusive_large" value="{l s='Go to last order step'}" onClick="$('#payment').attr('action','{$base_dir_ssl}modules/paybynetpl/payment.php');" title="{l s='Go to last order step'}" />
</form>

right now i got textarea in form and i got input type button for submitting to payment, it still don't work, i make form action onclick in button cause i got 3 same buttons and depends which payment is chosen, different action go on click.

 

I have no idea why it don't save text from textarea in backend :/

Link to comment
Share on other sites

  • 1 year later...

I tried to achieve the same but in step 4 (Delivery) in PS 1.6.0.8 but it also didn't work.

I added the following code to OrderController in step 4:

 

if (Tools::isSubmit('message'))
$this->_updateMessage(Tools::getValue('message'));
 
Anyone managed to move the order message to other page than step 3?
Edited by Jacek Es (see edit history)
Link to comment
Share on other sites

  • 6 months later...
  • 1 year later...

Hello, i do this to put message box in shopping-cart.tpl

....
<form action="{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}" method="post">
	<div id="ordermsg" class="form-group">
		<label>{l s='If you would like to add a comment about your order, please write it in the field below.'}</label>
		<textarea class="form-control" cols="60" rows="6" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea>
	</div>
	<p class="text-right cart_navigation clearfix">
			{*<a  href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&back={$back}')|escape:'html':'UTF-8'}{else}{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}{/if}" class="button btn btn-default standard-checkout button-medium" title="{l s='Proceed to checkout'}">
				<span>{l s='Proceed to checkout'} <i class="icon-chevron-right right"></i></span>
			</a>*}
			<button type="submit" name="postProcess" class="button btn btn-default button-medium">
				<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
			</button>
	</p>
</form>
....
in OrderController.php

  public function postProcess()
    {

      if (Tools::isSubmit('message')) {
          $this->_updateMessage(Tools::getValue('message'));
      }

        // Update carrier selected on preProccess in order to fix a bug of
        // block cart when it's hooked on leftcolumn
        if ($this->step == 3 && Tools::isSubmit('processCarrier')) {
            $this->processCarrier();
        }
    }
work great for me in PS 1.6.11 Edited by Alexandre Carette (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...
  • 3 years later...
On 3/22/2017 at 2:13 AM, Alexandre Carette said:

Hello, i do this to put message box in shopping-cart.tpl

 


....
<form action="{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}" method="post">
	<div id="ordermsg" class="form-group">
		<label>{l s='If you would like to add a comment about your order, please write it in the field below.'}</label>
		<textarea class="form-control" cols="60" rows="6" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea>
	</div>
	<p class="text-right cart_navigation clearfix">
			{*<a  href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&back={$back}')|escape:'html':'UTF-8'}{else}{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}{/if}" class="button btn btn-default standard-checkout button-medium" title="{l s='Proceed to checkout'}">
				<span>{l s='Proceed to checkout'} <i class="icon-chevron-right right"></i></span>
			</a>*}
			<button type="submit" name="postProcess" class="button btn btn-default button-medium">
				<span>{l s='Proceed to checkout'}<i class="icon-chevron-right right"></i></span>
			</button>
	</p>
</form>
....

in OrderController.php

 


  public function postProcess()
    {

      if (Tools::isSubmit('message')) {
          $this->_updateMessage(Tools::getValue('message'));
      }

        // Update carrier selected on preProccess in order to fix a bug of
        // block cart when it's hooked on leftcolumn
        if ($this->step == 3 && Tools::isSubmit('processCarrier')) {
            $this->processCarrier();
        }
    }

work great for me in PS 1.6.11

 

Working in 1.6.11, thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...