chameleon-system-private/pkgshopcustomercomment

Ergaenzt den Bestellprozess um ein Bemerkungsfeld auf der letzten Seite des Bestellprozesses

8.0.45 2025-12-15 13:42 UTC

README

This package adds a field to the order to allow customer comments for an order. The comment is saved in the field customer_comment in the order table and may be added to the e-mail template.

Adding the Field to Templates

Change the following line in TShopStepConfirm/confirm.view.php

<?php
// if ($oMessageManager->ConsumerHasMessages(MTShopBasketCore::MSG_CONSUMER_NAME . '-agb')) {
if ($oMessageManager->ConsumerHasMessages(MTShopBasketCore::MSG_CONSUMER_NAME . '-agb'))
    || $oMessageManager->ConsumerHasMessages(MTShopBasketCore::MSG_CONSUMER_NAME . '-comment')) {
        echo '<div class="cmsmessage messageerror">' . TGlobal::OutHTML(TGlobal::Translate('Es sind Fehler aufgetreten (Details s. unten)')) . '</div>';
}
?>

If you use an older template without twig you need to add the following to TShopStepConfirm/confirm.view.php. A good position for the form is below the "change items" button (around line 210).

<div class="confirmOrderCustomerComment"><br/>
    <strong><?=TGlobal::OutHTML(TGlobal::Translate('Deine Bemerkung:'))?></strong><br/>

    <textarea name="customerComment" maxlength="5000"><?= TGlobal::OutHTML($customerComment) ?></textarea>

    <?php
    if ($oMessageManager->ConsumerHasMessages(MTShopBasketCore::MSG_CONSUMER_NAME . '-comment')) {
        echo $oMessageManager->RenderMessages(MTShopBasketCore::MSG_CONSUMER_NAME . '-comment');
    }
    ?>
</div>

If you use a twig based template that is not the Chameleon Shop default template or you have a copy of shopBasketCheckoutConfirmStep.html.twig in your theme, you need to add the new field to the template (this is already in the latest standard theme):

<div class="customerCommentContainer">
    {% block fieldMessage %}
        {% set aFieldMessageMapped = {'sLabelText' : 'Ihre Anmerkungen zur Bestellung' | trans,
        'sInputClass' : 'span5',
        'sName' : 'customerComment',
        'sFieldId': "customerComment",
        'bRequired' : false,
        'sError': aFieldCustomerComment.sError,
        'sValue' : aFieldCustomerComment.sValue} %}
        {% include "/common/userInput/form/textarea.html.twig" with aFieldMessageMapped%}
    {% endblock %}
</div>

Please note: That you may need to move the tag up in the code in TShopStepConfirm/confirm.view.php to surround the new field

After setup, there is a new placeholder __"customer_comment"__ available in the order email template, so you should add this.