2

I enabled the Gift Messages on Order Level by going to System > Configuration > Sales > Sales > Gift Options. Now - the Gift message shows up on the delivery page during the checkout process.

But it requires (unnecessarily) the customer to click on two check-marks before they get to the actual text field to fill in the their gift message.

In /public_html/app/design/frontend/base/default/template/giftmessage/inline.phtml, I have below code.

<div class="gift-messages-form" id="allow-gift-message-container">
    <div class="inner-box">
        <?php if ($this->isMessagesAvailable()): ?>
            <h4><?php echo $this->__('Your Message for the Entire Order.'); ?></h4>
            <p>
                <input type="checkbox" name="allow_gift_messages_for_order" id="allow_gift_messages_for_order" value="1" onclick="toogleVisibilityOnObjects(this, ['allow-gift-messages-for-order-container']);"<?php if($this->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
                <label for="allow_gift_messages_for_order"><?php echo $this->__('Add a Message for the Entire Order') ?></label>
            </p>
            <div class="allow-gift-messages-for-order-container" id="allow-gift-messages-for-order-container" style="display:none">
                <p><?php echo $this->__('You can leave this box blank if you do not wish to add a gift message for whole order.') ?></p>
                <input type="hidden" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][type]"  value="quote" />
                <ul class="form-list">
                    <li class="fields">
                        <div class="field">
                            <label for="gift-message-whole-from" class="required"><?php echo $this->__('From') ?></label>
                            <div class="input-box">
                                <input type="text" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][from]" id="gift-message-whole-from" title="<?php echo $this->__('From') ?>"  value="<?php echo $this->getEscaped($this->getMessage()->getSender(), $this->getDefaultFrom()) ?>" class="input-text validation-passed" />
                            </div>
                        </div>
                        <div class="field">
                            <label for="gift-message-whole-to" class="required"><?php echo $this->__('To') ?></label>
                            <div class="input-box">
                                <input type="text" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][to]" id="gift-message-whole-to" title="<?php echo $this->__('To') ?>" value="<?php echo $this->getEscaped($this->getMessage()->getRecipient(), $this->getDefaultTo()) ?>" class="input-text validation-passed" />
                            </div>
                        </div>
                    </li>
                    <li class="wide">
                        <label for="gift-message-whole-message" class="required"><?php echo $this->__('Message') ?></label>
                        <div class="input-box">
                            <textarea id="gift-message-whole-message" onchange="toogleRequired('gift-message-whole-message', ['gift-message-whole-from','gift-message-whole-to'])" class="input-text validation-passed giftmessage-area" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][message]" title="<?php echo $this->__('Message') ?>" rows="5" cols="10"><?php echo $this->getEscaped($this->getMessage()->getMessage()) ?></textarea>
                        </div>
                    </li>
                </ul>

Is this the right file that I need to make changes? If yes, then how could I do that?

How can I make the gift card mandatory and restrict to 60 characters?

Basically - I need the Gift message enabled without customers having to click on the check boxes...


UPDATED on March 25th, 2019: The solution for me was to add some CSS style coding to an existing CSS file.

2 Answers 2

1
+50

Replace this

<?php if($this->getEntityHasMessage()): ?> checked="checked"<?php endif; ?>

with

 checked="checked"

and add the class required-entry on the textarea for messages.

1
  • Hi Marius - thanks for helping! I tried to do exactly what you said - I have 2 strings of that code - I tried replacing either one or both but it does not work...in the end - that line looks like this - is that correct? <input type="checkbox" name="allow_gift_messages_for_order_<?php echo $this->getEntity()->getId() ?>" id="allow_gift_messages_for_order_<?php echo $this->getEntity()->getId() ?>" value="1" onclick="toogleVisibilityOnObjects(this, ['allow-gift-messages-for-order-container-<?php echo $this->getEntity()->getId() ?>']);"checked="checked" class="checkbox" />
    – Allysin
    May 23, 2015 at 15:42
0

A bit late but you can also do that.
Comment in your code:

 <h4><?php echo $this->__('Gift Options for the Entire Order.'); ?></h4>
                <p>
                    <input type="checkbox" name="allow_gift_messages_for_order" id="allow_gift_messages_for_order" value="1" onclick="toogleVisibilityOnObjects(this, ['allow-gift-messages-for-order-container']);"<?php if($this->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
                    <label for="allow_gift_messages_for_order"><?php echo $this->__('Add gift options for the Entire Order') ?></label>
                </p>  

Then replace

onclick="toogleVisibilityOnObjects(this, ['allow-gift-message-container']);

by

onclick="toogleVisibilityOnObjects(this, ['allow-gift-message-container']);toogleVisibilityOnObjects(this, ['allow-gift-messages-for-order-container']);  

This way you basically call the toogleVisibilityOnObjects on both the containers that you need to display.
Hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.