Ben
Ben

Reputation: 11

Magento: No 'Add product' button on back end new order

I've just installed the latest version of Magento 1.8 and everything is great and works perfectly. However, we've just discovered that there is no 'Add product' button on the admin new orders page. Everything else works as before, including:

It therefore seems to be an issue with just this button alone. We've tried the below fixes without any success:

At a loss as to what this could be. All other functions appear to be working. Has anyone got any pointers as to how to resolve this?

Upvotes: 1

Views: 1370

Answers (1)

Don
Don

Reputation: 333

This isn't exactly an ideal fix, because it involves changing core functionality, but the "Add Product" backend button is handled in:

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

What you're looking for specifically is the getButtonsHtml function. Having the same issue after upgrading from 1.6 to 1.9, I changed mine to look like this:

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);

    //If the buttons array isn't empty, let it do its thing
    if (!empty($this->_buttons))
    {
        foreach ($this->_buttons as $buttonData) {
            $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
        }
    }
    else {
        $addButtonData = array(
            'label' => Mage::helper('sales')->__('Add Products'),
            'onclick' => "order.productGridShow(this)",
            'class' => 'add',
        );

        $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
    }
    return $html;
}

It works, but it's really just a hackjob fix. I'm hoping someone more knowledgeable than I can come up with a proper solution.

Edit - Leaving the above answer, but I sussed out my personal problem. I was running a dual install of Magento, and I forgot to change the .htaccess of my Minify library to re-route to the newer install. So it was compiling the old 1.6 JavaScript and using it on my 1.9 install.

Upvotes: 1

Related Questions