Post by orik3ll0 » Sun Nov 18, 2018 6:12 pm

Hello guys,

From admin panel orders page, i press see order button( "sale/order/info" page) and i have added 1 more "select" input and on submit button, i want to send this "select" input value and update this value in db, but can not find in which file it does insert and update of tables.

It sends data by ajax on button click

Code: Select all

$('#button-history').on('click', function() {
	$.ajax({
		url: '<?php echo $catalog; ?>index.php?route=api/order/history&token=' + token + '&store_id=<?php echo $store_id; ?>&order_id=<?php echo $order_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),
		beforeSend: function() {
			$('#button-history').button('loading');
		},
		complete: function() {
			$('#button-history').button('reset');
		},
		success: function(json) {
		    //alert(data);
			$('.alert').remove();

			if (json['error']) {
				$('#history').before('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
			}

			if (json['success']) {
				$('#history').load('index.php?route=sale/order/history&token=<?php echo $token; ?>&order_id=<?php echo $order_id; ?>');

				$('#history').before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');

				$('textarea[name=\'comment\']').val('');
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});
okay, i am adding my select input inside <form> tag and adding my value tot data

Code: Select all

data: 'seller_sel=' + encodeURIComponent($('select[name=\'seller_sel\']').val()) + 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),
So on submit it does insert into `prefix_order_history` and updates `order_status_id`.... I can not find model where it does this insert and update to change query. Please tell me where can i find query

Newbie

Posts

Joined
Sat Apr 14, 2018 6:37 am

Post by OSWorX » Sun Nov 18, 2018 9:03 pm

You have to call

Code: Select all

catlog/api/order > edit
to edit existing orders.
And I guess you have to edit also this function and the model

Code: Select all

catlog/checkout/order > editOrder
if you want to add / edit additonal fields.

Forum Rules [en]: viewtopic.php?f=176&t=200480
Commercial Request: viewforum.php?f=88
Dedicated Support: https://dedicated.opencart.com/
Marketplace Support: https://www.opencart.com/index.php?rout ... rt/support
Documentation: http://docs.opencart.com/en-gb/extension/theme/

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by orik3ll0 » Mon Nov 19, 2018 4:47 am

OSWorX wrote:
Sun Nov 18, 2018 9:03 pm
You have to call

Code: Select all

catlog/api/order > edit
to edit existing orders.
And I guess you have to edit also this function and the model

Code: Select all

catlog/checkout/order > editOrder
if you want to add / edit additonal fields.
Thank you for your reply and asnwer!) I did not know that it could be out of admin folder :-\

Newbie

Posts

Joined
Sat Apr 14, 2018 6:37 am

Post by OSWorX » Mon Nov 19, 2018 3:28 pm

Well ... you are editing the code.
Therefore you are reading the code.

And there is (see first posting):

Code: Select all

url: '<?php echo $catalog; ?>index.php?route=api/order/history
That is pointing to the catalog .. O0

Forum Rules [en]: viewtopic.php?f=176&t=200480
Commercial Request: viewforum.php?f=88
Dedicated Support: https://dedicated.opencart.com/
Marketplace Support: https://www.opencart.com/index.php?rout ... rt/support
Documentation: http://docs.opencart.com/en-gb/extension/theme/

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: Baidu [Spider], devtolu and 10 guests