问题描述
在我的自定义模块中,我有一种方法可以通过 API 调用下载 PDF 文件到我的服务,并将其存储在下载/MyModule 文件夹中:
public function downloadDocument($docIdMyModule,$orderId,$isInvoice)
{
$mymodule_api_url = $this->baseUrl . 'GetFile';
$command = $this->getApiCommand($mymodule_api_url); // ottengo il comando
$start_time = $this->startTime();
$send_data = [];
$send_data['apiKey'] = Configuration::get('PS_MYMODULE_API');
$send_data['source'] = $this->sourceInfo;
$send_data['docId'] = (int) $docIdMymodule;
$dataReturned = $this->curlDownload($mymodule_api_url,http_build_query($send_data));
$finish_time = $this->endTime();
$this->getApiTime($command,$start_time,$finish_time);
libxml_use_internal_errors(true);
if (!simplexml_load_string(utf8_encode($dataReturned))) {
if ($isInvoice) {
$order = new Order((int) $orderId);
$fileName = $this->constructFileName($order->invoice_number,$order->date_upd);
} else {
$fileName = 'ORD' . sprintf('%06d',(int) $orderId) . '.pdf';
}
file_put_contents(_PS_DOWNLOAD_DIR_ . 'MyModule/' . $fileName,$dataReturned);
}
}
现在我通过单击订单详细信息中的按钮使用 prestashop 1.7.7.3 和我的 pdf 我显示 Prestashop pdf 文件而不是我的自定义文件。注意:在较旧的 PS 版本上,我成功地显示了我的 pdf,因为我覆盖了 AdminPdfController 和 PdfInvoiceController,这在最新版本中不再可能。任何人都可以帮助我找到解决方案吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)