Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Mar 26, 2024
1 parent 688e270 commit 362001e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/console/controllers/SkeeksSuppliersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,7 @@ private function _updateStoreItemsForProduct(ShopProduct $shopProduct, array $ap
$api_quantity = (float)ArrayHelper::getValue($store_item_data, "quantity");
$api_purchase_price = (float)ArrayHelper::getValue($store_item_data, "purchase_price");
$api_selling_price = (float)ArrayHelper::getValue($store_item_data, "selling_price");
$updated_at = (int)ArrayHelper::getValue($store_item_data, "updated_at.timestamp");

if (!$shopStoreItem) {
$shopStoreItem = new ShopStoreProduct();
Expand All @@ -1549,6 +1550,10 @@ private function _updateStoreItemsForProduct(ShopProduct $shopProduct, array $ap
if (!$shopStoreItem->save()) {
throw new Exception(print_r($shopStoreItem->errors, true));
}

$shopStoreItem->updated_at = $updated_at;
$shopStoreItem->update(false, ['updated_at']);

} else {
$changedAttrs = [];

Expand Down Expand Up @@ -1581,6 +1586,9 @@ private function _updateStoreItemsForProduct(ShopProduct $shopProduct, array $ap
if (!$shopStoreItem->update(true, $changedAttrs)) {
throw new Exception(print_r($shopStoreItem->errors, true));;
}

$shopStoreItem->updated_at = $updated_at;
$shopStoreItem->update(false, ['updated_at']);
}
}

Expand Down

0 comments on commit 362001e

Please sign in to comment.