Prestashop 提交返回页面html后的预启动
您好,我在Prestashop 1.6下开发了一个模块,我无法提交表单 我在我的模块中添加了一个带有钩子“DisplayAdminOrderContentShip”的表单,该钩子检索一个显示我的表单(button)的tpl hook\u button.tpl 这是我的第三方物流:Prestashop 提交返回页面html后的预启动,prestashop,Prestashop,您好,我在Prestashop 1.6下开发了一个模块,我无法提交表单 我在我的模块中添加了一个带有钩子“DisplayAdminOrderContentShip”的表单,该钩子检索一个显示我的表单(button)的tpl hook\u button.tpl 这是我的第三方物流: <div class="panel panel-default"> <div class="panel-heading"> <p>Export commande mecal
<div class="panel panel-default">
<div class="panel-heading">
<p>Export commande mecalux</p>
</div>
<div class="panel-body">
<p>Permet de relancer l'export vers Mecalux de la commande</p>
<form method="POST" action="#">
<button type="submit" value="1" id="exportordersubmit" name="exportordersubmit" class="btn btn-default pull-right">
<i class="process-icon-refresh"></i> {l s='Relancer l\'export' mod='exportorders'}
</button>
</form>
</div>
当我点击这里时,是我页面的结果:
通常情况下,它会在订单详细信息页面(管理员)中返回警报。我不知道我的问题来自何处。你知道吗?
谢谢你的帮助
尝试使用fetch而不是display
return($this->context->smarty->fetch(\uuuuu FILE\uuuu,'views/templates/hook/hook\u button.tpl')代码>它按顺序显示html详细信息(见图)您是否使用一些标题('content-type…
)更改了php文件的内容类型?在你调用$this->display(…
不,这是一个简单的表单。我有什么解决方案?
public function hookDisplayAdminOrderContentShip($params)
{
$order = new Order(Tools::getValue('id_order'));
$status = (int)Configuration::get('EXPORTORDERS_STATUS_TRANSFERED_TO_WMS');
$statusError = (int)Configuration::get('EXPORTORDERS_STATUS_CMD_ERROR');
if (Tools::isSubmit('exportordersubmit')) {
if (isset($order) && (int)$order->valid == 1) {
if ($order->current_state != $status && $order->current_state != $statusError) {
return;
}
if (!$order->valid) {
return;
}
$customer = $order->getCustomer();
$deliveryAddress = new Address($order->id_address_delivery);
$id_country_delivery = $deliveryAddress->getCountryAndState($order->id_address_delivery);
$iso = new Country();
$userXml = [
'id_client' => $customer->id,
'email' => $customer->email,
'livraison' => $deliveryAddress,
'country_code_delivery' => $iso->getIsoById($id_country_delivery['id_country'])
];
$dateOrder = new DateTime($order->date_add);
$orderXml = [
'id' => $order->id,
'sorCode' => $order->reference,
'payment' => $order->payment,
'date' => $dateOrder->format('Y-m-d\TH:i:s') . 'Z',
];
$result = $this->fileXml($userXml, $orderXml, $order->getProducts());
if ((int)$result === 1) {
$order->setCurrentState($statusError, (int)$this->context->employee->id ? (int)$this->context->employee->id : 0);
$html = [
'message' => $this->displayError('Erreur de transmission au WMS'),
];
} else {
if ((int)$order->current_state !== (int)$status) {
$order->setCurrentState($status, (int)$this->context->employee->id ? (int)$this->context->employee->id : 0);
$order->wms_transfered = 1;
$order->save();
$html = [
'message' => $this->displayConfirmation('Transmise au WMS'),
];
}
}
}
}
$this->context->smarty->assign(
array(
'alert' => $html
)
);
return ($this->display(__FILE__, 'views/templates/hook/hook_button.tpl'));
}