Skip to main content

View notification

More
8 years 10 months ago - 8 years 10 months ago #282506 by plnabais
View notification was created by plnabais
-- 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:
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: 8 years 10 months ago by nicolas. Reason: code tag to make it more readable

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

More
8 years 10 months ago #282513 by nicolas
Replied by nicolas on topic View notification
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.

More
8 years 10 months ago #282550 by plnabais
Replied by plnabais on topic View notification
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.

More
8 years 10 months ago #282563 by nicolas
Replied by nicolas on topic View notification
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.206 seconds
Powered by Kunena Forum