Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inventory_source_item sku not updating when user updates product SKU #39335

Open
1 of 5 tasks
Swannyj opened this issue Nov 6, 2024 · 5 comments
Open
1 of 5 tasks

inventory_source_item sku not updating when user updates product SKU #39335

Swannyj opened this issue Nov 6, 2024 · 5 comments
Labels
Area: Order Component: Shipping Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.6-p6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@Swannyj
Copy link

Swannyj commented Nov 6, 2024

Preconditions and environment

  • Magento version: 2.4.6-p6

Steps to reproduce

  1. Create a Product in the CMS. Add a SKU (for example 4201503002/size38/bleu fonce) and assign a stock source against it

  2. Save the Product

  3. Change the Product SKU (for example 4201503002/size38/bleu foncé)

  4. Save

  5. Navigate to the storefront

  6. Add this product to your basket and checkout

  7. In the CMS go to Sales/Orders and find the order

  8. You should see an order item with the updated sku (4201503002/size38/bleu foncé)

  9. Click 'Ship'

Expected result

The admin user should be able to click ship and progress through the order journey.

Actual result

The user is presented with the following error

Warning: Undefined array key "4201503002/size38/bleu fonce" in /var/www/website/vendor/magento/module-inventory-source-selection-api/Model/Algorithms/Result/GetDefaultSortedSourcesResult.php on line 140

Additional information

Looking through the execute function in GetDefaultSortedSourcesResult.php, it seems that the code retrieves a list of items in the order

        foreach ($inventoryRequest->getItems() as $item) {
            $normalizedSku = $this->normalizeSku($item->getSku());
            $itemsTdDeliver[$normalizedSku] = $item->getQty();
        }

        \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info("Items to Deliver: ");
        \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info(print_r(array_keys($itemsTdDeliver),true));

I can see the below in my debug.log

[2024-11-06T12:12:46.347503+00:00] main.INFO: Items to Deliver:  [] []
[2024-11-06T12:12:46.347769+00:00] main.INFO: Array
(
    [0] => 4201503002/size38/bleu foncé
)

After this, the code calls the execute function in GetInStockSourceItemsBySkusAndSortedSource

I have added the below logging in this function:

        $items = $this->sourceItemRepository->getList($searchCriteria)->getItems();

        \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info("Items after source item repo search");
        \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info(print_r(array_keys($items), true));

which prints the following to my debug.log

[2024-11-06T13:07:08.591215+00:00] main.INFO: Items after source item repo search [] []
[2024-11-06T13:07:08.591596+00:00] main.INFO: Array
(
    [0] => 7161324
)
 [] []

The above ID returns the following from the database 7161324 and back inside the execute function in GetDefaultSortedSourcesResult.php this ID returns the following from the database when it is looping through the $sourceItems

 foreach ($sourceItems as $sourceItem) {
            \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info("Source Item SKU: ");
            \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info(print_r($sourceItem->getSku(),true));
[2024-11-06T13:07:08.592511+00:00] main.INFO: Source Item SKU:  [] []
[2024-11-06T13:07:08.592965+00:00] main.INFO: 4201503002/Size38/Bleu Fonce [] []

inventory_source_item table
image

catalog_product_entity table
image


IMPORTANT
The code uses the inventory_source_item sku and searches the the variable $itemsTdDeliver for this sku however this array conatins the product sku and so returns the undefined array key error.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Nov 6, 2024

Hi @Swannyj. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

Copy link

m2-assistant bot commented Nov 6, 2024

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6-p6 Indicates original Magento version for the Issue report. label Nov 6, 2024
@engcom-Bravo
Copy link
Contributor

Hi @Swannyj,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the attached video.

Screen.Recording.2024-11-07.at.10.18.39.mov

When Clicking shipping we are getting the error Following products with requested skus were not found: 4201503002/size38/bleu fonce

Hence Confirming the issue.

Thanks.

@engcom-Bravo engcom-Bravo added Component: Shipping Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Area: Order labels Nov 7, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13319 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Nov 7, 2024

✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Order Component: Shipping Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.6-p6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests

3 participants