aktualizacja modułu
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Notatka: override tabeli produktow BO
|
||||
|
||||
Data: 2026-02-09
|
||||
|
||||
Po aktualizacji modulu `empikmarketplace` wyglad tabeli produktow w panelu administratora PrestaShop zostal nadpisany przez:
|
||||
|
||||
- `modules/empikmarketplace/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig`
|
||||
|
||||
To ten plik odpowiada za modyfikacje widoku listy produktow (katalog, BO).
|
||||
26
modules/empikmarketplace/mails/pl/empik_import_error.html
Normal file
26
modules/empikmarketplace/mails/pl/empik_import_error.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Błąd importu zamówienia EMPIK</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; font-size: 14px; color: #333;">
|
||||
<h2 style="color: #c0392b;">Błąd importu zamówienia EMPIK</h2>
|
||||
<table style="border-collapse: collapse; width: 100%; max-width: 600px;">
|
||||
<tr>
|
||||
<td style="padding: 8px; border: 1px solid #ddd; font-weight: bold;">Zamówienie EMPIK:</td>
|
||||
<td style="padding: 8px; border: 1px solid #ddd;">{empik_order_id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px; border: 1px solid #ddd; font-weight: bold;">Data:</td>
|
||||
<td style="padding: 8px; border: 1px solid #ddd;">{error_date}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px; border: 1px solid #ddd; font-weight: bold;">Komunikat błędu:</td>
|
||||
<td style="padding: 8px; border: 1px solid #ddd;">{error_message}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Stack trace:</h3>
|
||||
<pre style="background: #f5f5f5; padding: 10px; font-size: 12px; overflow-x: auto;">{stack_trace}</pre>
|
||||
</body>
|
||||
</html>
|
||||
8
modules/empikmarketplace/mails/pl/empik_import_error.txt
Normal file
8
modules/empikmarketplace/mails/pl/empik_import_error.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Błąd importu zamówienia EMPIK
|
||||
|
||||
Zamówienie EMPIK: {empik_order_id}
|
||||
Data: {error_date}
|
||||
Komunikat błędu: {error_message}
|
||||
|
||||
Stack trace:
|
||||
{stack_trace}
|
||||
@@ -13,12 +13,14 @@ use Empik\Marketplace\OrderFulfiller\OrderFulfiller;
|
||||
use Exception;
|
||||
use Configuration;
|
||||
use Db;
|
||||
use Mail;
|
||||
use Empik\Marketplace\Provider\Order\ProductRefResolver;
|
||||
|
||||
class OrderProcessor
|
||||
{
|
||||
const CODE_WAITING_ACCEPTANCE = 'WAITING_ACCEPTANCE';
|
||||
const CODE_SHIPPING = 'SHIPPING';
|
||||
const ERROR_NOTIFICATION_EMAIL = 'jacek.pyziak@project-pro.pl';
|
||||
|
||||
/** @var EmpikClientFactory */
|
||||
protected $empikClientFactory;
|
||||
@@ -98,7 +100,74 @@ class OrderProcessor
|
||||
Db::getInstance()->execute('COMMIT');
|
||||
} catch (Exception $e) {
|
||||
Db::getInstance()->execute('ROLLBACK');
|
||||
$this->logger->logError(sprintf('Error importing order [%s]', $e->getMessage()));
|
||||
$this->resetOrderAutoIncrement();
|
||||
|
||||
$data = $empikOrder->getData();
|
||||
$empikOrderId = isset($data['order_id']) ? $data['order_id'] : 'unknown';
|
||||
$errorMsg = sprintf('Error importing EMPIK order [%s]: %s', $empikOrderId, $e->getMessage());
|
||||
$this->logger->logError($errorMsg);
|
||||
$this->sendFailureNotification($empikOrderId, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resetuje AUTO_INCREMENT tabeli ps_orders do MAX(id_order) + 1
|
||||
* aby uniknąć dziur w numeracji zamówień po ROLLBACK.
|
||||
*/
|
||||
protected function resetOrderAutoIncrement()
|
||||
{
|
||||
try {
|
||||
$lastId = (int) Db::getInstance()->getValue(
|
||||
'SELECT MAX(id_order) FROM ' . _DB_PREFIX_ . 'orders'
|
||||
);
|
||||
Db::getInstance()->execute(
|
||||
'ALTER TABLE ' . _DB_PREFIX_ . 'orders AUTO_INCREMENT = ' . ($lastId + 1)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logError(sprintf('Error resetting AUTO_INCREMENT: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wysyła email z powiadomieniem o nieudanym imporcie zamówienia EMPIK.
|
||||
*
|
||||
* @param string $empikOrderId
|
||||
* @param Exception $exception
|
||||
*/
|
||||
protected function sendFailureNotification($empikOrderId, Exception $exception)
|
||||
{
|
||||
try {
|
||||
$shopName = Configuration::get('PS_SHOP_NAME');
|
||||
$subject = sprintf('[%s] Błąd importu zamówienia EMPIK: %s', $shopName, $empikOrderId);
|
||||
|
||||
$body = sprintf(
|
||||
"Zamówienie EMPIK: %s\nData: %s\nBłąd: %s\n\nStack trace:\n%s",
|
||||
$empikOrderId,
|
||||
date('Y-m-d H:i:s'),
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
);
|
||||
|
||||
Mail::send(
|
||||
(int) Configuration::get('PS_LANG_DEFAULT'),
|
||||
'empik_import_error',
|
||||
$subject,
|
||||
[
|
||||
'{empik_order_id}' => $empikOrderId,
|
||||
'{error_message}' => $exception->getMessage(),
|
||||
'{error_date}' => date('Y-m-d H:i:s'),
|
||||
'{stack_trace}' => nl2br($exception->getTraceAsString()),
|
||||
],
|
||||
self::ERROR_NOTIFICATION_EMAIL,
|
||||
null,
|
||||
Configuration::get('PS_SHOP_EMAIL'),
|
||||
$shopName,
|
||||
null,
|
||||
null,
|
||||
_PS_MODULE_DIR_ . 'empikmarketplace/mails/'
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->logError(sprintf('Error sending failure notification email: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 50600)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
|
||||
if (!(PHP_VERSION_ID >= 70200)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
|
||||
Reference in New Issue
Block a user