Enable Admin notes that are only visible to Admin

Enable Admin notes that are only visible to Admin. Currently, adding notes to the Admin notes field they also visible in the vendor account. How can this be fixed?

This behaviour can be changed with small code modification

Would you be able to advise me on what small change is needed please?
Thanks Shlomo

Just use hooks in the corresponding functions or templates to hide notes for vendors

Hello!

You can change the default behavior by overriding this hook: orders:totals from the design/backend/templates/views/orders/details.tpl template.

For example, you can wrap the:

                <div class="span6">
                    <label for="notes">{__("customer_notes")}</label>
                    <textarea class="span12" name="update_order[notes]" id="notes" cols="40" rows="5">{$order_info.notes}</textarea>
                </div>

into the following conditions:

{if $auth.user_type === "UserTypes::ADMIN"|enum}
...
{/if}

I hope it will help you.

Hi,
I’m not so confident about making such changes. Can you show what the complete section should look like, please? Then I can simply copy and paste it.
Thank you

  • enable the My changes module
  • create the design/backend/templates/addons/my_changes/hooks/orders/totals.override.tpl file
            <div class="order-notes statistic">

            <div class="clearfix">
                <div class="table-wrapper">
                    <table class="pull-right">
                        <tr class="totals">
                            <td class="totals-label">&nbsp;</td>
                            <td class="totals" width="100px"><h4>{__("totals")}</h4></td>
                        </tr>

                        <tr>
                            <td class="statistic-label">{__("subtotal")}:</td>
                            <td class="right" data-ct-totals="subtotal">{include file="common/price.tpl" value=$order_info.display_subtotal}</td>
                        </tr>

                        {if $order_info.display_shipping_cost|floatval}
                            <tr>
                                <td class="statistic-label">{__("shipping_cost")}:</td>
                                <td class="right" data-ct-totals="shipping_cost">{include file="common/price.tpl" value=$order_info.display_shipping_cost}</td>
                            </tr>
                        {/if}

                        {if $order_info.discount|floatval}
                            <tr>
                                <td class="statistic-label">{__("including_discount")}:</td>
                                <td class="right" data-ct-totals="including_discount">{include file="common/price.tpl" value=$order_info.discount}</td>
                            </tr>
                        {/if}

                        {if $order_info.subtotal_discount|floatval}
                            <tr>
                                <td class="statistic-label">{__("order_discount")}:</td>
                                <td class="right" data-ct-totals="order_discount">{include file="common/price.tpl" value=$order_info.subtotal_discount}</td>
                            </tr>
                        {/if}

                        {if $order_info.coupons}
                            {foreach from=$order_info.coupons key="coupon" item="_c"}
                                <tr>
                                    <td class="statistic-label">{__("discount_coupon")}:</td>
                                    <td class="right" data-ct-totals="discount_coupon">{$coupon}</td>
                                </tr>
                            {/foreach}
                        {/if}

                        {if $order_info.taxes}
                            <tr>
                                <td class="statistic-label">{__("taxes")}:</td>
                                <td class="right"></td>
                            </tr>

                            {foreach from=$order_info.taxes item="tax_data"}
                                <tr>
                                    <td class="statistic-label">&nbsp;<span>&middot;</span>&nbsp;{$tax_data.description}&nbsp;{include file="common/modifier.tpl" mod_value=$tax_data.rate_value mod_type=$tax_data.rate_type}{if $tax_data.price_includes_tax == "Y" && ($settings.Appearance.cart_prices_w_taxes != "Y" || $settings.Checkout.tax_calculation == "subtotal")}&nbsp;{__("included")}{/if}{if $tax_data.regnumber}&nbsp;({$tax_data.regnumber}){/if}</td>
                                    <td class="right" data-ct-totals="taxes-{$tax_data.description}">{include file="common/price.tpl" value=$tax_data.tax_subtotal}</td>
                                </tr>
                            {/foreach}
                        {/if}

                        {if $order_info.tax_exempt == "Y"}
                            <tr>
                                <td class="statistic-label">{__("tax_exempt")}</td>
                                <td class="right">&nbsp;</td>
                            </tr>
                        {/if}

                        {if $order_info.payment_surcharge|floatval && !$take_surcharge_from_vendor}
                            <tr>
                                <td class="statistic-label">{$order_info.payment_method.surcharge_title|default:__("payment_surcharge")}:</td>
                                <td class="right" data-ct-totals="payment_surcharge">{include file="common/price.tpl" value=$order_info.payment_surcharge}</td>
                            </tr>
                        {/if}

                        {hook name="orders:totals_content"}
                        {/hook}
                        <tr>
                            <td class="statistic-label"><h4>{__("total")}:</h4></td>
                            <td class="price right" data-ct-totals="total">{include file="common/price.tpl" value=$order_info.total}</td>
                        </tr>
                    </table>
                </div>
            </div>

            <div class="note clearfix">
                <div class="span6">
                    <label for="notes">{__("customer_notes")}</label>
                    <textarea class="span12" name="update_order[notes]" id="notes" cols="40" rows="5">{$order_info.notes}</textarea>
                </div>
            {if $auth.user_type === "UserTypes::ADMIN"|enum}
                <div class="span6">
                    <label for="details">{__("staff_only_notes")}</label>
                    <textarea class="span12" name="update_order[details]" id="details" cols="40" rows="5">{$order_info.details}</textarea>
                </div>
            {/if}
            </div>

            </div>
  • clear cache
  • check the result

(!) Not tested

@sigmod You will need to copy all the code located between

            <!--{***** Customer note, Staff note & Statistics *****}-->
            {hook name="orders:totals"}

and

            {/hook}

            <!--{***** /Customer note, Staff note & Statistics *****}-->

from the design/backend/templates/views/orders/details.tpl template, into the design/backend/templates/addons/my_changes/hooks/orders/totals.override.tpl file. In that code, you will need to replace the following one:

                <div class="span6">
                    <label for="notes">{__("customer_notes")}</label>
                    <textarea class="span12" name="update_order[notes]" id="notes" cols="40" rows="5">{$order_info.notes}</textarea>
                </div>

with the one, that was suggested by @ecomlabs