0

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

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));
  • is there an additional param i need to add to stop it redirecting me to the dashboard? – develophper Jan 14 '15 at 9:00
  • Nope. How does your url look like? – Lord Skeletor Jan 14 '15 at 9:13
  • http://mysite.localhost/shop/index.php/admin/sales_order_create/index/customer_id/74/store_id/1/ this just goes to the dashboard (i'm using the second option with store id but it happens with both) – develophper Jan 14 '15 at 9:17
  • key param is missing for some reason. Try with the snippet I just added. Url should look like index.php/admin/sales_order_create/index/customer_id/137/store_id/1/key/23c81d9...... – Lord Skeletor Jan 14 '15 at 9:27
  • The bottom option works perfectly. Thank you! – develophper Jan 14 '15 at 9:28
0

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));
  • is there an additional param i need to add to stop it redirecting me to the dashboard? – develophper Jan 14 '15 at 9:06

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.