Search code examples
magento-1.7magento

"add products" button missing from admin create order page - magento


We've just upgraded our site from 1.6.X to 1.7.0.2 and encountered this problem, 99% of the site is running fine.

When you go to sales/orders & create new order the "add products" button is missing? ive checked the styles and there is just a blank div where the button should be -

<div class="form-buttons"></div>

I've tried un-installing extensions, re-installing magento 1.7.0.2 from magento connect & i've also manually downloaded / over written the adminhtml folder, none of which have had any effect.

We also installed a fresh copy of magento with a blank database to the same server & the button is present.

Any ideas?


Solution

  • The changes is in the file located here :

    /app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php around line 55

    In previous version the getButtonsHtml() function was :

    public function getButtonsHtml()
    {
        $addButtonData = array(
            'label' => Mage::helper('sales')->__('Add Products'),
            'onclick' => "order.productGridShow(this)",
            'class' => 'add',
        );
        return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
    }
    

    The new version is :

    public function getButtonsHtml()
    {
        $html = '';
        // Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one.
        $this->_buttons = array_reverse($this->_buttons);
        foreach ($this->_buttons as $buttonData) {
            $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
        }
    
        return $html;
    }
    

    So now you can have more than 1 button, but the first default button doesn't exists anymore.

    I'm not sure how to add it without overwritting this block.