Post Request From Smarty

hi,

i want to send post request on button click.

E.g.

Test

i used following syntax to send ajax request

reponse is 302

<a href="{'orders.update_status?id=98&status=C'|fn_url}" class="cm-post">Testa>

It seems like the customers does'nt have the permission to post this request how can i change the permissions for the customers?

It seems like the customers does'nt have the permission to post this request how can i change the permissions for the customers?

Yes, orders.php controller does not have a code to change order status

Orders.php included the following code to change the status of order.

if ($mode == 'update_status') {
fn_print_r($_REQUEST);
$order_info = fn_get_order_short_info($_REQUEST['id']);
$old_status = $order_info['status'];
if (fn_change_order_status($_REQUEST['id'], $_REQUEST['status'], '', fn_get_notification_rules($_REQUEST))) {
$order_info = fn_get_order_short_info($_REQUEST['id']);
fn_check_first_order($order_info);
$new_status = $order_info['status'];
if ($_REQUEST['status'] != $new_status) {
Tygh::$app['ajax']->assign('return_status', $new_status);
Tygh::$app['ajax']->assign('color', fn_get_status_param_value($new_status, 'color'));

fn_set_notification('W', __('warning'), __('status_changed'));
} else {
fn_set_notification('N', __('notice'), __('status_changed'));
}
} else {
fn_set_notification('E', __('error'), __('error_status_not_changed'));
Tygh::$app['ajax']->assign('return_status', $old_status);
Tygh::$app['ajax']->assign('color', fn_get_status_param_value($old_status, 'color'));
}

if (empty($_REQUEST['return_url'])) {
exit;
} else {
return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['return_url']);
}
}

From the admin panel i can hit the same route but from customers its returning 302 error? how can i allow the customers to do it

Orders.php included the following code to change the status of order.

if ($mode == 'update_status') {
fn_print_r($_REQUEST);
$order_info = fn_get_order_short_info($_REQUEST['id']);
$old_status = $order_info['status'];
if (fn_change_order_status($_REQUEST['id'], $_REQUEST['status'], '', fn_get_notification_rules($_REQUEST))) {
$order_info = fn_get_order_short_info($_REQUEST['id']);
fn_check_first_order($order_info);
$new_status = $order_info['status'];
if ($_REQUEST['status'] != $new_status) {
Tygh::$app['ajax']->assign('return_status', $new_status);
Tygh::$app['ajax']->assign('color', fn_get_status_param_value($new_status, 'color'));

fn_set_notification('W', __('warning'), __('status_changed'));
} else {
fn_set_notification('N', __('notice'), __('status_changed'));
}
} else {
fn_set_notification('E', __('error'), __('error_status_not_changed'));
Tygh::$app['ajax']->assign('return_status', $old_status);
Tygh::$app['ajax']->assign('color', fn_get_status_param_value($old_status, 'color'));
}

if (empty($_REQUEST['return_url'])) {
exit;
} else {
return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['return_url']);
}
}

The cost exists in the orders.php of backend. Have you copied the code to store-front controller?

Yes i did that and now its working.