Tags:

How to disable the Gift Message Extension in Magento 1?

Profile picture of Christoph Maßmann Chris
created on , last updated on Follow me
Gift

While tweaking your Magento 1 online shop for performance you might have come into try to remove the default Mage_GiftMessage extension.
Unfortunately like many other default extensions, this module cannot be removed so easily because of some errorneous, hidden dependencies in other modules.
So let’s have a look what needs to be done in order to remove the default Magento Gift Message Extension.

As I said the Mage_GiftMessage module has some hidden dependencies in the core modules. “Hidden” because dependencies should be clearly stated in the module XML file and it should in theory be possible to disable the module without any interferences in other modules.

So first of all let’s disable the gift message module:

<Mage_GiftMessage>
    <active>false</active>
</Mage_GiftMessage>

Changes in Magento Frontend Theme

Next we have to remove some dependencies, first one is in order email template in app/design/frontend/base/default/template/email/sales/order/items.phtml.

Of course you should overwrite this file within your own Magento theme. Let's remove everything within these lines:

<?php if ($this->helper('giftmessage/message')->isMessagesAvailable('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
...
<?php endif; ?>

Changes in Magento Admin Theme

After that we have to go into adminhtml theme file app/design/adminhtml/default/default/layout/sales.xml and remove this part (you ideally again create your own admin theme for that):

<block type="adminhtml/template" name="gift_options" template="sales/order/giftoptions.phtml">
    <block type="adminhtml/sales_order_view_giftmessage" name="order_giftmessage" template="sales/order/view/giftmessage.phtml"></block>
</block>

The next problem is the product attribute gift_message_available. This system attribute uses the frontend input renderer class giftmessage/adminhtml_product_helper_form_config which can no longer be autoloaded because the "giftmessage" block resolution does not work any more after disabling the Gift Message Extension. The attribute cannot be removed via the backend because it is a system attribute. I also prefer to keep it there just in case we will later re-enable the Gift Message functionality for some reason.

So to simply fix this and be able to show the product admin page, we re-add the Gift Message block definition in a new Extension like this:

<blocks>
    <giftmessage>
        <class>Mage_GiftMessage_Block</class>
    </giftmessage>
<blocks>

Finally go to template file app/design/adminhtml/default/default/template/downloadable/sales/order/view/items/renderer/downloadable.phtml and remove this part:

<?php if ($this->canDisplayGiftmessage()): ?> class="border"<?php endif; ?>

That’s it, now we have removed all hidden dependencies and the Magento Gift Message Extension is finally completely disabled!


Post Comments to "How to disable the Gift Message Extension in Magento 1?"

Submit Comment

With the use of this comment form you agree to the saving and processing of your data by this website. More information about the processing of your data can be found in our privacy statement.
Your data will be transmitted securely via SSL.

Meine Magento Extension Bestseller