diff --git a/Cron/API/OrderStatusImport.php b/Cron/API/OrderStatusImport.php index 66972b9..172f136 100644 --- a/Cron/API/OrderStatusImport.php +++ b/Cron/API/OrderStatusImport.php @@ -282,7 +282,7 @@ protected function getItemsToShip( $skuPrefix = $this->helper->getSkuPrefix(); foreach ($magentoOrder->getAllItems() as $item) { - $itemSku = $skuPrefix . $item->getSku(); + $itemSku = $item->getSku(); if ($item->getData("parent_item_id")) { $this->moduleLog(' - Parent item exists, skipping shipping on this one.'); diff --git a/Cron/API/StockMutations.php b/Cron/API/StockMutations.php index 3750458..2af45a0 100644 --- a/Cron/API/StockMutations.php +++ b/Cron/API/StockMutations.php @@ -23,6 +23,11 @@ class StockMutations extends AbstractCron */ protected TransportBuilder $transportBuilder; + /** + * @var StockRegistryInterface + */ + protected $stockRegistry; + /** * @param Data $helper * @param DirectoryList $directoryList @@ -40,8 +45,10 @@ public function __construct( ConfigInterface $config, TransportBuilder $transportBuilder, StoreManager $storeManager, + StockRegistryInterface $stockRegistry, array $settings = [] ) { + $this->stockRegistry = $stockRegistry; parent::__construct($helper, $directoryList, $monolog, $config, $transportBuilder, $storeManager, $settings); } @@ -88,14 +95,14 @@ protected function processMutations() $sku = $stockMutation->getSku(); $qty = $stockMutation->getStock(); try { - $stockItem = $this->stockregistry->getStockItemBySku($sku); + $stockItem = $this->stockRegistry->getStockItemBySku($sku); $this->serviceLog($stream, sprintf('Setting product stock qty of sku %s with Magento ID %s to %s', $sku, $stockItem->getProductId(), $qty)); $oldQty = $stockItem->getQty(); $stockItem->setQty($qty); if (round($oldQty, 0) != round($qty, 0)) { - $id = $this->stockregistry->updateStockItemBySku($sku, $stockItem); + $id = $this->stockRegistry->updateStockItemBySku($sku, $stockItem); $this->serviceLog($stream, sprintf( 'Successfully updated stock for product %s with Magento ID %s and Magento Stock item ID %s from %s to %s',