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

Imposible to reorder configurable products with one checkbox selected custom option #38736

Open
1 of 5 tasks
RetroProgrammist opened this issue May 17, 2024 · 12 comments · May be fixed by #39373
Open
1 of 5 tasks

Imposible to reorder configurable products with one checkbox selected custom option #38736

RetroProgrammist opened this issue May 17, 2024 · 12 comments · May be fixed by #39373
Assignees
Labels
Area: Catalog Component: Checkout Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: PR in progress Reported on 2.4.7 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

@RetroProgrammist
Copy link

Preconditions and environment

  • Magento version 2.4.7
  • clear install Magento

Steps to reproduce

  1. create Simple product (i used sampledata)
  2. Create custom option:
    • Checkbox type
    • Require
    • 1 or 2 option values

screenshot_1

  1. Go to front, log in
  2. Add the product to cart !!WARNING choose only 1 option value, eg. Checkbox 1 on screen above
  3. Create an Order
  4. Then go to Accaunt and reorder this order

Expected result

Successful basket creation

Actual result

We're getting an error
Could not add the product with SKU "24-MB01" to the shopping cart: Some of the selected item options are not currently available.
screenshot_2

Additional information

I found out that the problem is that when reordering the option is taken from $buyRequest (vendor/magento/module-catalog/Model/Product/Type/AbstractType.php:583)
$optionsFromRequest = $buyRequest->getOptions();
However, it is not interpreted as an array, but as a scalar
screenshot_3

As a result, when validating \Magento\Catalog\Model\Product\Option\Type\Select::validateUserValue
and we get an error on line 97.

screenshot_4

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 May 17, 2024

Hi @RetroProgrammist. 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. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


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 May 17, 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- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - 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.7 Indicates original Magento version for the Issue report. label May 17, 2024
@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Bravo
Copy link
Contributor

Hi @RetroProgrammist,

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 screenshot.

Steps to reproduce

  • create Simple product (i used sampledata)

  • Create custom option:

    -Checkbox type
    -Require
    -1 or 2 option values

  • Go to front, log in

  • Add the product to cart !!WARNING choose only 1 option value, eg. Checkbox 1 on screen above

  • Create an Order

  • Then go to Accaunt and reorder this order

Screenshot 2024-05-17 at 17 08 25

We're getting an error Some of the selected item options are not currently available.

Hence Confirming the issue.

Thanks.

@engcom-Bravo engcom-Bravo added Area: Catalog Component: Checkout Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels May 17, 2024
@github-jira-sync-bot
Copy link

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

Copy link

m2-assistant bot commented May 17, 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.

@engcom-Bravo engcom-Bravo added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label May 17, 2024
@Usmanbashir123
Copy link

Facing the same issue in Magento2.4.5p2 Cloud

@rendyep
Copy link

rendyep commented Jul 26, 2024

These 2 lines of code fixes the issue. Tested in 2.4.5-p8.

diff --git a/vendor/magento/module-catalog/Model/Product/Option/Select.php b/vendor/magento/module-catalog/Model/Product/Option//Select.php
index 286fa39..b0db2f3 100644
--- a/Select.php
+++ b/Select.php
@@ -99,6 +99,8 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
         if (!$this->_isSingleSelection()) {
             if (is_string($value)) {
                 $value = explode(',', $value);
+            } else {
+                $value = [$value];
             }
             $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load();
             $valueCount = is_array($value) ? count($value) : 0;

@Usmanbashir123
Copy link

Usmanbashir123 commented Jul 29, 2024

This can be fixed this Creating the Custom Patch . Tested in Magento 2.4.5p2 Cloud

diff --git a/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php b/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
index 3ee2rd..8349152 111644
--- a/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
+++ b/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
@@ -101,7 +101,7 @@
                 $value = explode(',', $value);
             }
             $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load();
-            $valueCount = is_array($value) ? count($value) : 0;
+            $valueCount = is_array($value) ? count($value) : 1;
             if ($valuesCollection->count() != $valueCount) {
                 $this->setIsValid(false);
                 throw new LocalizedException( 

@engcom-Hotel engcom-Hotel moved this to Ready for Development in High Priority Backlog Aug 19, 2024
@lucafuser
Copy link

@magento I am working on this

lucafuser added a commit to lucafuser/magento2 that referenced this issue Nov 15, 2024
…ustom option

- Changed single option value (int type) into array to count optionValues correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Catalog Component: Checkout Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: PR in progress Reported on 2.4.7 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
Status: Ready for Development
Development

Successfully merging a pull request may close this issue.

6 participants