Question

I want to generate a link to the sales create order page (manual order page) in the admin and submit a customer id so that it opens automatically with the customers details filled out in the address form.

  index.php/admin/sales_order_create/index/key

I know sometimes a $this->getUrl('path') works but I can't find any instructions online for setting a customer before the page loads. A solution like the following would obviously be ideal.

 $this->getUrl('sales/order/create/', $customer_id);
Was it helpful?

Solution

In your admin template or block file:

echo $this->getUrl('*/sales_order_create', array('customer_id' => 137));

This will land you on store selection page. If you already know store id you can add that as well:

echo $this->getUrl('*/sales_order_create', array('customer_id' => 137, 'store_id' => 1));

EDIT

Alternative method

echo $this->helper('adminhtml')->getUrl('*/sales_order_create', array('customer_id' => 137, 'store_id' => 1));

OTHER TIPS

Assuming $customer_id is already the correct ID for the customer, I think you'd just need:

$this->getUrl('sales/order/create/', array('customer_id' => $customer_id));
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top