I need assistance with creating a custom button that appears in the Customer Account sidebar menu if enabled in their customer account admin area.

This button's URL should also be able to be managed from the Magento Admin Customer Accounts area. For instance, if I want a customer that clicks on this custom button to be taken to google.com I should be able to insert that URL in the Magento Customer management area for that customer.

1 Answer 1


Your question is a bit generic, and so my answer can only cover so many bases.

In your module, create an install script that sets up a new attribute:

        'type'      => 'int',
        'label'     => 'Custom Attribute',
        'visible'   => true,
        'required'  => false,
        'input'     => 'select',
        'source'    => 'adminhtml/system_config_source_yesno',

More information about installing attributes can be found here:


And specific to customer attributes, see this related SO post:


Once installed, you can access your attribute on the customer model:


Where CustomAttribute gets mapped to the custom_attribute ID you specified for the customer entity when installing the attribute. With this attribute now available on the frontend, you can use it to control display logic for your button.

Considering the above requires you to have a module to work from, then add to its config.xml some provisions for a layout update:

<!-- app/code/local/Namespace/Module/etc/config.xml -->

And in that layout XML file, add this:

<!-- app/design/frontend/[package]/[theme]/layout/yourmodule.xml -->
    <reference name="left">
        <block type="core/template" name="customer.account.custom.attribute" as="custom_attribute" template="customer/account/custom_attribute.phtml" />

Here we're tapping into the left area of the page layout and appending a new block of generic type. We also reference a template here that you'll need to build:

<?php # app/design/frontend/[package]/[theme]/template/customer/account/custom_attribute.phtml ?>
<?php $_customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
<?php if ($_customer && $_customer->getCustomAttribute()) : ?>
<button type="button">Button Label</button>
<?php endif; ?>

Ideally here you would have your own block type which tucks away the call for the customer model from the session, but for the sake of brevity, and because I really don't know what you're working with currently, this should be sufficient.

Your Answer

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

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