0

I would like to make the "Custom" redirect option the default when creating URL Rewrites. Is that possible and, if so, how?

0

Quick and dirty solution would be to override core file Mage_Adminhtml_Block_Urlrewrite and replace

return $this->getUrl('*/*/edit') . array_shift($modes);

with

return $this->getUrl('*/*/edit') . array_pop($modes);

in getCreateUrl().

To do it the better way, create a module and listen for the event core_layout_block_create_after. Your observer method should look similar to the following. Maybe you want to additionally check for the request to limit the substitution to a certain action.

public function updateUrlrewriteButton (Varien_Event_Observer $observer)
{
    $block = $observer->getBlock();

    if ( $block instanceof Mage_Adminhtml_Block_Urlrewrite )
    {
        $block->updateButton
        (
            'add',
            null,
            array
            (
                'label'     => Mage::helper('adminhtml')->__('Add URL Rewrite'),
                'onclick'   => 'setLocation(\'' . $block->getUrl('*/*/edit') . 'id' .'\')',
                'class'     => 'add',
                'area'      => 'header',
                'sort_order'=> '10',
            )
        );
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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