Jump to content

Version [1.6.0.14] Trying to duplicate button in BO order detail


Recommended Posts

I am trying to create a similar button in Back office Order Detail that registers the tracking number of the order.

Basically this new button + form is a warehouse order id that I want to keep as a record for each order, besides the courier tracking number.

 

I have created a new column in the database in ps_orders (id_isis_order) and ps_order_carrier (id_wh_order).

i have attached the screen shot.

 

I have also changed the tpl to have the form in place. Name of the button will be submitWarehouseNumber.

 

As for the controller side, i copy and edit the variables to my own database name, I'm not sure if I am going it right or not? Will this work?

if (Tools::isSubmit('submitWarehouseNumber') && isset($order))
		{
			if ($this->tabAccess['edit'] === '1')
			{
					$order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier'));
				
					// update shipping number
					// Keep these two following lines for backward compatibility, remove on 1.6 version
					$order->id_isis_order = Tools::getValue('id_wh_order');
					$order->update();

					// Update order_carrier
					$order_carrier->id_wh_order = pSQL(Tools::getValue('id_wh_order'));
					if ($order_carrier->update())
					{
							Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier), null, false, true, false, $order->id_shop);
							Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
					}
					else
						$this->errors[] = Tools::displayError('The order carrier cannot be updated.');
				
			}
			else
				$this->errors[] = Tools::displayError('You do not have permission to edit this.');
		}

Do I need to change anything for this line?

Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier), null, false, true, false, $order->id_shop);

I cannot find the name 'actionAdminOrdersTrackingNumberUpdate' in database. So not sure if I should create a new name for this new button.

 

 

post-943662-0-61936800-1466575407_thumb.png

post-943662-0-51013600-1466575450_thumb.png

post-943662-0-99272300-1466575654_thumb.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...