From edcf46bab43c03280be746351147de0f78a73195 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Wed, 4 Jun 2025 23:11:30 +0200 Subject: [PATCH] =?UTF-8?q?Zaktualizowano=20rozmiar=20pliku=20google-merch?= =?UTF-8?q?ant=5Fid-1.xml=20oraz=20dodano=20logik=C4=99=20aktualizacji=20?= =?UTF-8?q?=C5=BAr=C3=B3d=C5=82a=20zam=C3=B3wienia=20dla=20zam=C3=B3wie?= =?UTF-8?q?=C5=84=20Empik=20w=20klasie=20OrderFulfiller.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/ftp-kr.sync.cache.json | 2 +- custom-cron.php | 6 ++++++ .../src/OrderFulfiller/OrderFulfiller.php | 1 + .../src/Processor/OrderProcessor.php | 12 ++++++------ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 7ec527cc..e1365f28 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -98,7 +98,7 @@ }, "google-merchant_id-1.xml": { "type": "-", - "size": 18429810, + "size": 18470225, "lmtime": 0, "modified": true }, diff --git a/custom-cron.php b/custom-cron.php index 0bde8dbd..7140298e 100644 --- a/custom-cron.php +++ b/custom-cron.php @@ -22,6 +22,12 @@ if ( $erli_date ) echo '

Zamówienie erli ID: ' . $order['id_order'] . '

'; } + if ( is_array( $statuses ) and count( array_intersect( $statuses, [ '45' ] ) ) > 0 ) + { + $mdb -> update( 'ps_orders', [ 'order_source' => 'Empik' ], [ 'id_order' => $order['id_order'] ] ); + echo '

Zamówienie empik ID: ' . $order['id_order'] . '

'; + } + $erli_date = $order['date_add']; $mdb -> update( 'custom_cron', [ 'value' => $erli_date ], [ 'param' => 'erli_orders_check' ] ); } diff --git a/modules/empikmarketplace/src/OrderFulfiller/OrderFulfiller.php b/modules/empikmarketplace/src/OrderFulfiller/OrderFulfiller.php index 5d1aff83..f5f489de 100644 --- a/modules/empikmarketplace/src/OrderFulfiller/OrderFulfiller.php +++ b/modules/empikmarketplace/src/OrderFulfiller/OrderFulfiller.php @@ -83,6 +83,7 @@ class OrderFulfiller // add cart $cart = $this->cartProvider->provide($data); + $order->setCart($cart); // add order lines diff --git a/modules/empikmarketplace/src/Processor/OrderProcessor.php b/modules/empikmarketplace/src/Processor/OrderProcessor.php index d350336c..1bf24eb8 100644 --- a/modules/empikmarketplace/src/Processor/OrderProcessor.php +++ b/modules/empikmarketplace/src/Processor/OrderProcessor.php @@ -18,7 +18,7 @@ class OrderProcessor { const CODE_WAITING_ACCEPTANCE = 'WAITING_ACCEPTANCE'; const CODE_SHIPPING = 'SHIPPING'; - + /** @var EmpikClientFactory */ protected $empikClientFactory; @@ -59,7 +59,7 @@ class OrderProcessor if (!$this->allowAccept && !$this->allowImport) { return; } - + $response = $this->empikClient->getOrders([ 'order_state_codes' => implode(',', $this->getOrderCodesForProcess()), ]); @@ -111,19 +111,19 @@ class OrderProcessor $this->logger->logError(sprintf('Error accepting order [%s]', $e->getMessage())); } } - + protected function getOrderCodesForProcess() { $codes = []; - + if ($this->allowAccept) { $codes[] = self::CODE_WAITING_ACCEPTANCE; } - + if ($this->allowImport) { $codes[] = self::CODE_SHIPPING; } - + return $codes; } } \ No newline at end of file