Skip to content

File custom option download link for order doesn't work after quote is removed by sales_clean_quotes cron #29957

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

Closed
1 of 5 tasks
piuga opened this issue Sep 9, 2020 · 13 comments · May be fixed by #31469 or #39890
Closed
1 of 5 tasks
Assignees
Labels
Component: Quote Component: Sales Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: needs update Additional information is require, waiting for response Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.3.5-p2 Indicates original Magento version for the Issue report. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@piuga
Copy link

piuga commented Sep 9, 2020

Additional information

Due to #29957 (comment) still actual on 2.4-develop

Preconditions (*)

  1. Magento 2.4-develop
  2. Magento 2.3.5-p2

Steps to reproduce (*)

  1. Create product with custom option file
  2. In front-end place an order with this product, with any image
  3. In back-end go to order and download custom option file -> it works fine, as expected
  4. Set, for example, 1 day for quote lifetime under: Stores / Configurations / Sales / Checkout / Shopping Cart / Quote Lifetime
  5. After 1 day, cron will remove the quote
  6. Go back to order in admin panel and download custom option file -> it shows 404 page

Expected result (*)

  1. Download link, for order item with a file custom option, should work after quote is removed.

Actual result (*)

  1. After 'sales_clean_quotes' cron runs, for all orders, which have items with file custom option and for which the quote was removed, the download link does not work.

Peek 2020-12-02 10-39


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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”.
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Sep 9, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 9, 2020

Hi @piuga. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@engcom-Oscar engcom-Oscar self-assigned this Sep 10, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 10, 2020

Hi @engcom-Oscar. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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-Oscar engcom-Oscar added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Sep 14, 2020
@sdzhepa
Copy link
Contributor

sdzhepa commented Sep 14, 2020

Hello @piuga
cc: @engcom-Oscar

Thank you for your report.
Unfortunately, we are not able to reproduce this issue on the latest 2.4-develop code. Probably it was already fixed and will appear in the next release. Or we missed some steps or preconditions.

Could you please have a look and confirm?


Also, please take into account that
We are able to process, collaborate, fix, and deliver pull requests ONLY for Issues that can be reproduced on the latest 2.4-develop public branch.

  • GitHub Issues Processing Workflow: Verification
    Quote
    Be advised, we only accept pull requests for 2.4-develop.
    Check if the issue exists on the 2.4-develop branch with a clean installation, configured by described preconditions, following the exact reproduction steps.
    -- If the described behavior was reproduced, the maintainer should apply the Reproduced on 2.4 label to the ticket, indicating that issue was reproduced and specific version.
    -- If the issue was not reproducible with 2.4-develop, the maintainer should close the issue and stop verification process here!
  • Issue reporting guidelines this link exsist in each new issue report template
    Quote
    Checks if the issue exists on the 2.4-develop branch with clean Magento installation. Be advised, we only accept pull requests for 2.4-develop. If the issue is not reproducible on 2.4-develop, it will be closed.

Branch 2.3-develop was removed from the public repository. All fixes to the previous release allowed and can be done ONLY by internal teams. Based on the prioritized backlog by the Product Management team.
All issue related to the previous Magento versions can be reported only through:

@piuga
Copy link
Author

piuga commented Sep 22, 2020

Hello @sdzhepa,

I have checked this on 2.4-develop branch also, and the issue appears there.

I will add below some screenshots that might help with testing. I used an older DB so I have old orders for it:

Then I go back to order page from admin and try to get the custom option file: https://prnt.sc/ulw2ml but instead I am redirected to a 404 page

The problem is here:
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php#L80
as custom option is loaded from quote item.
This will cause problems for all orders that have removed quotes.

@sdzhepa
Copy link
Contributor

sdzhepa commented Sep 29, 2020

Thank you for the update @piuga!

@engcom-Oscar could you please check, update the issue description and confirm?

@m2-assistant
Copy link

m2-assistant bot commented Oct 7, 2020

Hi @engcom-Alfa. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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.

@ghost ghost added Issue: ready for confirmation and removed Progress: dev in progress Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Oct 20, 2020
@ghost ghost unassigned engcom-Alfa Nov 1, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.3.5-p2 Indicates original Magento version for the Issue report. label Nov 13, 2020
@engcom-Alfa engcom-Alfa self-assigned this Nov 30, 2020
@engcom-Alfa engcom-Alfa added Component: Sales Component: Quote Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Dec 2, 2020
@engcom-Alfa engcom-Alfa added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Dec 2, 2020
@engcom-Alfa engcom-Alfa added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Dec 2, 2020
@magento-engcom-team
Copy link
Contributor

@engcom-Alfa Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@magento-engcom-team magento-engcom-team removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Dec 2, 2020
@engcom-Alfa engcom-Alfa removed their assignment Dec 2, 2020
@viniciusbordinhao-blueacorn
Copy link
Contributor

@magento I am working on it.

@viniciusbordinhao-blueacorn
Copy link
Contributor

@piuga @sdzhepa

I am not sure if that is the best solution for the issue, maybe change the way how the file type options of the product are saved should be the best option. But for now, that is the solution that I could provide.

Please let me know if you have any concern or changes that could become that solution better than that one developed.

@engcom-November engcom-November self-assigned this Sep 13, 2022
@m2-assistant
Copy link

m2-assistant bot commented Sep 13, 2022

Hi @engcom-November. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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-November
Copy link
Contributor

Verified the issue on Magento 2.4-develop branch but the issue is not reproducible.
Even after running the cron - able to download custom option file from Sales - Oders - Order details page.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Sep 15, 2022
@engcom-November
Copy link
Contributor

We are closing this issue as there has been no latest update on the same. Please create new issue if the issue is still reproducible.
Thank you.

@gersonhernandez
Copy link

I share the solution I developed.

https://github.com/gersonhernandez/GersonHernandez_DownloadCustomOptionFile

<?php
        if (!$option->getId()) {

            try {
                $key = $this->getRequest()->getParam('key');
                $itemCollection = $this->itemCollectionFactory->create();
                $itemCollection->addFieldToFilter('product_options', ['like' => '%' . $key . '%']);
        
                $item = $itemCollection->getFirstItem();
                $options = $item->getProductOptions()['options'];
                foreach ($options as $opt) {
                    if ($opt['option_type'] == 'file') {
                        $info = $this->serializer->unserialize($opt['option_value']);
                        if ($info['secret_key'] == $key) {
                            $this->download->downloadFile($info);
                        }
                    }
                }
            } catch (\Throwable $th) {
                $this->logger->debug($th->getMessage());
                return $resultForward->forward('noroute');
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Quote Component: Sales Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: needs update Additional information is require, waiting for response Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.3.5-p2 Indicates original Magento version for the Issue report. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Archived in project
8 participants