View notification

  • Posts: 13
  • Thank you received: 0
  • Hikaauction Standard Hikamarket Frontedition Hikashop Business
1 year 1 month ago #282506

-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.1
-- PHP version -- : 7.0

hello, I need to access to the additional field created called trk_number, in the view changestatus.php subview notification.php, I have tried to load the additional data in the function changestatus() in the view.html.php to the following code:

	function changestatus(){

		$order_id = hikashop_getCID('order_id');
		$new_status = JRequest::getVar('status','');

		if(!empty($order_id)){

			$class = hikashop_get('class.order');

			$order = $class->get($order_id,$new_status);

			$order->order_old_status = $order->order_status;
			$order->order_status = $new_status;
			$class->loadOrderNotification($order);
			$class->getOrderAdditionalInfo($order);
			
		}else{
			$order = new stdClass();
		}

		$order->order_status = $new_status;


		$this->assignRef('element',$order);
		$editor = hikashop_get('helper.editor');
		$editor->name = 'hikashop_mail_body';
		$editor->content = $order->mail->body;
		$this->assignRef('editor',$editor);

	}
After accepting the field trk_number in this form I need to save it in the order.

I always received that the count($this->fields)=0, when it must have at least 1

Last Edit: 1 year 1 month ago by nicolas. Reason: code tag to make it more readable

Please Log in or Create an account to join the conversation.

  • Posts: 64169
  • Thank you received: 9262
  • MODERATOR
1 year 1 month ago #282513

Hi,

You didn't say how you created that field ? Is it a HikaShop custom field ? Of which table ?
Supposing that it is a custom order field, you can access it like that: $this->element->trk_number in the changestatus.php view file and its sub views.

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
  • Hikaauction Standard Hikamarket Frontedition Hikashop Business
1 year 1 month ago #282550

Hello, Nicolas thank you,

Yes, it's a HikaShop custom field of the table order, using the element I can access to it, but how do I save it?

Please Log in or Create an account to join the conversation.

  • Posts: 64169
  • Thank you received: 9262
  • MODERATOR
1 year 1 month ago #282563

Hi,

Supposing that you have added an input in the changestatus.php or the notification.php view file to set the value and pass it to the server when the user validates the form, you can implement the trigger "onBeforeOrderUpdate" in a small plugin of the group hikashop to add the value from the $_POST to $order->trk_number and it will be saved automatically by HikaShop.
www.hikashop.com/support/documentation/6...#onBeforeOrderUpdate

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum