Jump to content
thirty bees forum

Question

Posted

So I don't know if this is a bug or a feature but I wanted to replace the Gift Wrapping option with a custom one, and for that I want the gift message text removed. Everything works and the gift message disappeared after I commented out the following part in the order-carrier.tlp file:

<p id="gift_div">
						<label for="gift_message">{l s='If you\'d like, you can add a note to the gift:'}</label>
						<textarea rows="2" cols="120" id="gift_message" class="form-control" name="gift_message">{$cart->gift_message|escape:'html':'UTF-8'}</textarea>
					</p>

However, now I have the issue that it gives me the error "Invalid gift message" even though I removed the message field which is strange, because it shouldn't be a mandatory thing. Or at least it wasn't mandatory in PS 1.6.
Does anyone know how to fix this?

Screenshot2024-03-20173946.thumb.png.692263f60eb1184049f4084d6b1ba7dd.png

10 answers to this question

Recommended Posts

  • 0
Posted (edited)

Without knowing what theme, which TB you are using?

And where do you edit the message? BO? File?

Edited by nickz
  • 0
Posted

by commenting it out, you are removing the field from the form and thats why you are getting the error message from the server... because its missing 1 of its fields.

you can just hide it from display to avoid this problem. like wrapping it with display: none.

another option is to comment it out like you did, but add an hidden input field with the same name.

like: <input type="hidden" name="gift_message">

  • 0
Posted
12 hours ago, nickz said:

Without knowing what theme, which TB you are using?

And where do you edit the message? BO? File?

I am just using the normal Niara theme and TB 1.5.1
I edited the file "order-carrier.tpl"

  • 0
Posted
2 hours ago, yaniv14 said:

by commenting it out, you are removing the field from the form and thats why you are getting the error message from the server... because its missing 1 of its fields.

you can just hide it from display to avoid this problem. like wrapping it with display: none.

another option is to comment it out like you did, but add an hidden input field with the same name.

like: <input type="hidden" name="gift_message">

Thank you for your advice, I am coming from PrestaShop and recently switched to TB and the gift message was not mandatory in PS8 (I used the same method to get rid of the message in PS8 and it did let me continue) But in TB it seems to be mandatory to have a gift message... I am sorry, but where do I put the hidden input field in?

  • 0
Posted

if you decided to commet out the part of code you mentioned above than you can put the hidden input right above it

<input type="hidden" name="gift_message">
{* 
<p id="gift_div">
  .....
</p>
*}

but also just hidding it with css will to do job just fine

<p id="gift_div" style="display: none !important;">
  ...
</p>

 

  • 0
Posted

Thank you kindly but unfortunately after trying out both solutions, clearing caches and trying different browsers it still ends up giving me the "Invalid gift message" error. Do you have any other solution or clue to why this error could still occur?

  • 0
Posted

The code goes through following process:

if the post request contains gift field with value 1, then gift_message must be set and valid -- non-empty string.

So either make sure that

  • gift input field is not present
  • or is set to 0
  • or that post contains dummy gift message - for example 
    <input type="hidden" name="gift_message" value="dummy">
  • or override ParentOrderController::_processCarrier and remove this condition 

 

  • Like 1
  • 0
Posted

In order-detail.tpl template, modify this code:

    {if $order->gift}
      <p><i class="icon icon-2x text-success icon-gift"></i> {l s='You have requested gift wrapping for this order.'}</p>
      <p><strong>{l s='Message'}</strong> {$order->gift_message|nl2br}</p>
    {/if}

 

  • Like 1

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...